[GNC] Currency exchange rates retrieval with GC 3.2
John Ralls
jralls at ceridwen.us
Thu Sep 6 15:16:31 EDT 2018
> On Sep 6, 2018, at 9:21 AM, Manfred Usselmann <manfred at usselmann.de> wrote:
>
> Am 06.09.2018 16:33, schrieb John Ralls:
>
>>
>>
>>> On Sep 6, 2018, at 12:15 AM, Manfred Usselmann <manfred at usselmann.de <mailto:manfred at usselmann.de>> wrote:
>>>
>>>
>>>
>>> Hi,
>>>
>>> I'm using GnuCash 3.2 with Finance::Quote 1.47 on Ubuntu 18.04.
>>>
>>> When trying to download currency exchange rates this fails with "Unknown
>>> error".
>>>
>>> I've registered an ALPHAVANTAGE_API_KEY and entered it on the settings
>>> screen.
>>>
>>> Some tests from the command line:
>>>
>>> $ GNC-FQ-DUMP -V ALPHAVANTAGE CHFEUR=X
>>> Finance::Quote fields Gnucash uses:
>>> symbol: CHFEUR=X <=== required
>>> date: 09/06/2018 <=== recommended
>>> currency: USD <=== required
>>> last: 0.8842 <=\
>>> nav: <=== one of these
>>> price: <=/
>>> timezone: <=== optional
>>>
>>> All fields returned by Finance::Quote for stock CHFEUR=X
>>>
>>> stock field value
>>> ----- ----- -----
>>> CHFEUR=X close: 0.8842
>>> CHFEUR=X currency: USD
>>> CHFEUR=X currency_set_by_fq: 1
>>> CHFEUR=X date: 09/06/2018
>>> CHFEUR=X high: 0.8847
>>> CHFEUR=X isodate: 2018-09-06
>>> CHFEUR=X last: 0.8842
>>> CHFEUR=X low: 0.8840
>>> CHFEUR=X method: alphavantage
>>> CHFEUR=X open: 0.8845
>>> CHFEUR=X success: 1
>>> CHFEUR=X symbol: CHFEUR=X
>>> CHFEUR=X volume: 0
>>>
>>> $ ECHO '(ALPHAVANTAGE "CSCO")' | GNC-FQ-HELPER
>>> (("CSCO" (symbol . "CSCO") (gnc:time-no-zone . "2018-09-05 12:00:00")
>>> (last . 47.2700) (currency . "USD")))
>>
>> Does the CSCO price retrieval work in GnuCash?
>>
>
>
> No, also got unknown error. I'm not sure though that I set it up correctly. The command line was just copied from somewhere, the wiki I believe.
>
>
>
>>
>>
>> I created a CHFEUR=X security, set it to retrieve quotes from Alphavantage, and successfully retrieved the price in GnuCash.
>>
>
> I did not create a security, just a currency account.
>
>
>>
>> Note, however, that it's not a meaningful value: CHFEUR=X retrieves the price in EUR of 1CHF, but Finance::Quote treats it as USD because Alphavantage doesn't tell it otherwise.
>>
>
>
> Mmh, but the manual says to use Alphavantage for currencies?
>
> Are there any instructions which should work. I just want to download exchange rates... ;-)
>
> Unknown error is not really helpful... The exact error message is "Beim Herunterladen der Börsenkurse ist ein unbekannter Fehler aufgetragen.”
Currency quotes are taken care of separately and use a different syntax in gnc-fq-dump and gnc-fq-helper:
gnc-fq-dump currency CHF EUR
echo ‘(currency “CHF” “EUR”)’ | gnc-fq-helper
It does use Alphavantage, but that part is built in to Finance::Quote and GnuCash sends the query shown to gnc-fq-helper for currency accounts.
Yes, we know that "unknown error" isn’t very helpful. Unfortunately there's no good way to get more detail about the error from perl to scheme so that's the best we can do. Double check that you correctly copied the API key into GnuCash Preferences, that's the most likely cause of being able to get quotes from the command line but not from within GnuCash.
Regards,
John Ralls
More information about the gnucash-user
mailing list