Virtual postings and balance assertion

137 views
Skip to first unread message

Ryan Nowakowski

unread,
Feb 26, 2018, 5:43:06 PM2/26/18
to Ledger
I'm not sure how virtual postings and balance assertions are supposed to
work together. Here's my sample ledger file without virtual postings:

2018/2/25 Initial balance
Assets $100
Equity

2018/2/26 Buy something
Assets $-10
Expenses

2018/2/26 Balance assertion
Assets $0 = $90

Running: ledger -f test.dat bal
...works as expected:

$90 Assets
$-100 Equity
$10 Expenses
--------------------
0

Then the same ledger file with an additional virtual posting transaction:

2018/2/25 Initial balance
Assets $100
Equity

2018/2/26 Buy something
Assets $-10
Expenses

2018/2/26 virtual stuff
[Assets] $-10
[Expenses]

2018/2/26 Balance assertion
Assets $0 = $90


When I run: ledger -f test.dat bal

While parsing file "/tmp/test.dat", line 14:
While parsing posting:
Assets $0 = $90
^^^
Error: Balance assertion off by $10 (expected to see $80)

...which seems ok since the virtual posting should make the balance $80
instead of $90. However if I use --real I'd expect the balance
assertion to succeed: ledger -f test.dat bal --real

But it doesn't:


While parsing file "/tmp/test.dat", line 14:
While parsing posting:
Assets $0 = $90
^^^
Error: Balance assertion off by $10 (expected to see $80)

Is my expectation incorrect here? Is there any documentation on how
virtual postings and balance assertion are supposed to interact?

Thanks!

Ryan

Jostein Berntsen

unread,
Feb 26, 2018, 10:39:47 PM2/26/18
to Ledger
This works in my ledger setup with version 3.1.1, both with an without
--real. Which version are you using?


Jostein

Ryan Nowakowski

unread,
Feb 27, 2018, 10:03:13 AM2/27/18
to ledge...@googlegroups.com
I forgot to include that little unimportant bit of info :)

Ledger 3.1.2-20160801, the command-line accounting tool

Dániel Fancsali

unread,
Feb 27, 2018, 10:13:57 AM2/27/18
to ledge...@googlegroups.com
Hey,

Just a hunch, but I feel it's a bit odd that the virtual account names match the real ones. I'd double check that, maybe using ledger register to see what the rolling sum is.

Regards,
Dan

--

---
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 ledger-cli+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan Nowakowski

unread,
Jul 15, 2019, 5:48:54 PM7/15/19
to Ledger
This example from the documentation uses the same account name for both real and virtual postings:
To unsubscribe from this group and stop receiving emails from it, send an email to ledge...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages