Automatic transactions and elided amounts

24 views
Skip to first unread message

John Lee

unread,
Oct 15, 2021, 6:57:05 PM10/15/21
to ledge...@googlegroups.com
I seem to be having trouble with automatic transactions involving elided amounts. Possibly the problem is my understanding how this is supposed to work of course.

I see in the manual that "One thing you cannot do ... is elide amounts in an automated transaction" -- but the Huququ'llah example does use elided amounts in the explicitly written transactions that the automated transactions match on. So it seems this restriction is intended to apply only to the automatic transactions themselves, not to the explicitly written transactions that trigger the automatic ones?

Here's a file test.ledger to demonstrate:

= expr ( commodity == 'VIFSX' )
(Allocation:Equities:Domestic) 1.000

2015-01-01 * Buy VIFSX
Assets:Broker 100 VIFSX
Assets:Cash $-1000

2015-01-02 * Adjustment
Assets:Broker 10 VIFSX
Equity:Adjustments


Problems:

1. This prints 110 VIFSX as I expected:

ledger -f test.ledger b Assets:Broker

However this prints 100 VIFSX:

ledger -f test.ledger b Allocation

Why don't they both print 110 VIFSX?


2. If I change that file to remove the explicit Assets:Cash dollar amount $-1000 (so the elided value gets filled in by ledger as a VIFSX commodity amount), this prints nothing:

ledger -f test.ledger b Allocation

Why doesn't it print 110 VIFSX? It seems again to be related to the elided amount -- if I add "-10 VIFSX" explicitly to the second transaction, it does print 110 VIFSX.


I assume the answer in mechanical terms is along the lines of "elided amounts aren't compatible with automated transactions" -- but I don't understand why this restriction applies to explicitly written transactions as opposed to the automated transactions themselves, why this passes without any warning, and as I say the Huququ'llah example in the manual doesn't seem to follow this restriction?


Thanks!

John Lee

unread,
Oct 15, 2021, 7:10:54 PM10/15/21
to ledge...@googlegroups.com
On Fri, 15 Oct 2021, at 23:57, John Lee wrote:
> 2015-01-01 * Buy VIFSX
> Assets:Broker 100 VIFSX
> Assets:Cash $-1000
>
> 2015-01-02 * Adjustment
> Assets:Broker 10 VIFSX
> Equity:Adjustments
>
>
> Problems:
>
> 1. This prints 110 VIFSX as I expected:
>
> ledger -f test.ledger b Assets:Broker
>
> However this prints 100 VIFSX:
>
> ledger -f test.ledger b Allocation
>
> Why don't they both print 110 VIFSX?
>
>
> 2. If I change that file to remove the explicit Assets:Cash dollar
> amount $-1000 (so the elided value gets filled in by ledger as a VIFSX
> commodity amount), this prints nothing:
>
> ledger -f test.ledger b Allocation
>
> Why doesn't it print 110 VIFSX? It seems again to be related to the
> elided amount -- if I add "-10 VIFSX" explicitly to the second
> transaction, it does print 110 VIFSX.

Sorry, I intended to tack on that last sentence above in the context of problem 1, not problem 2.
Reply all
Reply to author
Forward
0 new messages