Yes, there is a limit of one price per day per commodity pair. Note that the code that enforces it isn’t smart enough to look at the other direction so you can have different prices for e.g. USD->EUR and EUR->USD and that will cause trouble in reports.
There’s a price-source hierarchy, see https://github.com/Gnucash/gnucash/blob/764157ddeb6e7eb90e4c9fdae00ec51dcfda35ea/libgnucash/engine/gnc-pricedb.h#L164, that establishes what kind of price source can overwrite an existing price. Regards, John Ralls > On Nov 25, 2024, at 07:20, Noerr via gnucash-user <gnucash-user@gnucash.org> > wrote: > > 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! > <Screenshot 2024-11-25 at > 07.07.55.png>_______________________________________________ > gnucash-user mailing list > gnucash-user@gnucash.org > To update your subscription preferences or to unsubscribe: > https://lists.gnucash.org/mailman/listinfo/gnucash-user > ----- > 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 ----- Please remember to CC this list on all your replies. You can do this by using Reply-To-List or Reply-All.