irc pricedb discussion

Rob Browning
28 Feb 2001 10:20:35 -0600

Derek Atkins <warlord@MIT.EDU> writes:

> 1) Implicit quotes should be added to the price-db (on the date of
> the transaction).  The only problem is that you now need to keep a
> pointer so that if the transaction changes, you need to update the
> price-db as well.  So that could be a pain.

Originally, this is what I'd thought, but after thinking about the
complexities involved, both in the engine and in the pricedb and
register GUI interactions, and after deciding that it was unclear to
me how often this would be important or useful, I decided that unless
there were compelling reasons, addiing implicit quotes to the pricedb,
with links to/from their corresponding transactions was probably best
left off for now.

ATM I tend to suspect that most of the time, if you need the implicit
quotes, it's because you are doing something that involves traversing
the account containing those quotes anyway, so simple code to the
effect of

  (filter quotable-split? (get-splits account))

should get you the information you need.

Basically, I'm saying that until there are compelling reasons that
justify the extra complexities involved, I don't think we should put
*linked* implicit quotes into the pricedb.

Before we go there, there are also some other possibilities we can
explore.  For example:

  * (splits->pricedb splits)
    Given a list of splits, return a temporary pricedb containing all
    the implitit quotes.

> 2) The most recent price-db entry for a particular commodity (stock
> price, etc.) should be applied when you open a stock/money-market
> account.  I'd like to be able to go the vanguard, grab the prices
> for my funds, and have the 'current value' displayed (yes, I'm sure
> this was a major goal in the life of price-db :).

Right.  The way we've been talking about this is as a report, but
bear in mind, that once some issues are worked out, "reports" will be
live and one of your primary interfaces to your data.

With respect to your personal wish, much of it should be granted very
soon.  The infrastructure for that is what I'm working on right now
(tracking down a bug in gnc_book_end, actually).  I'm adding the
scaffolding for gnc_pricedb_update_prices(GNCPriceDB *db, GSList
*commodity_list).  It nearly works, and once it does, you'll then be
able to query the pricedb for the latest price for a given commodity

  price = gnc_pricedb_lookup_latest(db, commodity);

Rob Browning <> PGP=E80E0D04F521A094 532B97F5D64E3930