P 2022-01-01 A 3C
2022-01-01
(a) 1A @ 2B
comment
$ hledger bal -N
1A a
$ hledger bal -N -B
2B a
$ hledger bal -N -V
3C a
2022-01-01 price AAA 3 CCC
2022-01-01 open Assets:Aaa
2022-01-01 open Equity:Eee
2022-01-01 * ""
Assets:Aaa 1 AAA {2 BBB}
Equity:Eee
; Report cost:
;
; $ bean-report a.beancount bal -c
; Assets:Aaa 2 BBB
; Equity:Eee -2 BBB
; Expenses
; Income
; Liabilities
;
; Report value:
;
; $ bean-report a.beancount holdings
; Account Units Currency Cost Currency Average Cost Price Book Value Market Value
; ---------- ----- -------- ------------- ------------ ----- ---------- ------------
; Assets:Aaa 1.00 AAA BBB 2.00 2.00
; ---------- ----- -------- ------------- ------------ ----- ---------- ------------
Looking more closely I see that you are doing something ‘unusual’ perhaps this is your point but you are purchasing ‘AAA’ using currency BBB but you’ve priced it in ‘CCC’.
If you use implicit prices (which is another plugin) bean count will auto generate a price from the purchase transaction that makes things work as you might expect.
plugin "beancount.plugins.auto"
2022-01-01 price AAA 3 CCC
;2022-01-01 open Assets:Aaa AAA
;2022-01-01 open Equity:Eee ; no comoddity - can hold anything
2022-01-01 * ""
Assets:Aaa 1 AAA {2 BBB}
Equity:Eee
bean-report /tmp/t2.bean holdings
Account Units Currency Cost Currency Average Cost Price Book Value Market Value
---------- ----- -------- ------------- ------------ ----- ---------- ------------
Assets:Aaa 1.00 AAA BBB 2.00 2.00 2.00 2.00
---------- ----- -------- ------------- ------------ ----- ---------- ------------
bean-report /tmp/t2.bean print
has to say about it.)2022-01-01 open Assets:Aaa
2022-01-01 open Equity:Eee
2022-01-01 price AAA 3 CCC
2022-01-01 *
Assets:Aaa 1 AAA {2 BBB, 2022-01-01}
Equity:Eee -2 BBB
2022-01-01 price AAA 2 BBB
__implicit_prices__: "from_cost"