[GNC] Online Currency Exchange Rates
Jim DeLaHunt
list+gnucash at jdlh.com
Sun Aug 14 23:25:57 EDT 2022
On 2022-08-14 14:42, John Ralls wrote:
> We got a bug report,https://bugs.gnucash.org/show_bug.cgi?id=798599, this morning reporting that currency exchange rates aren't working.
>
> After a bit of fiddling I got an intelligible error message:
> Thank you for using Alpha Vantage! This is a premium endpoint. You may subscribe to any of the premium plans athttps://www.alphavantage.co/premium/ to instantly unlock all premium endpoints.
>
> The cheapest one is $50/month. I don't think anyone here will find that attractive. Finance Quote offers three other sources for exchange rates but it will take a bit of work on our scripts to make that accessible to GnuCash. In the meantime anyone needing currency exchange rates will have to get them from the web and create prices manually.
Thank you, John. I too noticed the problem retrieving rates. It is nice
to have an explanation. Maybe AlphaVantage just recently reclassified
this API endpoint from free to premium.
Looking at the AlphaVantage API documentation, I see that the
CURRENCY_EXCHANGE_RATE function[1] is (now) marked "Premium", but the
FX_DAILY function[2] is not. It looks like Finance::Quote is using the
former[3].
I just tried using both endpoints, using my free API key. I see the same
error message you cite for CURRENCY_EXCHANGE_RATE, but I got a response
for FX_DAILY.
Could Finance::Quote and GnuCash switch to using FX_DAILY? I would be
delighted if one call to Get Quotes in GnuCash gave me 100 days of
exchange rate history!
I opened an issue #229 "AlphaVantage.co function CURRENCY_EXCHANGE_RATE
no longer accepts free API keys." with Finance::Quote in Github[4].
Example of exercising the AlphaVantage API functions with a free API key
(elided here):
% curl"https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_symbol=EUR&to_symbol=USD&apikey=elided"
{
"Information": "Thank you for using Alpha Vantage! This is a premium endpoint. You may subscribe to any of the premium
plans athttps://www.alphavantage.co/premium/ to instantly unlock all premium endpoints"
}
% curl"https://www.alphavantage.co/query?function=FX_DAILY&from_symbol=EUR&to_symbol=USD&apikey=elided"
{
"Meta Data": {
"1. Information": "Forex Daily Prices (open, high, low, close)",
"2. From Symbol": "EUR",
"3. To Symbol": "USD",
"4. Output Size": "Compact",
"5. Last Refreshed": "2022-08-15 03:00:00",
"6. Time Zone": "UTC"
},
"Time Series FX (Daily)": {
"2022-08-15": {
"1. open": "1.02570",
"2. high": "1.02683",
"3. low": "1.02380",
"4. close": "1.02470"
},
"2022-08-14": {
…[elided]…
},
"2022-03-28": {
"1. open": "1.09938",
"2. high": "1.11363",
"3. low": "1.09705",
"4. close": "1.09938"
}
}
}
[1] <https://www.alphavantage.co/documentation/#currency-exchange>
[2] <https://www.alphavantage.co/documentation/#fx-daily>
[3]
<https://github.com/finance-quote/finance-quote/blob/0cfaced5ca98e7cd01ede237a73d3a70f40e2403/lib/Finance/Quote/CurrencyRates/AlphaVantage.pm#L56>
[4] <https://github.com/finance-quote/finance-quote/issues/229>
More information about the gnucash-user
mailing list