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 789808 - Yahoo csv modules incl. currency of online quotes no longer working
Yahoo csv modules incl. currency of online quotes no longer working
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Documentation
2.6.18
Other Windows
: Normal major
: ---
Assigned To: gnucash-documentation-maint
gnucash-documentation-maint
: 789913 789938 791104 791662 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-11-02 09:22 UTC by Adrian Holbrook
Modified: 2018-06-30 00:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Adrian Holbrook 2017-11-02 09:22:39 UTC
When I hit the "Get Quotes" button I get a blank command line display but nothing happens. Worked OK up to now. I then updated PERL to the latest standard and then had to update Gnucash to 2.6.18. Everything installed OK but when I run Get Quotes I get the same blank display. I am running Windows 10 on a 64 bit system. I installed the 64 bit version of Strawberry Perl. Ran the Install online Price Retrieval and everything appeared to install OK with no errors.
Comment 1 Mike Evans 2017-11-02 14:53:48 UTC
I don't think this is GnuCash bug. Apparently Yahoo isn't returning any results today.
Comment 2 Andrew 2017-11-02 16:49:47 UTC
The bug report for Finance::Quote - https://rt.cpan.org/Public/Bug/Display.html?id=123490

It's a Yahoo bug.
Comment 3 Andrew Fister 2017-11-03 05:14:15 UTC
If I follow the link in that cpan bug:
http://download.finance.yahoo.com/d/quotes.csv

Presumably this is where the quotes come from, but the response from yahoo is now:

"It has come to our attention that this service is being used in violation of the Yahoo Terms of Service. As such, the service is being discontinued. For all future markets and equities data research, please refer to finance.yahoo.com."

It seems like now Finance::Quote needs an alternative source for data.
Comment 4 TomRat 2017-11-04 16:06:40 UTC
I don't know how to specifically fix this but one can retrieve individual quotes with the similar syntax

 http://finance.google.com/finance?q=nasdaq:goog

or
 
 http://finance.google.com/finance?q=mtuf:vtsax

for example.  A possible alternative source for data.  Google only goes back 12 months, however.
Comment 5 John Ralls 2017-11-04 16:23:18 UTC
Since GnuCash retrieves only the latest quote Google's limitation isn't a problem. Most of the other quote sources work from regular web pages, too. The only complication is that someone needs to write and then maintain code to find the necessary information amongst the returned html and possibly also perform any required httpxmlrequests. That's not difficult code but it's fiddly, time consuming. and has to be redone every time the provider changes the look of the page.
Comment 6 Geert Janssens 2017-11-05 13:25:17 UTC
*** Bug 789913 has been marked as a duplicate of this bug. ***
Comment 7 John Ralls 2017-11-05 18:33:22 UTC
*** Bug 789938 has been marked as a duplicate of this bug. ***
Comment 8 John Ralls 2017-11-05 23:13:40 UTC
From Erik Colson, the maintainer of Finance::Quote:
"Hello,

"F::Q 1.39 with support for the AlphaVantage API has been uploaded to
CPAN.  You will need to get your own API KEY and add it as an
environment variable on your system.  You can get it through the website
https://www.alphavantage.co/.

"On linux systems this can an be done by adding this line to your
.profile file:

" export ALPHAVANTAGE_API_KEY=##############

"AlphaVantage doesn't offer a currency field as did yahoo.  Therefor I
added basic support for deducing a currency.  For now it works for
symbols without a suffix (returns USD as currency as for IBM, CSCO), and
for .BR which returns EUR (i.e. SOLB.BR).  You can send me further
suffix - currency pairs which I'll add to the module."

It may take a few hours for CPAN to index the new version and that has to happen before gnc-fq-update or the Mac and Windows tools (which just call gnc-fq-update) will work.

Note as well that GnuCash runs Finance::Quote by shelling out to perl and it's perl that needs to see the ALPHAVANTAGE_API_KEY; what OS you use and how you launch GnuCash may affect what environment perl sees. No doubt there will be some advice on gnucash-user as various users get it working on their operating systems and desktop environments. We recommend that everyone follow the discussion there.
Comment 9 Geert Janssens 2017-11-06 12:52:43 UTC
I would suggest to try and add the key to the gnucash environment file. This should properly export it for use within gnucash which is where most users want it.

It's location depends a bit on the platform used
* Linux like systems: /etc/gnucash/environment
* Windows: c:\Program Files(x86)\gnucash\etc\gnucash\environment
* OS X/Quarz: Gnucash.app/Contents/Resources/etc/gnucash/environment

Note as of gnucash 2.7 you should create/edit a file called environment.local in the same location instead. The latter won't be overwritten when you upgrade the Gnucash application.

Inside this file add the line 
ALPHAVANTAGE_API_KEY=##############
Obviously, the #-signs should be replaced with the real key.
Comment 10 Andrew Fister 2017-11-07 04:10:53 UTC
Using GnuCash 2.6.17 on Ubuntu, I followed these steps to try to use AlphaVantage to get quotes:

1) With CPAN updated Finance::Quote on both my user and root user.
2) Got an AlphaVantage API Key
3) Added ALPHAVANTAGE_API_KEY=############## to /etc/gnucash/environment
4) Added "export ALPHAVANTAGE_API_KEY=##############" to ~/.profile and ran the script.

4) Ran "gnc-fq-dump alphavantage MSFT". Always got an error. Ran "gnc-fq-dump alphavantage VGSIX". Vanguard funds work...most of the time. AlphaVantage seems to be a bit unreliable from request to request. I tried doing direct API queries via curl and found that a number of valid requests would return various errors sporadically when doing the same request multiple times.

5) In GnuCash, opened Tools->Security Editor. Changed all securiities one by one to either not get online quotes or I clicked "Unknown" category and then selected "alphavantage" from the list.

6) Do some kind of restarting the environment step, let's say reboot the computer to be safe.

7) Executed "Get Quotes" on Price Editor. Still get a similar error as before when using Yahoo. I don't know how to get extra logging to show up for this function. --debug on gnucash cli didn't help.

Please let me know if you have any feedback on whether anyone else was able to get this to actually work in GnuCash with multiple securities in the Securities Editor.
Comment 11 TomRat 2017-11-07 13:52:58 UTC
2.6.17 Gnucash Finance::Quote 1.43
Multiple securities worked.....infrequently. 

Most of my entries in the Securities Editor are mutual funds and not individual stocks. The frequent error response is the same as when using Yahoo.  Something about ....unknown errors....

Regardless whether generating an usual error or infrequent success, response was dog slow.
Comment 12 Adrian Holbrook 2017-11-07 16:25:04 UTC
(In reply to John Ralls from comment #5)
> Since GnuCash retrieves only the latest quote Google's limitation isn't a
> problem. Most of the other quote sources work from regular web pages, too.
> The only complication is that someone needs to write and then maintain code
> to find the necessary information amongst the returned html and possibly
> also perform any required httpxmlrequests. That's not difficult code but
> it's fiddly, time consuming. and has to be redone every time the provider
> changes the look of the page.

Does this mean that the bug is officially closed and this is the recommended method to obtain quotes. As a user as opposed to a developer I am a bit in the dark on what I need to do to get this working on my Gnucash installation on Windows. The suggestion seems to be to follow the discussion on a forum somewhere. Is there a link for this?
Comment 13 John Ralls 2017-11-07 17:36:01 UTC
It's the only method to obtain quotes automatically. Unfortunately it's not terribly satisfactory; there are serious performance issues and it doesn't handle all currency exchange rates.

The "forum" in question is a mailing list, gnucash-users@gnucash.org that one may subscribe to at https://lists.gnucash.org/mailman/listinfo/gnucash-user. If you prefer a web presentation you can use http://gnucash.1415818.n4.nabble.com/ but you need to subscribe to the list in order to post.

I've added step-by-step instructions at https://wiki.gnucash.org/wiki/FAQ#Q:_Why_doesn.27t_online_quoting_work.3F.

Windows users will find it easiest to use "Install Online Price Retrieval..." in the GnuCash folder of the Start Menu to update Finance::Quote.
Comment 14 Andrew Fister 2017-11-08 03:55:53 UTC
OK, I'd like to update the status from my previous comment. I double checked the Securities Editor and found that I had a couple still relying on Yahoo. I changed those to alphavantage and was able to get prices updated successfully.

Thanks for the speedy help John!
Comment 15 John Ralls 2017-11-08 04:19:22 UTC
Don't thank me, thank Erik.
Comment 16 Andrew Fister 2017-11-08 05:51:04 UTC
Thanks Erik!
Comment 17 Adrian Holbrook 2017-11-08 13:07:40 UTC
(In reply to John Ralls from comment #13)
> It's the only method to obtain quotes automatically. Unfortunately it's not
> terribly satisfactory; there are serious performance issues and it doesn't
> handle all currency exchange rates.
> 
> The "forum" in question is a mailing list, gnucash-users@gnucash.org that
> one may subscribe to at
> https://lists.gnucash.org/mailman/listinfo/gnucash-user. If you prefer a web
> presentation you can use http://gnucash.1415818.n4.nabble.com/ but you need
> to subscribe to the list in order to post.
> 
> I've added step-by-step instructions at
> https://wiki.gnucash.org/wiki/FAQ#Q:_Why_doesn.27t_online_quoting_work.3F.
> 
> Windows users will find it easiest to use "Install Online Price
> Retrieval..." in the GnuCash folder of the Start Menu to update
> Finance::Quote.

I followed your instructions and everything appeared to work fine apart from a couple of issues which maybe I should be looking on another thread for answers. 

1. I immediately became a multimillionaire as all my shares increased by a factor of 100 - obviously this was short lived as I realised that the quotes were in Pence and not GBP as previously supplied using Yahoo (I live in the UK and use the LSE). Is there any way to correct this?

2. None of my funds update. They used to with yahoo. This may be because the format of the Symbol entry should change - I use the ISIN with the addition of .L for LSE. eg GB00B3VDD431.L
Comment 18 John Ralls 2017-11-08 15:17:57 UTC
Both issues have already come up on gnucash-user, please do at least monitor it on the list archive or Nabble. I think the GBP/GBp problem can be solved quickly. Unfortunately AFAIK there's no way to search Alphavantage for securities to find out if they even provide quotes, never mind what they might use for a symbol.
Comment 19 Frank H. Ellenberger 2017-12-02 06:27:07 UTC
I reopen it, because https://code.gnucash.org/docs/C/gnucash-help/tips.html still needs an update.
Comment 20 Frank H. Ellenberger 2017-12-02 06:29:47 UTC
*** Bug 791104 has been marked as a duplicate of this bug. ***
Comment 21 David 2017-12-03 09:12:03 UTC
Frank,  

I think this entire Appendix should be removed. Finance::Quote is a separately-maintained Perl package, and as we are not the experts regarding F::Q, its features, or its functionality, it would be better in the long term simply to remove this information here, and let the maintainers of Finance::Quote keep things up to date. 

Section 9.6 of the Guide covers the topic of installation and usage of Finance::Quote in Gnucash generally; I think we should leave the specifics of implementation to the F::Q community.

I think this bug should be closed.
Comment 22 Frank H. Ellenberger 2017-12-03 09:51:03 UTC
David,

as you can see at the bottom of 
https://code.gnucash.org/docs/C/gnucash-help/apas01.html:
 Sources: src/engine/gnc-commodity.c:gnc_quote_source (commit 05da881, which was adjusted for Finance::Quote 1.38), GnuCash-Wiki, bugzilla, mailing list archive. 

I will have to update src/engine/gnc-commodity.c:gnc_quote_source, too - add alphavantage, mark yahoo obsolete, check for other changes ...

There I will scan the docs of the modules and if insufficient, their sources.
And then I have already all information required to update the appendix in en and de, too.

At least for non-US users it is really hard to find the right combination for source and symbol in the current docs of the FQ modules.

On the long run it might be less work if FQ would require a standardized documentation for all modules. Perhaps one day I will submit a bunch of patches there after learning perldoc ...

BTW: You can see my first version before I updated 
https://github.com/Gnucash/gnucash-docs/blob/792665c09779f70898e04b5e1350b8993d674c5e/help/C/Help_tips-appendix.xml
at https://wiki.gnucash.org/wiki/De/Referenz#Online-Kursabfrage_mit_FinanceQuote

And here you are right: I should replace the wiki version by a link to the docs to have less redundancy. ;-)
Comment 23 John Ralls 2017-12-15 22:41:29 UTC
*** Bug 791662 has been marked as a duplicate of this bug. ***
Comment 24 David 2017-12-16 08:59:53 UTC
(In reply to Frank H. Ellenberger from comment #22)
Frank,

I only just saw this response. I honestly don't understand what you are proposing to do, and it doesn't sound like you are replying to my recommendation that the entire Appendix be removed. 

I strongly believe that the GnuCash documentation is the wrong place to document F::Q. The code is not maintained by GnuCash developers--and F::Q is used by other packages as well. If there is a problem with F::Q documentation, I think it is more appropriate for the F::Q community to improve their docs. I still feel that appendix A should be removed entirely.

I'm not sure I understand your comment about replacing the wiki with links.

David
Comment 25 Frank H. Ellenberger 2018-02-05 09:25:31 UTC
David, we spent more time over discussions about removing stuff than it takes to fix it.

Other places, where yahoo is referenced in the docs, I greped only LANG=C here:

guide/C/ch_currency.xml:563:      The ticker for this stock is 0694.HK on Yahoo! 
guide/C/ch_currency.xml:791:                  on Yahoo it is ERRICB.ST</para>

in help/C:
Help_ch_Account-Actions.xml:527:               Currently among the supported quote sources are; Yahoo, Yahoo Europe, Fidelity
Help_ch_Account-Actions.xml:531:               <note><para>Note that Yahoo will provide price quotes for many mutual
Help_ch_Account-Actions.xml:533:               at Yahoo should be identical to those that may be found at the source sites.</para></note>
Help_ch_Account-Actions.xml:535:               <para>If you are outside the US and use one of the different Yahoo sources or
Help_ch_Account-Actions.xml:536:               multiple sources containing Yahoo, you should append the market code for the security
Help_ch_Account-Actions.xml:538:               in the Paris market).  <xref linkend="gnc-tbl-fq-yahoo-exchange-codes"></xref> below lists suffixes for various
Help_ch_Account-Actions.xml:547:               on-line quotes you are receiving. For example, Yahoo normally quotes Eastern

Because at the time of creating the docs Yahoo was the main source, it might require some rethinking:
If "Yahoo" is a source, it can be replaced by yahoo_json or alphavantage. For other occurences we will need other public sources.

http://www.financial-hacker.com/bye-yahoo-and-thank-you-for-the-fish/ has an overview of some other possible resources.


Today I incorporated Geerts recent changes (Preference->Online Quotes) in help: commit 8460176.
Comment 26 Chris Good 2018-03-13 19:23:59 UTC
(In reply to TomRat from comment #4)
> I don't know how to specifically fix this but one can retrieve individual
> quotes with the similar syntax
> 
>  http://finance.google.com/finance?q=nasdaq:goog
> 
> or
>  
>  http://finance.google.com/finance?q=mtuf:vtsax
> 
> for example.  A possible alternative source for data.  Google only goes back
> 12 months, however.

Hi TomRat,

As I think some-one else already pointed out in the mailing list, according to the Terms Of Service link at the bottom of the finance.google.com pages:

Using our Services

You must follow any policies made available to you within the Services. 

Don’t misuse our Services. For example, don’t interfere with our Services or try to access them using a method other than the interface and the instructions that we provide.

If you can get agreement from Google that we can use web page scraping to extract stock price info from their web pages, I can try to do it.
Comment 27 Frank H. Ellenberger 2018-03-15 17:25:46 UTC
Because I reopened this bug as a reminder to apply 
commit b4c948c - Update Help Tips to commit c0fd3b3, which was adjusted for Finance::Quote 1.47

So I will close it now. Feel free to reopen it in the case you see still mayor issues in our documentation of F::Q.

Help_ch_Account-Actions.xml:527: Currently among the supported quote sources are; Yahoo, Yahoo Europe, Fidelity 
is fixed in commit ec5aed7: Replace outdated online quote sources by link to Help Tips,
but the chapter is still outdated. The description of dialogs is missing some fields and we could extend some parts of the text. But that is not related to this bug.

Note, that only the CSV interface of yahoo and its regional variants got closed. JSON and YQL were still available, when I tested them these days.

About new sources:
financial-hacker (#c25) mentions several, but 
somebody has to
* write a perl module, 
* add a pull request at github.com/finance-quote/finance-quote
Erik has to
* accept it
* release a new F::Q version
Only then we can add it to the lists in our 
* code and 
* doc.
Comment 28 John Ralls 2018-06-30 00:00:28 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=789808. Please update any external references or bookmarks.