Edit prices for multiple gnucash files

spotty albino jehelsby at iinet.net.au
Wed Oct 31 03:28:53 EDT 2012


Stuart McGraw wrote
> Hi Joshua,
> 
> I've mailed you the scripts mentioned on the gnucash 
> separately.  I figured I post what I know about them here 
> in case it is useful to someone else in the future.
> As mentioned, the scripts are just modified versions
> of what is on http://wiki.gnucash.org/wiki/Stocks/get_prices
> 
> * imp_history.py
> ----------------
> Looking at this it seems to mostly be stylistic changes.  The
> only substantive changes seem to be accepting the input file
> name on the command line and accepting the additional columns 
> that the revised get_history.pl produces.  Note that this program
> works only with a Gnucash XML file at the moment (although
> it hardwires the input file name into an "//xml:" url internally;
> using with db backend might be as simple as changing the url.)
> And of course you need Python installed in order to run it.
> It also requires a version of Gnucash that was built with the 
> Python bindings.  If your version of Gnucash wasn't, then you
> will get an error like
>   ImportError: No module named gnucash
> (and some other stuff) when you run it.
> 
> ~~~~
> I just tried running the programs on a test Gnucash file.
> Note that the the stocks for which history is being added
> need to be in Gnucash already, with at least one price for
> each.  (They can be a bogus price entry that you delete 
> after importing the real prices.)  
> 
> # Get historical quotes for Starbucks from July 2012 to present:
> $ perl get_history.pl -q -f 2012-07-01 -t today > sbux.csv
> $ cat sbux.csv
> 2012/06/01, SBUX, Q, 53.1100, 54.0600, 52.0400, 52.1500, 8728200,
> Finance::QuoteHist::Yahoo
> 2012/06/04, SBUX, Q, 52.0000, 53.9700, 51.4900, 53.9000, 12251400,
> Finance::QuoteHist::Yahoo
> 2012/06/05, SBUX, Q, 52.3500, 52.6800, 51.6300, 52.4100, 11168800,
> Finance::QuoteHist::Yahoo
> [...]
> 
> # Import into Gnucash:
> $ python imp_history.py test.gnucash sbux.csv
> Adding[0]: SBUX, 2012-06-01 00:00:00, 52.15
> Adding[1]: SBUX, 2012-06-04 00:00:00, 53.9
> Adding[2]: SBUX, 2012-06-05 00:00:00, 52.41
> [...]
> 
> And opening gnucash afterwards shows the prices have been 
> added.  
> 
> Hope this helps...

Hi Stuart.

I've loaded the Python bindings into my GNU Cash and tried running the
imp_history.py script.

I get an error message as follows;

"WARN <gnc.backend.dbi> [gnc_module_init_backend_dbi()] No DBD drivers
found"

I imagine this relates to the database backend that you mentioned in an
earlier post. Would you be able to help me resolve this? Is it relatively
simple to install?

Thanks for the help so far, I feel I'm close to getting GNUCash working for
me.
Regards

Josh
Joshua






--
View this message in context: http://gnucash.1415818.n4.nabble.com/Edit-prices-for-multiple-gnucash-files-tp4656941p4657583.html
Sent from the GnuCash - User mailing list archive at Nabble.com.


More information about the gnucash-user mailing list