From fc7e67f40368914d74f6cd3521ac2b7faea01280 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 20 Jun 2010 18:02:19 -0400 Subject: Do not record market values for fixated exchanges Do not record commodity exchanges where amount's commodity has a fixated price, since this does not establish a market value for the base commodity. --- src/pool.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/pool.cc') diff --git a/src/pool.cc b/src/pool.cc index 618a43c5..df20d179 100644 --- a/src/pool.cc +++ b/src/pool.cc @@ -254,7 +254,13 @@ commodity_pool_t::exchange(const amount_t& amount, DEBUG("commodity.prices.add", "exchange: per-unit-cost = " << per_unit_cost); - if (! per_unit_cost.is_realzero()) + // Do not record commodity exchanges where amount's commodity has a + // fixated price, since this does not establish a market value for the + // base commodity. + if (! per_unit_cost.is_realzero() && + (current_annotation == NULL || + ! (current_annotation->price && + current_annotation->has_flags(ANNOTATION_PRICE_FIXATED)))) exchange(commodity, per_unit_cost, moment ? *moment : CURRENT_TIME()); cost_breakdown_t breakdown; -- cgit v1.2.3