Friday, February 28, 2014

GNU Cash (Perl Finance::Quote) Failed to Retrieve Stock Price Quotes

I have been GNU Cash for a couple of years. I set up Perl Finance::Quote to automatically update stock price quotes. GNU Cash suddenly reports that it cannot retrieve stock price quotes.

Using this opportunity, I updated GNU Cash to 2.6.1 and reinstalled Finance::Quote module. However, the problem remains.

I am running GNU Cash on both a Windows XP box and a Windows 8.1 box. On both machines I observe the same problem. The detailed problem description is as follows,

(1) Version of Perl

C:\>perl --version
This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x86-multi-
thread (with 1 registered patch, see perl -V for more detail)

Copyright 1987-2012, Larry Wall

Binary build 1603 [296746] provided by ActiveState http://www.ActiveState.com
Built Mar 13 2013 11:29:21


(2) Perl Finance::Quote with GNU Cash

C:\Program Files\gnucash\bin>perl gnc-fq-check
("1.18" "vwd" "yahoo_nz" "australia" "amfiindia" "usfedbonds" "canada" "yahoo" "
adig" "bux" "aiahk" "bsero" "yahoo_australia" "unionfunds" "lerevenu" "asia" "ts
x" "sixfunds" "indiamutual" "bse" "hungary" "known_currencies" "fidelity_direct"
 "goldmoney" "tdwaterhouse" "trustnet" "ftportfolios_direct" "cominvest" "mornin
gstar" "ftportfolios" "tdefunds" "hu" "za" "fundlibrary" "stockhousecanada_fund"
 "yahoo_europe" "platinum" "maninv" "tsp" "financecanada" "usa" "france" "trowep
rice" "nasdaq" "bmonesbittburns" "yahoo_asia" "tiaacref" "troweprice_direct" "se
b_funds" "yahoo_brasil" "greece" "fidelity" "fetch_live_currencies" "romania" "d
wsfunds" "finland" "hex" "brasil" "asegr" "deka" "nyse" "canadamutual" "asx" "fi
nanzpartner" "fool" "dutch" "uk_unit_trusts" "sixshares" "nzx" "aex" "nz" "vangu
ard" "europe" "bourso") 
 

(3) Problem: when Finance::Quote in GNU Cash is being installed, the installation script actually reports an error despite that it states the process was successful. See below,

C:\Program Files\gnucash\bin>install-fq-mods.cmd
GNU Cash
......
* Run gnc-fq-helper

Use of uninitialized value within %info in string eq at C:/Perl/site/lib/Finance
/Quote/Yahoo/Base.pm line 222, <> line 1.
Use of uninitialized value $info{"Missing Symbols List.\34p_change"} in substitu
tion (s///) at C:/Perl/site/lib/Finance/Quote/Yahoo/Base.pm line 238, <> line 1.

Use of uninitialized value within %info in pattern match (m//) at C:/Perl/site/l
ib/Finance/Quote/Yahoo/Base.pm line 243, <> line 1.
(#f)

* Installation succeeded

(4) gnc-fq-dump and gnc-fq-helper fails. Now I try GNU Cash's gnc-fq-dump, it actually fails. It is perhaps the result of some issue with Active Perl. For instance,

C:\Program Files\gnucash\bin>echo (yahoo "TGT") | perl gnc-fq-helper
Use of uninitialized value within %info in string eq at C:/Perl/site/lib/Finance
/Quote/Yahoo/Base.pm line 222, <> line 1.
Use of uninitialized value $info{"Missing Symbols List.\34p_change"} in substitu
tion (s///) at C:/Perl/site/lib/Finance/Quote/Yahoo/Base.pm line 238, <> line 1.

Use of uninitialized value within %info in pattern match (m//) at C:/Perl/site/l
ib/Finance/Quote/Yahoo/Base.pm line 243, <> line 1.
(#f)

which is the same error I saw during the installation of the Finance::Quote module.

I attempted a few methods neither of which works. The methods I attempted were.
(1) Completely remove GNU Cash and Active Perl and reinstall GNU Cash and Active Perl
(2) Update Perl modules using "cpan -r".

What actually works is to replace Active Perl by Strawberry Perl. I obtain this solution by reading " install-fq-mods.cmd that actually attempts to install Strawberry Perl if perl cannot be found.

Here is the steps that leads to a success.
(1). Completely remove Active Perl. There is no need to reinstall GNU Cash. So leave GNU Cash alone
(2). Download and install Strawberry Perl
(3). Install Perl Finance::Quote module


C:\Program Files\gnucash\bin>install-fq-mods.cmd

(4). Test the functionality using gnc-fq-helper

C:\Program Files\gnucash\bin>echo (yahoo "JPM") | perl gnc-fq-helper
(("JPM" (symbol . "JPM") (gnc:time-no-zone . "2014-02-27 16:01:00") (last . 56.6
9) (currency . "USD")))

(5). Test the functionality using gnc-fq-dump

C:\Program Files\gnucash\bin>perl gnc-fq-dump nyse JPM TGT
Finance::Quote fields Gnucash uses:
    symbol: JPM                  <=== required
      date: 02/27/2014           <=== required
  currency: USD                  <=== required
      last: 56.69                <=\
       nav:                      <=== one of these
     price: 56.69                <=/
  timezone:                      <=== optional
=====

Finance::Quote fields Gnucash uses:
    symbol: TGT                  <=== required
      date: 02/27/2014           <=== required
  currency: USD                  <=== required
      last: 60.66                <=\
       nav:                      <=== one of these
     price: 60.66                <=/
  timezone:                      <=== optional

It works.
By the way, the information about version of the Perl and Finance::Quote are as follows,

C:\Program Files\gnucash\bin>perl --version

This is perl 5, version 18, subversion 2 (v5.18.2) built for MSWin32-x86-multi-t
hread-64int

Copyright 1987-2013, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.


C:\Program Files\gnucash\bin>perl gnc-fq-check
("1.20" "bitcoin_gbp" "known_currencies" "bsero" "bitcoin_sek" "fetch_live_curre
ncies" "hu" "hex" "bitcoin_nok" "australia" "bitcoin_cad" "tdefunds" "mtgox_jpy"
 "fool" "bitcoin_hkd" "yahoo_europe" "mtgox_chf" "finanzpartner" "europe" "bitco
in_cny" "ftportfolios_direct" "unionfunds" "bitcoin_thb" "ftportfolios" "yahoo_b
rasil" "uk_unit_trusts" "lerevenu" "aiahk" "bmonesbittburns" "mtgox_hkd" "sixsha
res" "yahoo_nz" "mtgox_nok" "deka" "za" "maninv" "nasdaq" "bourso" "tsx" "bitcoi
n_jpy" "financecanada" "mtgox_dkk" "dwsfunds" "cominvest" "sixfunds" "bitcoin_sg
d" "mtgox_eur" "asegr" "mtgox_usd" "bitcoin_usd" "fidelity" "stockhousecanada_fu
nd" "bitcoin_chf" "asx" "fundlibrary" "bitcoin_pln" "mtgox_aud" "nzx" "amfiindia
" "nz" "romania" "bitcoin_rub" "yahoo" "nyse" "tiaacref" "canada" "asia" "usa" "
greece" "france" "hungary" "mtgox_pln" "fidelity_direct" "bse" "yahoo_asia" "bux
" "troweprice_direct" "mtgox_sgd" "morningstarjp" "platinum" "aex" "mtgox_cny" "
mtgox_sek" "yahoo_australia" "mtgox_rub" "usfedbonds" "mtgox_nzd" "bitcoin_dkk"
"brasil" "trustnet" "vanguard" "adig" "vwd" "mtgox_cad" "bitcoin_eur" "canadamut
ual" "finland" "bitcoin_nzd" "troweprice" "dutch" "indiamutual" "tdwaterhouse" "
tsp" "seb_funds" "goldmoney" "morningstar" "mtgox_thb" "bitcoin_aud" "mtgox_gbp"
)

which means that it is probably that Finance::Quote 1.20 works while 1.18 has some problem.

2 comments:

  1. It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted
    Best quoting software

    ReplyDelete
  2. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. Aplikasi Saham

    ReplyDelete