Did not get the correct result, bal -e

28 views
Skip to first unread message

老革命

unread,
Feb 3, 2021, 11:16:08 AMFeb 3
to Ledger
With the following records, 
I want to get the balance of "Stock" on 01/02
with -X $
Should be $10.00
----------
2021-01-01 * Opening Balance
    Assets:Broker:Cash                        $10.00
    Equity:Opening Balances

2021/01/01 * Stock purchase
    Assets:Broker:Stock                            1 AA @ $1.00
    Assets:Broker:Cash

2021/01/02 * Stock purchase
    Assets:Broker:Stock                            1 AA @ $5.00
    Assets:Broker:Cash

2021/01/03 * Stock purchase
    Assets:Broker:Stock                           -1 AA @ $2.00
    Assets:Broker:Cash

2021/01/04 * Stock purchase
    Assets:Broker:Stock                           -1 AA @ $3.00
    Assets:Broker:Cash

----------

bal Stock -X $ -e 01/03
The result is $4.00
Not the expected result $10.00


-e Limit the processing to transactions before 01/03,is 01/02
but price on 01/03

How to get the correct result?



Martin Michlmayr

unread,
Feb 3, 2021, 8:20:46 PMFeb 3
to ledge...@googlegroups.com
* 老革命 <laog...@gmail.com> [2021-02-03 00:05]:
> bal Stock -X $ -e 01/03
> The result is $4.00
> Not the expected result $10.00
>
> -e Limit the processing to transactions before 01/03,is 01/02
> but price on 01/03

You need:
-e 2021/01/03 --now 2021/01/02

--end/-e only limits when transactions end, but pricedb entries from
later transactions are still evaluated and you need --now to value
at that day rather than now.

--
Martin Michlmayr
https://www.cyrius.com/

老革命

unread,
Feb 3, 2021, 8:41:21 PMFeb 3
to Ledger
very good!  thanks
Reply all
Reply to author
Forward
0 new messages