112 lines
2.4 KiB
Plaintext
112 lines
2.4 KiB
Plaintext
# 1. by default only market prices are reported
|
|
<
|
|
P 2016/1/1 EUR $1.06
|
|
P 2016/2/1 EUR $1.05
|
|
|
|
2016/1/1 paycheck
|
|
income:remuneration $-100
|
|
income:donations $-15
|
|
assets:bank
|
|
|
|
2016/1/2 spend
|
|
expenses 20 EUR @ $1.07
|
|
assets:bank
|
|
$ hledger prices -f-
|
|
P 2016-01-01 EUR $1.06
|
|
P 2016-02-01 EUR $1.05
|
|
|
|
# 2. costs from postings can be included also
|
|
<
|
|
P 2016/1/1 EUR $1.06
|
|
P 2016/2/1 EUR $1.05
|
|
|
|
2016/1/1 paycheck
|
|
income:remuneration $-100
|
|
income:donations $-15
|
|
assets:bank
|
|
|
|
2016/1/2 spend
|
|
expenses 20 EUR @ $1.07
|
|
assets:bank
|
|
|
|
2016/1/3 spend
|
|
expenses 20 EUR @@ $21.45
|
|
assets:bank
|
|
$ hledger prices -f- --infer-market-prices
|
|
P 2016-01-01 EUR $1.06
|
|
P 2016-01-02 EUR $1.07
|
|
P 2016-01-03 EUR $1.0725
|
|
P 2016-02-01 EUR $1.05
|
|
|
|
# 3. inverted prices can be calculated
|
|
<
|
|
P 2016/1/1 EUR $1.06
|
|
P 2016/2/1 EUR $1.05
|
|
|
|
2016/1/1 paycheck
|
|
income:remuneration $-100
|
|
income:donations $-15
|
|
assets:bank
|
|
|
|
2016/1/3 spend
|
|
expenses $21.45 @@ 20.00 EUR
|
|
assets:bank
|
|
$ hledger prices -f- --infer-reverse-prices
|
|
P 2016-01-01 EUR $1.06
|
|
P 2016-01-03 EUR $1.0725
|
|
P 2016-02-01 EUR $1.05
|
|
|
|
#
|
|
<
|
|
commodity 1.000,00 A
|
|
|
|
P 2019-01-01 X A1000,123
|
|
P 2019-01-02 X A1000,1
|
|
|
|
2019-02-01
|
|
(a) X1 @ A1000,2345
|
|
2019-02-02
|
|
(a) X1 @ A1000,2
|
|
|
|
# 4. Commodity styles are applied, but precision is left unchanged.
|
|
$ hledger -f- prices
|
|
P 2019-01-01 X 1.000,123 A
|
|
P 2019-01-02 X 1.000,1 A
|
|
|
|
# 5. Commodity styles aren't yet applied to prices inferred from transaction prices.
|
|
$ hledger -f- prices --infer-market-prices
|
|
P 2019-01-01 X 1.000,123 A
|
|
P 2019-01-02 X 1.000,1 A
|
|
P 2019-02-01 X 1.000,2345 A
|
|
P 2019-02-02 X 1.000,2 A
|
|
|
|
<
|
|
;; Total asset value should be 400 USD + 1000 USD = 1400 USD
|
|
2021-10-15 Broker initial balance (equity ABC)
|
|
Assets:Broker = 4 ABC @@ 400 USD
|
|
Equity:Opening Balances
|
|
|
|
2021-10-15 Broker initial balance (USD)
|
|
Assets:Broker = 1000 USD
|
|
Equity:Opening Balances
|
|
|
|
# 6. Inferring prices should play well with balance assertions involving mixing
|
|
# of prices and no prices. (#1736)
|
|
$ hledger -f- prices --infer-market-prices
|
|
P 2021-10-15 ABC 100.0 USD
|
|
|
|
<
|
|
2021-10-15
|
|
(a) 1 A @@ 0 B
|
|
|
|
2021-10-16
|
|
(b) 0 A @@ 1 B
|
|
|
|
# 7. Gracefully ignore any postings which would result in an infinite price.
|
|
$ hledger -f- prices --infer-market-prices
|
|
P 2021-10-15 A 0.0 B
|
|
|
|
# 8. Same for reverse prices
|
|
$ hledger -f- prices --infer-reverse-prices
|
|
P 2021-10-16 B 0.0 A
|