Finance::Quote Yahoo_JSON Alpha Vantage

Chris Good goodchris96 at gmail.com
Sun Apr 1 21:51:00 EDT 2018


Hi,

 

I have no problems using Yahoo_JSON as a quote source for my 16 stocks for
which I download prices only weekly.

However, I have been working with another user and it seems Yahoo_JSON fails
when there are many stocks and/or prices for them are requested often.

 

I suggest people who run into Yahoo _JSON problems use Alpha Vantage as the
quote source.

See
https://wiki.gnucash.org/wiki/FAQ#Q:_Why_doesn.27t_online_quoting_work.3F

 

Alpha Vantage purposefully fails quote requests if it detects a user hogging
their web server resources by returning an Information message that says:

Please consider optimizing your API call frequency

and pausing for approx. 20 seconds.

 

If you use Alpha Vantage, there have been mods made to Finance::Quote so
that usage complies with the Alpha Vantage recommendations that only 1 price
request per second is made in order to ensure that the webserver resources
are shared amongst all users.

 

If the information message is detected for a particular stock (or currency
conversion thanks Mike Alexander), then Finance::Quote also pauses for 20
seconds, then retries up to 4 times.

As this means you should not have to retry getting prices for all stocks or
currencies if you have a failure, and this will minimise usage of the Alpha
Vantage web server, I suggest people install the modified perl programs.

 

The modified Finance::Quote perl programs are currently not yet incorporated
into the latest version of Finance::Quote (1.47), and as the Finance::Quote
maintainers are, like everyone else, busy, it may be a long time (it has
been over a year in the past) before these mods are included in the next
release of Finance::Quote.

 

To install these mods without waiting for them to be incorporated in
Finance::Quote:

 

1. Make sure the standard Quote.pm and AlphaVantage.pm files are writable.

 

For Windows 10 these files are usually:

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

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

Using File Manager, right click on the file, Properties, Untick 'Read Only',
then OK

 

For Ubuntu Linux, these files are usually:

/usr/local/share/perl/5.22.1/Finance/Quote.pm

/usr/local/share/perl/5.22.1/Finance/Quote/AlphaVantage.pm

>From a terminal:

cd /usr/local/share/perl/5.22.1/Finance

sudo chmod 666 Quote.pm Quote/AlphaVantage.pm

 

2. To install the modified Quote.pm:

Open
https://raw.githubusercontent.com/mtalexander/finance-quote/6ee43ea08b504617
142139fda41ae45be865fa38/lib/Finance/Quote.pm

in a browser, click in the code, then  use Control-A to highlight it all,
then paste it into a text editor

(say Notepad for Windows, or gedit for Linux), then 'Save As' over the top
of the existing
Quote.pm.



3. To install the modified AlphaVantage.pm:

Open
https://github.com/mtalexander/finance-quote/blob/6ee43ea08b504617142139fda4
1ae45be865fa38/lib/Finance/Quote/AlphaVantage.pm

 

in a browser, click in the code, then  use Control-A to highlight it all,
then paste it into a text editor

(say Notepad for Windows, or gedit for Linux), then 'Save As' over the top
of the existing
AlphaVantage.pm.




Sorry, I don't have a Mac so I cannot provide instructions.

 

If you want to check on the progress of the Pull Request to incorporate
these changes in Finance::Quote, please see:

https://github.com/finance-quote/finance-quote/pull/85

 

Regards, Chris Good

 



More information about the gnucash-user mailing list