Hello,

Is the following behavior a bug?

Given the leger file at /tmp/foo.ledger containing exactly

--
2022-01-01 * Buy FOO
    Assets:Brokerage                              10 FOO @ $1.00
    Assets:Cash                              $-10.00

P 2022-01-02 23:59:00 FOO  $2.00

2022-01-03 * Buy more FOO
    Assets:Brokerage                             2.5 FOO @ $4.00
    Income:Cash                              $-10.00
--

and these environment settings

--
$ export LEDGER_FILE=/tmp/foo.ledger
$ export LEDGER_PAGER=cat
--

I find that a balance report with an --end option produces these
outputs, varying only whether the --market option is used:

--
$ ledger --end 2022-01-03 bal --balance-format '%A\t%t\n' /Brokerage/
Assets:Brokerage          10.0 FOO
$ ledger --market --end 2022-01-03 bal --balance-format '%A\t%t\n' /Brokerage/
Assets:Brokerage        $40.00
--

The first invocation ignores the 2.5 FOO from the posting on 2022-01-03,
but the second seems to use the price in that posting. That is, the
--end date appears to act as an upper exclusive bound for the purpose of
summing postings, but seemingly not as an exclusive bound for price db
lookup involved in calculating market value.

[If this somehow isn't a bug, it looks like one workaround is to use (@)
and (@@) instead of @ or @@ in postings. That's good enough for my
needs, I think.]

In case it matters, I'm using this version of Ledger:

--
$ ledger --version
Ledger 3.2.1-20200518, the command-line accounting tool

Copyright (c) 2003-2019, John Wiegley.  All rights reserved.

This program is made available under the terms of the BSD Public License.
See LICENSE file included with the distribution for details and disclaimer.
--

Thanks,
Richard

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/10025.1642081728%40vps0.progn.net.

Reply via email to