Getting rate and date from PriceDB for a report

J. Alex Aycinena alex.aycinena at
Wed Mar 5 13:55:40 EST 2008

I'm writing a report in which I convert a transaction amount from the account
currency to the reporting currency using "gnc:exchange-by-pricedb-nearest",
which works fine.

However, in the report, I want to show the details of the calculation, to
provide a complete audit trail, such as, for example:

 "Converted GTQ 5.00 @ PriceDB lookup rate of 0.190694 as of 1992-Dec-31"

Can someone suggest the scheme procedure to use to get the rate and date
used by "gnc:exchange-by-pricedb-nearest", if one is available. If I try to
calculate the rate using the resulting conversion, due to rounding, I get a
slightly different result from the rate actually in the PriceDB (e.g., 0.19).

In looking in the Gnucash site, it appears that in version 1.8 there was a
"gnc:pricedb-lookup-nearest-in-time" that would return a price quote with the
right data, but it doesn't seem to be available anymore.

Is there some other way that that can be done currently or does that
procedure need to be made available to scheme to get that data? I see that
"gnc_pricedb_lookup_nearest_in_time" is in gnc-pricedb.c.

I would appreciate any help.

More information about the gnucash-devel mailing list