On Monday, January 3, 2022 at 3:12:39 PM UTC-8 Martin Michlmayr wrote:
> * Muke Tever [2022-01-02 21:45]:
> > = %/inventory/
> > Equity:$account (-amount)
> > Equity:USD (market(amount))
>
> I initially thought it's a bug but after looking at it some more I
> think it's not a bug.
>
> amount and market(amount) are not the same. The amount is $5.00.
> market(amount) is 1 OBJ {$5.00} [2022-01-02].
>
Oh, I see the problem, and I guess it's a little different than I thought.
So amount and market(amount) doesn't 'balance' to zero, but they do
'balance' in the sense that ledger doesn't complain about it being
unbalanced, if they exist as a regular transaction:
2022/01/02 Interest
Assets:OBJ 1 OBJ {$5.00} [2022/01/02]
Income:OBJs $-5.00
1 OBJ {$5.00} [2022/01/02] Assets:OBJ
$-5.00 Income:OBJs
--------------------
$-5.00
1 OBJ {$5.00} [2022/01/02]
So the interesting thing is that it complains when it's an automated
transaction, even when it both would balance as a normal transaction and
would balance the original transaction to zero.
= %/inventory/
Equity:$account -1 OBJ {$5.00} [2022/01/02]
Equity:USD $5.00
2022/01/02 Interest
Assets:OBJ 1 OBJ {$5.00} [2022/01/02] ;
:inventory:
Income:OBJs $-5.00
While parsing file "/Users/[...]/Documents/2022/Ledger/testfile.ledger",
line 7:
While balancing transaction from
"/Users/[...]/Documents/2022/Ledger/testfile.ledger", lines 5-7:
> 2022/01/02 Interest
> Assets:OBJ 1 OBJ {$5.00} [2022/01/02]
; :inventory:
> Income:OBJs $-5.00
Unbalanced remainder is:
$5.00
-1 OBJ {$5.00} [2022/01/02]
Amount to balance against:
$10.00
While applying automated transaction from
"/Users/[...]/Documents/2022/Ledger/testfile.ledger", lines 1-3:
> = %/inventory/
> Equity:$account -1 OBJ {$5.00} [2022/01/02]
> Equity:USD $5.00
While extending transaction from
"/Users/[...]/Documents/2022/Ledger/testfile.ledger", lines 5-7:
> 2022/01/02 Interest
> Assets:OBJ 1 OBJ {$5.00} [2022/01/02]
; :inventory:
> Income:OBJs $-5.00
Error: Transaction does not balance
So I think you need to use either:
>
> = %/inventory/
> Equity:$account (-amount)
> Equity:USD (amount)
>
> or:
>
> = %/inventory/
> Equity:$account (market(-amount))
> Equity:USD (market(amount))
>
> You can run this command to see the difference:
> ledger -f d bal --lots equity
>
Indeed these do not throw errors, but they don't get me balanced to zero as
I'm intending.
Thank you for your time and response.
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ledger-cli/ff9aebef-b91b-4bde-ad42-0152f2772844n%40googlegroups.com.