11.3. Helper Scripts for Update and Diagnostics

Abstract

GnuCash provides several utilities that will help you select the correct symbols and verification for the desired online quote source. Another script performs the first-time installation or keeps Finance::Quote up to date. And finally, tools for error analysis are also available.

Procedure 11.7. Running Perl Scripts Under Windows

  1. Open a CMD or Powershell window: Click Start and type either cmd or powershell then select the resulting menu item. You don't need to run as administrator.

  2. Since, as previously recommended, the GnuCash directory was entered in the PATH envinronment variable, prefix any gnc-fq-xxx Perl script command with Perl and a space, e.g. perl gnc-fq-check. Otherwise you have to execute the command e.g. C:\strawberry-perl\bin\perl.exe C:\Program Files (x86)\gnucash\bin\ gnc-fq-check.

11.3.1. gnc-fq-check

Abstract

This program returns the version number of Finance::Quote module currently installed as well as a list of sources available via Finance::Quote. It will also inform you if there is a problem with your installation and may suggest a fix.

$ gnc-fq-check
Can't locate Mozilla/CA.pm in @INC (you may need to install the Mozilla::CA module)
(@INC contains: /usr/lib/perl5/site_perl/5.30.1/x86_64-linux-thread-multi /usr/
lib/perl5/site_perl/5.30.1 /usr/lib/perl5/vendor_perl/5.30.1/x86_64-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.30.1 /usr/lib/perl5/5.30.1/x86_64-linux-thread-multi
/usr/lib/perl5/5.30.1 /usr/lib/perl5/site_perl)
at /usr/lib/perl5/vendor_perl/5.30.1/Finance/Quote/Tiaacref.pm line 33.
Compilation failed in require at (eval 303) line 1.
BEGIN failed--compilation aborted at (eval 303) line 1.
 at /usr/local/bin/gnc-fq-check line 91.
("1.47" "adig" "aex" "aiahk" "alphavantage" "amfiindia" "asegr" "asia" "asx"
"australia" "bamosz" "bet" "bmonesbittburns" "bourso" "brasil" "bse" "bsero" "canada"
"canadamutual" "citywire" "cominvest" "cse" "deka" "dutch" "dwsfunds" "europe"
"fetch_live_currencies" "fidelity" "fidelity_direct" "fidelityfixed" "financecanada"
"finanzpartner" "finland" "fool" "france" "ftfunds" "ftportfolios" "ftportfolios_direct"
"fundlibrary" "goldmoney" "greece" "hex" "hu" "hufund" "hungary" "hustock" "indiamutual"
"known_currencies" "lerevenu" "maninv" "morningstar" "morningstarjp" "mstaruk" "nasdaq"
"nyse" "nz" "nzx" "platinum" "romania" "seb_funds" "sixfunds" "sixshares"
"stockhousecanada_fund" "tdefunds" "tdwaterhouse" "tiaacref" "tnetuk" "troweprice"
"troweprice_direct" "trustnet" "tsp" "tsx" "uk_unit_trusts" "ukfunds" "unionfunds"
"usa" "usfedbonds" "vanguard" "vwd" "yahoo" "yahoo_asia" "yahoo_australia"
"yahoo_brasil" "yahoo_europe" "yahoo_json" "yahoo_nz" "yahoo_yql" "za" "za_unittrusts")

The first part is the error message about a missing Perl-modul Mozilla/CA.pm. At the end in parentheses is the normal output of the currently installed Finance::Quote version[11] and a list of available sources.

Tip

If an error is displayed, see the next section Section 11.3.2, “gnc-fq-update”. Otherwise, continue with Section 11.3.3, “gnc-fq-dump”.

11.3.2. gnc-fq-update

Abstract

This program installs or updates the Finance::Quote software module along with its dependencies.

Note

Windows users are generally better off using the update-tool StartGnuCashInstall Online Price Retrieval for GnuCash.

Note

This program needs superuser or administrative privileges to succeed in Linux or macOS but not in Windows.

gnc-fq-update will launch a Perl CPAN [12] module internally. When you launch the CPAN module for the first time, you must setup and configure it. However, on the most systems if you accept the default settings or answer the first question Are you ready for manual configuration? [yes] with no, you will be able to install Finance::Quote successfully.

11.3.3. gnc-fq-dump

Abstract

This program returns quote data for a source and a list of symbols in a format which is easy to read for humans. It is useful for checking that a given online quote source is up and functional.

You can use this command to verify that the symbol , which you want to use for your security for online quote retrieval, works for the desired qoute source. .

Tip

With gnc-fq-dump you can check symbols faster than from GnuCash if an error occurs during the retrieval with GnuCash. This might save you from running GnuCash with debug logging enabled while checking a nonworking symbol.

  • To get verbose information about a security, run a command from the command line of the form:

    gnc-fq-dump [-v] Source Symbol...

    e.g. gnc-fq-dump -v yahoo_json IBM.

  • To retrieve currency exchange rate run the following command: gnc-fq-dump [-v] currency USD EUR [13] [14]

To test that Finance::Quote is working for currencies within GnuCash,

  1. find a transaction between the desired commodity and the book currency and

  2. right-click on it, then

  3. select Edit Exchange Rate in the context menu.

The Section 6.1, “Transfer Funds Dialog Box” will appear. Click the Fetch Rate button and if everything is behaving itself the current rate will fill in the exchange rate box.

11.3.4. gnc-fq-helper

This is a script that GnuCash uses to retrieve quotes and not usually useful for the user to run. Should the retrieval of a symbol in GnuCash result in failures, this script can be used to perform diagnostics and help developers decide if the error is in GnuCash or Finance::Quote.



[11] The most recent Finance::Quote version is 1.53.

[13] Since Finance::Quote 1.41 the default source for currencies is hardcoded to be Alpha Vantage. Also read the notes on Table A.1, “Currency source for Finance::Quote”.

[14] The old yahoo currencies are still available as gnc-fq-dump yahoo_json USDEUR=X.