# http://hledger.org/journal.html#market-prices # http://hledger.org/hledger.html#market-value # 1. Market prices are ignored by -B. < P 2011/01/01 € $1.35 2011/01/01 expenses:foreign €100 assets $ hledger -f- bal -NB €-100 assets €100 expenses:foreign # 2. Market prices are used by bal -V. # Market prices for other commodities are not used. # Nor are transaction prices. < P 2011/01/01 € $1.35 P 2011/01/01 GBP $1.35 2011/01/01 (expenses:foreign) €100 @ $1.20 $ hledger -f- bal -N -V $135.00 expenses:foreign # 3. Market prices in the future (later than today's date) are always ignored. #453, #683 # XXX not working right now < P 2000/1/1 $ €1.20 P 3000/1/1 $ €1.30 3000/01/01 (a) $100 $ hledger -f- bal -N -V €120.00 a # 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. < 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 $ hledger -f- bal -N -V a -e 3000/2 €130.00 a # 5. Again, this time there are prices later than the journal data and # an explicit report end date brings them into play. < P 3000/1/1 $ €1.10 P 3000/2/1 $ €1.30 3000/01/01 (a) $100 $ hledger -f- bal -N -V a -e 3000/2 €130.00 a # 6. Market prices interact with D directives and with amount style canonicalisation. #131 < 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 $ hledger -f- balance -V 150.48 H a -150.00 H b -------------------- 0.48 H # 7. register -V affects posting amounts and total. < P 2000/1/1 $ €1.20 2000/1/1 (a) $100 $ hledger -f- reg -V 2000/01/01 (a) €120.00 €120.00 # 8. print -V affects posting amounts but not balance assertions. < P 2000/1/1 $ €1.20 2000/1/1 (a) $100 = $100 $ hledger -f- print -V 2000/01/01 (a) €120.00 = $100 >=0 # print -V --value-date < P 2000/01/01 A 1 B P 2000/02/01 A 2 B P 2000/03/01 A 3 B P 2000/04/01 A 4 B 2000/01/01 (a) 1 A 2000/02/01 (a) 1 A 2000/03/01 (a) 1 A # 9. value with prices on transaction (posting) dates $ hledger -f- print -V --value-date=transaction 2000/01/01 (a) 1 B 2000/02/01 (a) 2 B 2000/03/01 (a) 3 B >=0 # 10. value with prices on last day of report period (2000-02-29) $ hledger -f- print -V --value-date=period date:2000/01-2000/03 2000/01/01 (a) 2 B 2000/02/01 (a) 2 B >=0 # 11. value with prices on last day of report period with no period # specified - uses last day of journal (2000-03-01) $ hledger -f- print -V --value-date=period 2000/01/01 (a) 3 B 2000/02/01 (a) 3 B 2000/03/01 (a) 3 B >=0 # 12. value with prices on current date # (this test assumes today's date is >= 2000-04-01) $ hledger -f- print -V --value-date=current 2000/01/01 (a) 4 B 2000/02/01 (a) 4 B 2000/03/01 (a) 4 B >=0 # 13. value with prices on a custom date $ hledger -f- print -V --value-date=2000-01-15 2000/01/01 (a) 1 B 2000/02/01 (a) 1 B 2000/03/01 (a) 1 B >=0