12

I made the jump from Jumsoft's Money app to GnuCash a while back. It appealed to all my OCD tendencies. I don't know how to use Perl, or stuff of the sort, but with detailed instructions I manage to get things done... when I can find them.

I set up Finance::Quote to pull quotes after I set up GnuCash. I even managed to get it to pull quotes for Korean funds. And every thing had been working well, until tonight. I only get back a pop-up that states "There was an unknown error while retrieving the price quotes." That's where I need help. What can I do?

I dug around and found that it seems that it has something to do with Yahoo Finance ending it's API support. I also learned that Finance::Quote can pull data from many sources, so I don't really understand why one missing API would break it. I also saw that someone out there is trying to use AEX to pull the quotes instead for GnuCash specifically. I found Finance::Quote on cpan (I also first heard of cpan), but I don't understand what I'm looking at. But that's all beside the point. I don't know how to fix this.

Any help would be appreciated. I'm on Windows 10, GnuCash version 2.6.17, and have Strawberry Perl 5.18.2.2-32bit installed.

edit Thanks everyone who responded. It seems to be working more or less. The currency and Korean funds still haven't updated, but you've shown this horse to water. I'll do my best to drink it now.

4 Answers 4

7

The Yahoo Finance API is no longer available, so Finance::Quote needs to point at something else. Recent versions of Finance::Quote can use AlphaVantage as a replacement for the Yahoo Finance API, but individual users need to acquire and input an AlphaVantage API key. Pretty decent documentation for how to this is available at the GnuCash wiki.

Once you've followed the directions on the wiki and set the API key, you still need to tell each individual security to use AlphaVantage rather than Yahoo Finance:

  1. Open the Security Editor (Tools menu -> Security Editor)
  2. Double-click the security
  3. Then, under Quote Source Information...
    1. Check Get Online Quotes
    2. Check the Unknown: radio button
    3. Change Unknown:'s associated menu item to alphavantage.

As a warning, I've been having intermittent trouble with AlphaVantage. From the GnuCash wiki:

Be patient. Alphavantage does not have the resources that Yahoo! did and it is common for quote requests to time out, which GnuCash will present as "unknown error".

I've certainly been experiencing those errors, though not always.

4
  • Of course, gnucash doesn't let you bulk-update your sources to change them all from Yahoo to Alphavantage. An evil addendum to this solution (because it's non-sustainable) is to go into your Finance/Quote perl package and trick Finance::Quote to use Alphavantage when Yahoo is requested.
    – Tyler A.
    Dec 26, 2017 at 5:19
  • 2
    After following these directions and the ones on the GnuCash wiki I don't see alphavantage as an option in the Unknown menu. What could I have done wrong?
    – zorkerz
    Jan 1, 2018 at 17:19
  • alphaavantage wasn't showing up for me. I updated F:Q again using CPAN Finance::Quote command from perl. Restarted GnuCash, and it appeared. Feb 11, 2018 at 22:01
  • When I go through these steps, GnuCash never seems to remember the setting. I set it to "Unknown: alphavantage", but when I click on "OK", close the securities editor and open it again, it always comes back to the default "Single: Currency" setting. Feb 17, 2018 at 0:04
4

The yahoo finance API is no longer which broke the Finance:Quote perl module. The Finance:Quote developers have been quick to fix things and have produced several new versions in the last week or two. The short of it is that you need to update Finance:Quote, then obtain an AlphaVantage free key and tell Gnucash to use AlphaVantage as it's source for online quotes by editing your securities in the Price Editor.

3
  • 2
    To expand on this, you can get a key here alphavantage.co/support/#api-key and then you need to put it into ALPHAVANTAGE_API_KEY environment variable when running GnuCash. Nov 13, 2017 at 3:06
  • 1
    Thanks Andy and Konstantin Pereiaslov. I took a look around where you pointed me too and I'm stuck again. I got an AlphaVantage key. I updated Finance::Quote outside of GnuCash. Then I looked at the price editor. I don't know where or how to "tell Gnucash to use AlphaVantage as it's source" or how to "put [the key] into ALPHAVANTAGE_API_KEY environment variable when running GnuCash" Can I get a few more details?
    – user64682
    Nov 14, 2017 at 7:30
  • The Gnucash-users archive email list for this month is full of info. Also, this link is good: wiki.gnucash.org/wiki/…. and finally @Brian's answer also goes into a little more detail which is useful.
    – Andy
    Nov 15, 2017 at 14:49
2

Well, I had the same problem, tried solving with Quotes::Finance, cpan, but never really made it. So, I made a small python script to fetch prices from alphavantage for all the registered stocks and append the prices to gnucash database. It works with gnucash sqlite3 backend, but you can probably easily adapt it to other sql backends:

https://gist.github.com/pedrovgp/e5b68c3de385f48b86e6309350184482

The gotcha is that registering the prices requires you to know the stock currency's guid (id in the database, in the commodities table) in advance. You can either find it out or let the script assume the currency from the last price registered.

1

As an addendum to @Brian's answer, once you've set up AlphaVantage, if you are using the database backend you can bulk edit the source for your securities. Close GnuCash, open the GnuCash sql file in your favorite DB editor, and run the following query:

UPDATE commodities SET quote_source="alphavantage" WHERE quote_source="yahoo";

or

UPDATE commodities SET quote_source="alphavantage" WHERE namespace="FUND";

Vary the WHERE clause as needed to capture all the relevant securities. You need the WHERE clause so you don't clobber commodities that are not securities.

You must log in to answer this question.