summaryrefslogtreecommitdiff
path: root/src/amount.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-19 17:47:46 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-19 17:47:46 -0400
commitdc91fdeff280a85b5157cf0aea56eae0bd1ae209 (patch)
tree13fea72c726aead01fe3daf4c0c728b10a74de7c /src/amount.h
parent60f9748da1a316943229087860b74ed48f9bc657 (diff)
downloadfork-ledger-dc91fdeff280a85b5157cf0aea56eae0bd1ae209.tar.gz
fork-ledger-dc91fdeff280a85b5157cf0aea56eae0bd1ae209.tar.bz2
fork-ledger-dc91fdeff280a85b5157cf0aea56eae0bd1ae209.zip
Added argument to amount_t::value() for request a market value in terms of a
specific commodity.
Diffstat (limited to 'src/amount.h')
-rw-r--r--src/amount.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/amount.h b/src/amount.h
index 0667d9c3..12711ce0 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -354,10 +354,11 @@ public:
* compact form greater than 1.0. That is, 3599s will unreduce to
* 59.98m, while 3601 unreduces to 1h.
*
- * value(optional<datetime_t>) returns the historical value for an
- * amount -- the default moment returns the most recently known
- * price -- based on the price history of its commodity. For
- * example, if the amount were 10 AAPL, and on Apr 10, 2000 each
+ * value(optional<datetime_t>, optional<commodity_t>) returns the
+ * historical value for an amount -- the default moment returns the
+ * most recently known price -- based on the price history for the
+ * given commodity (or determined automatically, if none is provided).
+ * For example, if the amount were 10 AAPL, and on Apr 10, 2000 each
* share of AAPL was worth $10, then call value() for that moment in
* time would yield the amount $100.00.
*
@@ -419,7 +420,9 @@ public:
}
amount_t& in_place_unreduce();
- optional<amount_t> value(const optional<datetime_t>& moment = none) const;
+ optional<amount_t>
+ value(const optional<datetime_t>& moment = none,
+ const optional<commodity_t&>& in_terms_of = none) const;
/**
* Truth tests. An amount may be truth test in several ways: