Fix for yahoo_json for Windows users

Chris Good goodchris96 at gmail.com
Fri Mar 2 19:02:11 EST 2018


Hi,

 

Getting stock prices from the ASX stopped working approx. 11th Feb 2018 when
the m.asx.com website began being redirected to the ASX home website.

If you'd prefer not to use AlphaVantage, which I believe can be intermittent
sometimes, an alternative GnuCash source for stocks is Yahoo as JSON.

Unfortunately, source Yahoo as JSON in Windows was not returning a valid
date as Windows strftime function does not handle %T, so this was causing
many perl warnings. These warning did not seem to matter when only looking
up 1 stock, Finance::Quote would return date 00/00/2011 and gnc-fq-helper
would change this invalid date to the current date.  But when looking up
multiple stocks (>15 in my case), it caused GnuCash to hang.

 

There is now a fix available so that YahooJSON.pm returns the correct date
of the stock price, but it is not yet included in the official
Finance::Quote module available from CPAN (currently version 1.47).

 

If you'd like to manually install the fix now, it is available on github in
my personal github repository:

Enter 

https://github.com/goodvibes2/finance-quote/blob/FqIss78YahooJson/lib/Financ
e/Quote/YahooJSON.pm

in a browser, click on the Raw button which should open the contents of the

new YahooJSON.pm file on a new page.

Use Control-A to highlight it all, then paste it into a text editor, say
Notepad, then

'Save As' over the top of the existing YahooJSON.pm:

 

Windows (Strawberry Perl):

  C:\strawberry\perl\site\lib\Finance\Quote\YahooJSON.pm

 

To test in a cmd.exe window:

cd \Program Files (x86)\gnucash\bin\

echo (yahoo_json "CBA.AX") | perl gnc-fq-helper

 

The response should be the following with no warnings:

(("CBA.AX" (symbol . "CBA.AX") (gnc:time-no-zone . "2018-03-02 12:00:00")
(last . 75.73) (currency . "AUD")))

 

To setup a GnuCash stock to use YahooJSON for an Australian stock, in the
Tools, Security Edit window, add the .AX suffix to the Symbol to tell
YahooJSON that this stock is on the Australian Stock Exchange,  and select
Single, Yahoo as JSON as the 'Type of quote source'. Eg:

 

Symbol                 CBA.AX

Display symbol   CBA

Type                                    ASX

Get Online Quotes           Ticked

Type of quote source      Single    Yahoo as JSON

 

Regards, Chris Good

 



More information about the gnucash-user mailing list