322 lines
7.7 KiB
Plaintext
322 lines
7.7 KiB
Plaintext
# 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. The location of price directives does not matter.
|
|
# If multiple directives have the same date, the last parsed is used.
|
|
<
|
|
3000/01/01
|
|
(a) $100
|
|
|
|
P 2000/1/1 $ €1.35
|
|
|
|
3000/03/03
|
|
(b) $100
|
|
|
|
P 2000/1/1 $ €1.30
|
|
|
|
$ hledger -f- bal -N -V a
|
|
€130.00 a
|
|
|
|
|
|
# 4. Market prices in the future (later than today's date) are ignored by default. #453, #683
|
|
<
|
|
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
|
|
|
|
|
|
# 5. Market prices in the future are still ignored by default even
|
|
# with an explicit future report end date, unlike hledger 1.14-.
|
|
<
|
|
P 3000/1/1 $ €1.10
|
|
|
|
3000/01/01
|
|
(a) $100
|
|
|
|
$ hledger -f- bal -N -V -e 3000/2
|
|
$100 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 --value-at
|
|
<
|
|
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 --value-at=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 --value-at=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 --value-at=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 --value-at=now
|
|
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 --value-at=2000-01-15
|
|
2000/01/01
|
|
(a) 1 B
|
|
|
|
2000/02/01
|
|
(a) 1 B
|
|
|
|
2000/03/01
|
|
(a) 1 B
|
|
|
|
>=0
|
|
|
|
# 14. multicolumn balance report with default value
|
|
$ hledger -f- bal -M -V
|
|
Balance changes in 2000q1:
|
|
|
|
|| Jan Feb Mar
|
|
===++===============
|
|
a || 4 B 4 B 4 B
|
|
---++---------------
|
|
|| 4 B 4 B 4 B
|
|
|
|
# 15. multicolumn balance report valued at transaction is not supported
|
|
$ hledger -f- bal -M --value-at=transaction
|
|
>2 /not yet supported with balance reports/
|
|
>=1
|
|
|
|
# 16. multicolumn balance report valued at period end
|
|
$ hledger -f- bal -M --value-at=period
|
|
Balance changes in 2000q1:
|
|
|
|
|| Jan Feb Mar
|
|
===++===============
|
|
a || 2 B 3 B 4 B
|
|
---++---------------
|
|
|| 2 B 3 B 4 B
|
|
|
|
# 17. multicolumn balance report valued at today
|
|
$ hledger -f- bal -M --value-at=now
|
|
Balance changes in 2000q1:
|
|
|
|
|| Jan Feb Mar
|
|
===++===============
|
|
a || 4 B 4 B 4 B
|
|
---++---------------
|
|
|| 4 B 4 B 4 B
|
|
|
|
# 18. multicolumn balance report valued at other date
|
|
$ hledger -f- bal -M --value-at=2000-01-15
|
|
Balance changes in 2000q1:
|
|
|
|
|| Jan Feb Mar
|
|
===++===============
|
|
a || 1 B 1 B 1 B
|
|
---++---------------
|
|
|| 1 B 1 B 1 B
|
|
|
|
# 19. single column balance report with default value
|
|
$ hledger -f- bal -V
|
|
12 B a
|
|
--------------------
|
|
12 B
|
|
|
|
# 20. single column balance report valued at transaction is not supported
|
|
$ hledger -f- bal --value-at=transaction
|
|
>2 /not yet supported with balance reports/
|
|
>=1
|
|
|
|
# 21. single column balance report valued at period end
|
|
$ hledger -f- bal --value-at=period
|
|
9 B a
|
|
--------------------
|
|
9 B
|
|
|
|
# 22. single column balance report valued at today
|
|
$ hledger -f- bal --value-at=now
|
|
12 B a
|
|
--------------------
|
|
12 B
|
|
|
|
# 23. single column balance report valued at other date
|
|
$ hledger -f- bal --value-at=2000-01-15
|
|
3 B a
|
|
--------------------
|
|
3 B
|
|
|
|
# 24. register report with default value
|
|
$ hledger -f- reg -V
|
|
2000/01/01 (a) 4 B 4 B
|
|
2000/02/01 (a) 4 B 8 B
|
|
2000/03/01 (a) 4 B 12 B
|
|
|
|
# 25. register report valued at transaction
|
|
$ hledger -f- reg --value-at=transaction
|
|
2000/01/01 (a) 1 B 1 B
|
|
2000/02/01 (a) 2 B 4 B
|
|
2000/03/01 (a) 3 B 9 B
|
|
|
|
# 26. register report valued at period end
|
|
$ hledger -f- reg --value-at=period
|
|
2000/01/01 (a) 3 B 3 B
|
|
2000/02/01 (a) 3 B 6 B
|
|
2000/03/01 (a) 3 B 9 B
|
|
|
|
# 27. register report valued at today
|
|
$ hledger -f- reg --value-at=now
|
|
2000/01/01 (a) 4 B 4 B
|
|
2000/02/01 (a) 4 B 8 B
|
|
2000/03/01 (a) 4 B 12 B
|
|
|
|
# 28. register report valued at other date
|
|
$ hledger -f- reg --value-at=2000-01-15
|
|
2000/01/01 (a) 1 B 1 B
|
|
2000/02/01 (a) 1 B 2 B
|
|
2000/03/01 (a) 1 B 3 B
|
|
|
|
# 29. periodic register report with default value
|
|
$ hledger -f- reg -V -Q
|
|
2000q1 a 12 B 12 B
|
|
|
|
# 30. periodic register report valued at transaction
|
|
$ hledger -f- reg --value-at=transaction -Q
|
|
>2 /not yet supported with periodic register reports/
|
|
>=1
|
|
|
|
# 31. periodic register report valued at period end
|
|
$ hledger -f- reg --value-at=period -Q
|
|
>2 /not yet supported with periodic register reports/
|
|
>=1
|
|
|
|
# 32. periodic register report valued at today
|
|
$ hledger -f- reg --value-at=now -Q
|
|
2000q1 a 12 B 12 B
|
|
|
|
# 33. periodic register report valued at other date
|
|
$ hledger -f- reg --value-at=2000-01-15 -Q
|
|
2000q1 a 3 B 3 B
|
|
|