After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 795564 - Quote retrieval appears to not continue after a failure from Finance::Quote (using Alphavantage).
Quote retrieval appears to not continue after a failure from Finance::Quote (...
Status: RESOLVED NOTGNOME
Product: GnuCash
Classification: Other
Component: Currency and Commodity
git-maint
Other Linux
: Normal normal
: future
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2018-04-26 07:31 UTC by Edward d'Auvergne
Modified: 2018-06-30 00:08 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Edward d'Auvergne 2018-04-26 07:31:52 UTC
From my testing of GnuCash 2.6.18, 2.6.19, 3.0, and maint, it appears that GnuCash's quote retrieval is faulty.  This is either in the GUI or on the command line using --add-price-quotes.  It appears as though quotes are retrieved until a certain Finance::Quote failure occurs, and then no other quotes on the list are subsequently retrieved.  I reported this downstream at:

https://bugs.mageia.org/show_bug.cgi?id=22834

Unfortunately my scheme abilities are not good enough to allow me to debug libgnucash/scm/price-quotes.scm.  I can only guess that the divide by zero error below is somehow responsible:

$ gnc-fq-dump currency USD XAU
1 USD = 0.00075451 XAU
$ gnc-fq-dump currency USD XAU
1 USD = 0.00075451 XAU
$ gnc-fq-dump currency USD XAU
Illegal division by zero at /usr/lib/perl5/vendor_perl/5.22.3/Finance/Quote.pm line 289.
$ gnc-fq-dump currency USD CNY
1 USD = <unknown> CNY
$ gnc-fq-dump currency USD CNY
1 USD = <unknown> CNY
$ gnc-fq-dump currency USD CNY
1 USD = <unknown> CNY
$ gnc-fq-dump currency CNY
$ gnc-fq-dump currency CNY EUR
1 CNY = 0.12991535 EUR
$ gnc-fq-dump currency CNY USD
1 CNY = 0.15822534 USD
$ gnc-fq-dump currency USD CNY
1 USD = 6.3201 CNY
$
Comment 1 John Ralls 2018-04-26 14:35:43 UTC
The divide-by-zero is a Finance::Quote bug, not a GnuCash one.

Otherwise the example seems to show that Alphavantage isn't terribly reliable. Nothing we can do about that, either. Note that Alphavantage's website says that they'll throttle if they get too many requests from an IP, so retrying isn't likely to be a good approach.

Yes, there are error conditions from Finance::Quote that price-quotes.scm can't figure out and when it encounters one it bails with the infamous "unknown error retrieving quotes" dialog. Lately that's most often occurred when a user had a Yahoo! quote source in their file but there are other reasons as well, and Finance::Quote crashing would be one of them. After all, GnuCash calls Finance::Quote once with a list of symbols and gets back a list of prices to process. If F::Q crashes then there's no list and nothing much price-quotes.scm can do besides tell the user that something went wrong.

F::Q takes bug reports at http://rt.cpan.org/Public/Dist/Display.html?Status=Active&Name=Finance-Quote.
Comment 2 Edward d'Auvergne 2018-04-27 07:37:59 UTC
There are two behaviours that I see, the first I assume is the F::Q bug, the second I guess is an inability to process what F::Q returns.

1)  The first behaviour is that none of the securities are updated.  I can only guess that this is the F::Q divide by zero issue causing no quotes to be returned.

2)  The second behaviour is that a small subset of securities are updated.  This seems to have some type of order, in that certain currencies are almost always updated and others are never reached.  I would guess, probably incorrectly, that this is an issue with libgnucash/scm/price-quotes.scm not being able to process the "1 USD = <unknown> CNY" entries and not continuing to the next security.

Due to the second behaviour, I tried to modify price-quotes.scm to display each currency/security on stdout as it is being processed, so that I could see each security either being updated or skipped.  However my lack of scheme skills got in the way.  I think this would be useful feedback, especially when running with --add-price-quotes on the command line.

Cheers,
Edward
Comment 3 Edward d'Auvergne 2018-05-15 10:36:19 UTC
I have reported this upstream to F::Q at:  https://rt.cpan.org/Public/Bug/Display.html?id=125310.  The second issue listed above however is more likely to be on the Gnucash side rather than F::Q.
Comment 4 Chris Good 2018-06-23 08:01:38 UTC
Hi Edward, you may find the fixes detailed in
https://lists.gnucash.org/pipermail/gnucash-user/2018-April/075839.html
make AlphaVantage more reliable.
Comment 5 John Ralls 2018-06-30 00:08:57 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=795564. Please update any external references or bookmarks.