[GNC] questions about the python bindings and pricdb add_price()
pudgier_fruit.0v at icloud.com
pudgier_fruit.0v at icloud.com
Mon Nov 25 10:20:10 EST 2024
Hi,
I've made some progress to insert commodity price history into my
GnuCash security price database using the python API. I have a few
questions to finish off my goal.
I worked from two examples: https://wiki.gnucash.org/wiki/Stocks/get_prices
and
https://github.com/hjacobs/gnucash-stock-portfolio/blob/master/portfolio.py
I'm wondering if I need to be thinking about hour of the day or time zones
on the datetime object set on GncPrice.set_time64() ? For the moment,
I'm only setting the date associated with the price. Does the pricedb
accept multiple prices in one day (say, for a market-traded security). My
intention is only to record the close-price for such securities anyway.
I observe that on dates where my pricedb already had a price from an
existing source (transaction, occasional Finance::Quote update, etc. that a
new price was not added on that day). Is there a limit of one price per
day?
How do I populate the "Source" and "Type" columns that display in the GUI
Price Database? Currently, my new prices have Source "invalid" and an
empty Type column.
p = GncPrice(book)
p.set_time64(price_date ) #price_date is a datetime.datetime object
p.set_commodity(commodity)
p.set_currency(gnc_currency)
p.set_value(price_gnc)
pricedb.add_price(p)
[image: Screenshot 2024-11-25 at 07.07.55.png]
Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2024-11-25 at 07.07.55.png
Type: image/png
Size: 230549 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20241125/4cd9d6fe/attachment-0001.png>
More information about the gnucash-user
mailing list