[GNC] Stock Quotes

Wm wm_o_o_o at yahoo.co.uk
Sun Jan 13 11:11:08 EST 2019


On 03/01/2019 19:03, nvsoar wrote:
> On 01/02/19 08:51, Dave Cooper via gnucash-user wrote:
>> Hi gnucash
>>
>> I have returned to gnu-cash having not used it for several years so 
>> please bear with me.
>> I have reloaded the system and set it up to get some UK stock prices 
>> (LSE) using Alphavantage
>> Unfortunately I get poor results - only 25% - 50% prices are returned 
>> - I assume this is caused by time outs
>> As a temporary fix I now use yahoo - json  which gets results every 
>> time so far, but I have to manually adjust these prices because the 
>> return is in pence not pounds
>> Is there a parameter or easy way to fix this?
>>
>> I note that yahoo are having problems due to their historical data for 
>> UK is in pounds - not that I am going there.
>>
>> Cheers
>> Dave
> A solution to AlphaVantage limits is in Ameet Sengar's message; 
> available here.
> https://lists.gnucash.org/pipermail/gnucash-user/2018-September/079698.html
> It has been my experience that the AlphaVantage.pm file is read only. 
> Change file properties to read write to modify;  then back to read 
> only.  (Notepad++ worked well for me on a Win10 system.)

Because Quote.pm is hard coded to use Alphavantage for exchange rates it 
is also useful to put a delay in there if you have more than a few 
currencies.

..\perl\site\lib\Finance\Quote.pm

I put it in just before the call to the outside world
===
   my $ALPHAVANTAGE_API_KEY = $ENV{'ALPHAVANTAGE_API_KEY'};
   return undef unless ( defined $ALPHAVANTAGE_API_KEY );

   sleep(15);

   my $reply = $ua->request(GET "${ALPHAVANTAGE_CURRENCY_URL}"
     . "&from_currency=" . ${from}
     . "&to_currency=" . ${to}
     . "&apikey=" . ${ALPHAVANTAGE_API_KEY} );

===

Own risk, etc.

-- 
Wm



More information about the gnucash-user mailing list