# 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
<<<
P 2011/01/01 € $1.35
2011/01/01
expenses:foreign €100
assets
>>>
€-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
2011/01/01
(expenses:foreign) €100 @ $1.20
>>>
$135.00 expenses:foreign
>>>=0
# 3. Market prices in the future (later than today's date) are always ignored. #453, #683
# XXX not working right now
hledger -f- bal -N -V
<<<
P 2000/1/1 $ €1.20
P 3000/1/1 $ €1.30
3000/01/01
(a) $100
>>>
€130.00 a
>>>=0
# 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
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
hledger -f- balance -V
<<<
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
P 2015/08/14 GGGG 32.39
2015/08/15
a 2.4120 EEEE @@ 100 ; default commodity H is used for these transaction prices
a 0.3350 FFFF @@ 25
a 0.7718 GGGG @@ 25
b ; implicit balancing amount is in the cost commodity, H
>>>
150.48 H a
-150.00 H b
--------------------
0.48 H
>>>=0
# 7. register: -V affects posting amounts and total.
hledger -f- reg -V
<<<
P 2000/1/1 $ €1.20
2000/1/1
(a) $100
>>>
2000/01/01 (a) €120.00 €120.00
>>>=0
# 8. print: -V affects posting amounts but not balance assertion amounts.
hledger -f- print -V
<<<
P 2000/1/1 $ €1.20
2000/1/1
(a) $100 = $100
>>>
2000/01/01
(a) €120.00 = $100
>>>=0