I have built myself a solution for this. I'm not certain why asking gnucash to add the price quotes hangs for me. However I found that if I used Python to call the perl script for each individual stock and then the GNUCash Python API to write the information it all works.

The script "get_quotes.py" in the repository https://github.com/jpschewe/gnucash-stock-portfolio implements this. It looks for stocks and mutual funds that have non-zero balances and have online quotes enabled. It respects the alphavantage API rate limit and has an automatic backoff.

Note that this is a fork of a repository from Henning Jacobs. I found that repository to have a good start on this and a nice patch for ensuing that GncPrice objects are properly created.

Jon Schewe

On 9/24/19 5:43 AM, Jon Schewe wrote:
I took my gnucash file and stripped out everything except the price database and the commodities and found the same behavior. Since this doesn't have any personal information, other than which commodities I'm watching, I'm comfortable sharing it. Perhaps someone else has a configuration that works and I can replicate it.

I'm running "gnucash --add-price-quotes accounts.gnucash".


On 9/24/19 5:09 AM, Jon Schewe wrote:
According to gnc-fq-check I have 1.47. The 5 quotes/minute restriction would explain why when I ran the gnc-fq-dump commands manually I didn't get quotes for a lot of the commodities. However it doesn't explain the process hanging.

I left it running all night last night in strace and it never finished.
It was sitting here all night:
8835  write(2, "Use of uninitialized value $q[1]"..., 116) = 116
8835  write(2, "Use of uninitialized value $q[2]"..., 116) = 116
8835  write(2, "Use of uninitialized value $q[1]"..., 116 <unfinished ...>
8826  <... poll resumed> )              = 0 (Timeout)
8826  poll([{fd=11, events=POLLIN}], 1, -1 <unfinished ...>


On 9/23/19 10:25 PM, John Ralls wrote:
Have you updated Finance::Quote to 1.49? It throttles the Alphavantage requests to comply with their 5 quotes/minute restriction.

You might also consider using yahoo_json for as many non-currency commodities as you can. Yahoo! still supports the json API and doesn't require throttling.

Regards,
John Ralls

On Sep 23, 2019, at 6:59 PM, Jon Schewe <jpsch...@mtu.net> wrote:

I just tried 3.7.0 from ppa:sicklylife/gnucash and the behavior hasn't changed.

On 9/23/19 2:25 PM, Adrien Monteleone wrote:
There are no updates to the 2.6 series any longer. 2.6.21 is the last one and nearly 18 months old. There have been eight 3.x releases so far.

You can build from source, or there are debs floating around on the list for 3.7 that you should be able to install on 18.04.


Regards,
Adrien

On Sep 23, 2019 w39d266, at 5:58 AM, Jon Schewe <jpsch...@mtu.net> wrote:

I'm using GnuCash 2.6.19 that ships with Ubuntu 18.04. I'm finding that the update price quotes process is hanging, both from within GnuCash and from the command line.

I've created a CSV file of all of my commodities and tested them individual using gnc-fq-dump and they all return fairly quickly. Not all of them have valid prices, but none hang. Below is the script that I have used with cron in the past to update my quotes at regular intervals.

When the process is running I can strace it and I find that the perl process is usually in a write call writing "use of uninitialized value".

Does anyone have suggestions to determine why updating the quotes is hanging?

Is this a problem with this version of gnucash? I would prefer to stick with the version of gnucash that comes with my distribution so that I get automatic updates, however I can build a custom version if that is what is needed.


#!/bin/sh

ALPHAVANTAGE_API_KEY=XXXXXXX
export ALPHAVANTAGE_API_KEY
env $(dbus-launch) sh -c 'trap "kill $DBUS_SESSION_BUS_PID" EXIT; /usr/bin/gnucash --add-price-quotes ${HOME}/Documents/banking/gnucash/accounts.gnucash' 2>&1 | grep -v "Found Finance::Quote"

--
http://mtu.net/~jpschewe
_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.
--
http://mtu.net/~jpschewe

_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.



_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
If you are using Nabble or Gmane, please see 
https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

--
http://mtu.net/~jpschewe

_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
If you are using Nabble or Gmane, please see 
https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

Reply via email to