GnuCash  5.6-150-g038405b370+
Price Overview

The Prices and the Price DB overview is in src/doc/design/engine.texinfo

API: Prices

Below, a few meta-notes about how prices and the GUI (should) interact:

Computing Prices

When a price is computed from the (value/amt) that a user entered in a register, and this price is stored in the priceDB, then both the register entry and the price must have links to each other (via the KVP trees) so that each can be found from the other.

This is needed because if the user enters an incorrect amt or value or date in the transaction register, and then corrects it later, possibly weeks or months later, the corresponding price in the priceDB must be fixed as well.

Similarly, if a user deletes a transaction (possibly because it contains an error in date/amt/value), then it is advisable that the corresponding priceDB entry must be deleted as well (since it is not safe to assume that the price is 'correct').


When doing price math in the register, one must be careful, because round-off errors can make 'obvious' math inaccurate. Note that if we define price as (value/amt), then we will find that value != price * amt due to roundoff handling. One must be careful and consistent in handling this in the register, as otherwise users will be driven crazy by inconsistent behaviour.

(Linas Vepstas April 2003)