2016-12-30 22:43:06 +03:00
|
|
|
# http://hledger.org/journal.html#market-prices
|
|
|
|
# http://hledger.org/hledger.html#market-value
|
|
|
|
|
|
|
|
# 1. Market prices are ignored by -B.
|
|
|
|
hledger -f- bal -NB
|
2015-11-22 19:37:02 +03:00
|
|
|
<<<
|
|
|
|
P 2011/01/01 € $1.35
|
|
|
|
|
|
|
|
2011/01/01
|
2016-12-30 22:43:06 +03:00
|
|
|
expenses:foreign €100
|
2015-11-22 19:37:02 +03:00
|
|
|
assets
|
|
|
|
>>>
|
2016-12-30 22:43:06 +03:00
|
|
|
€-100 assets
|
|
|
|
€100 expenses:foreign
|
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 2. Market prices are used by bal -V.
|
|
|
|
# Market prices for other commodities are not used.
|
|
|
|
# Nor are transaction prices.
|
|
|
|
hledger -f- bal -N -V
|
|
|
|
<<<
|
|
|
|
P 2011/01/01 € $1.35
|
|
|
|
P 2011/01/01 GBP $1.35
|
|
|
|
|
2015-11-22 19:37:02 +03:00
|
|
|
2011/01/01
|
2016-12-30 22:43:06 +03:00
|
|
|
(expenses:foreign) €100 @ $1.20
|
|
|
|
>>>
|
|
|
|
$135.00 expenses:foreign
|
|
|
|
>>>=0
|
|
|
|
|
2017-12-30 04:11:17 +03:00
|
|
|
# 3. Market prices in the future are ignored. #453, #683
|
2016-12-30 22:43:06 +03:00
|
|
|
hledger -f- bal -N -V
|
|
|
|
<<<
|
|
|
|
P 2000/1/1 $ €1.20
|
|
|
|
P 3000/1/1 $ €1.30
|
2015-10-12 02:07:31 +03:00
|
|
|
|
2016-12-30 22:43:06 +03:00
|
|
|
3000/01/02
|
|
|
|
(a) $100
|
|
|
|
>>>
|
2017-12-30 04:11:17 +03:00
|
|
|
€120.00 a
|
2015-11-22 19:37:02 +03:00
|
|
|
>>>=0
|
|
|
|
|
2016-12-30 22:43:06 +03:00
|
|
|
# 4. The market prices in effect at the report end date are used.
|
|
|
|
# The location of price directives does not matter.
|
|
|
|
# If multiple directives have the same date, the last parsed is used.
|
|
|
|
hledger -f- bal -N -V a -e 3000/2
|
|
|
|
<<<
|
|
|
|
P 3000/3/1 $ €1.40
|
2015-10-12 02:07:31 +03:00
|
|
|
|
2016-12-30 22:43:06 +03:00
|
|
|
3000/01/01
|
|
|
|
(a) $100
|
|
|
|
|
|
|
|
3000/03/03
|
|
|
|
(b) $100
|
|
|
|
|
|
|
|
P 2000/1/1 $ €1.20
|
|
|
|
P 3000/1/1 $ €1.35
|
|
|
|
P 3000/1/1 $ €1.30
|
|
|
|
>>>
|
|
|
|
€130.00 a
|
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 5. Again, this time there are prices later than the journal data and
|
|
|
|
# an explicit report end date brings them into play.
|
|
|
|
hledger -f- bal -N -V a -e 3000/2
|
|
|
|
<<<
|
|
|
|
P 3000/1/1 $ €1.10
|
|
|
|
P 3000/2/1 $ €1.30
|
|
|
|
|
|
|
|
3000/01/01
|
|
|
|
(a) $100
|
|
|
|
|
|
|
|
>>>
|
|
|
|
€130.00 a
|
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 6. Market prices interact with D directives and with amount style canonicalisation. #131
|
2015-10-12 02:07:31 +03:00
|
|
|
hledger -f- balance -V
|
|
|
|
<<<
|
|
|
|
|
2015-11-22 19:37:02 +03:00
|
|
|
D 1000.00 H ; declare a default commodity named H
|
|
|
|
|
|
|
|
P 2015/08/14 EEEE 41.66 ; default commodity H is used for these market prices
|
|
|
|
P 2015/08/14 FFFF 74.62
|
2015-10-12 02:07:31 +03:00
|
|
|
P 2015/08/14 GGGG 32.39
|
|
|
|
|
|
|
|
2015/08/15
|
2015-11-22 19:37:02 +03:00
|
|
|
a 2.4120 EEEE @@ 100 ; default commodity H is used for these transaction prices
|
2015-10-12 02:07:31 +03:00
|
|
|
a 0.3350 FFFF @@ 25
|
|
|
|
a 0.7718 GGGG @@ 25
|
2015-11-22 19:37:02 +03:00
|
|
|
b ; implicit balancing amount is in the cost commodity, H
|
2015-10-12 02:07:31 +03:00
|
|
|
>>>
|
|
|
|
150.48 H a
|
|
|
|
-150.00 H b
|
|
|
|
--------------------
|
|
|
|
0.48 H
|
|
|
|
>>>=0
|
2016-12-30 22:43:06 +03:00
|
|
|
|