4

I have a problem getting currency and symbol quotes in GnuCash. When I open Tools - Price Database and click Get Quotes, in several seconds I see a dialog with the following text:

Unable to retrieve quotes for these items: 
  CURRENCY:CNY 
  CURRENCY:RUB 
  CURRENCY:DKK 
  CURRENCY:NOK 
  CURRENCY:GBP 
  CURRENCY:USD
Continue using only the good quotes?

And, of course, quotes didn't update. I read and checked all related issues here and on reddit/gnucash mailing list/gnucash wiki/gnucash bug tracker and didn't find an answer.

What I have:

  • GnuCash 3.4 (Finance:Quote 1.47)
  • Ubuntu 18.10

What I tried:

  • I set up Alpha Vantage API key in Preferences - Online Quotes
  • Checked that I have a latest version of Finance:Quote module
  • Opened Tools - Security Editor and checked all currencies/other symbols I need have a Get Online Quotes checkbox set. Also Single option for currencies is set to "Currency" and for US stocks it's set to "Alphavantage, US".
  • Ran gnc-fq-check in a terminal and got ("1.47" "adig" "aex" "aiahk" "alphavantage"... output, which is correct
  • Ran gnc-fq-update w/o issues
  • Ran ALPHAVANTAGE_API_KEY=[my_api_key] gnc-fq-dump currency USD GBP and got a correct output with USD to GBP price
4

The problem is in Alpha Vantage API. They don't allow more than 5 requests per minute (https://www.alphavantage.co/support/#support):

We are proud to provide free API service for our global community of users and recommend that you make API requests sparingly (up to 5 API requests per minute and 500 requests per day) to achieve the best server-side performance

Finance:Quote module has a handler for this case https://github.com/finance-quote/finance-quote/blob/master/lib/Finance/Quote/AlphaVantage.pm#L35 but it looks like GnuCash has it's own timeout (10 seconds) and won't force user to wait 3 minutes to get an information about e.g. 15 symbols (15 symbols / 5 symbols per minute = 3 minute). If Finance:Quote won't get all quotes in 10 seconds (and it won't) you will see the error dialog as in question above.

How to handle this? There is no good solution for this issue unless there will be another free API w/o such strict limits. The only option I see for me is going to Tools - Security Editor and uncheck Get Online Quotes checkbox for all symbols, except 5 most important. If you still want to get information about more than 5 symbols, you need to understand that you can't request more than 5 symbols updates per minute.

This source helped me to find the roots of the problem: https://lists.gnucash.org/pipermail/gnucash-user/2018-February/074973.html.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.