Hi all,

I've written a command-line tool to fetch daily historical prices. It
currently supports 5 sources of data and will generate output in 4 formats,
including SQL for a GnuCash database.

https://gitlab.com/chrisberkhout/pricehist

Fetching prices and immediately applying them to a GnuCash database is done
as in the following examples:

pricehist fetch ecb EUR/USD -s 2021-06-25 -o gnucash-sql | sqlite3
Accounts.gnucashpricehist fetch ecb EUR/USD -s 2021-06-25 -o
gnucash-sql | mysql -u username -p -D databasenamepricehist fetch ecb
EUR/USD -s 2021-06-25 -o gnucash-sql | psql -U username -d
databasename -v ON_ERROR_STOP=1

I discuss some details of the generated SQL in the source code:

https://gitlab.com/chrisberkhout/pricehist/-/blob/master/src/pricehist/outputs/gnucashsql.py

As far as I am aware GnuCash's built-in price fetching is for current
prices only. The wiki documents wrapper scripts for the Finance::QuoteHist
Perl module, and the Piecash library has a Commodity.update_prices method
for fetching historical prices, but I hope that pricehist will make
fetching historical prices easy for GnuCash users who don't want to write
their own code for it.

If pricehist might be useful for you please try it and let me know what you
think. I'm still improving error handling and some other things but the
main functionality is done.

Cheers,
Chris
_______________________________________________
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