summaryrefslogtreecommitdiff
path: root/src/pool.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-20 18:02:19 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-20 18:02:19 -0400
commitfc7e67f40368914d74f6cd3521ac2b7faea01280 (patch)
treea840b15aee7dbb2f7f5a8768cb406be0595162d9 /src/pool.cc
parent71de29d2d586b024e1990389d6ab09bc057e62dc (diff)
downloadfork-ledger-fc7e67f40368914d74f6cd3521ac2b7faea01280.tar.gz
fork-ledger-fc7e67f40368914d74f6cd3521ac2b7faea01280.tar.bz2
fork-ledger-fc7e67f40368914d74f6cd3521ac2b7faea01280.zip
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.
Diffstat (limited to 'src/pool.cc')
-rw-r--r--src/pool.cc8
1 files changed, 7 insertions, 1 deletions
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;