On Tuesday, July 11, 2017 at 11:09:04 PM UTC-7, John Wiegley wrote:

> >>>>> "BW" == Ben Weintraub <[email protected] <javascript:>> writes: 
>
> BW> Sorry, I forgot to mention that I have, and it yields identical 
> results. 
>
> It seems to be working here. Do you have a smaller example that shows the 
> problem? 
>
>
Yes! I played around with it some more and have tracked it down to one 
particular transaction (simplified a bit for illustration purposes):

2017/05/16 Sold 85 shares of XYZ
  Assets:Brokerage                $3751.98
  Expenses:Fees                   $5.03
  Assets:Investments              -85 XYZ

Specifically, ledger seems to be sensitive to the ordering of the postings 
in this transaction. If the -85 XYZ line comes first in the transaction, 
everything works as expected. If it comes last, ledger seems to interpret 
the commodity of the first two postings weirdly.

Here's a simple example that demonstrates the issue using 'print --anon':

$ cat test1.ldg
2017/05/26  Pay for parking
  Expenses:Parking          $3.20
  Assets:Bank:Checking

2017/05/16 Sold 85 shares of XYZ
  Assets:Brokerage                $3751.98
  Expenses:Fees                   $5.03
  Assets:Investments              -85 XYZ

$ ledger -f test1.ldg print --anon
2017/05/26 d0300a19
    5b17cd1f:c9401451:d19ad95a                 A3.20
    a67a81df:a4d957ed:1f7edb51:f811a1aa

2017/05/16 2e138708
    8a9d2341:826bdd28:6026ad10              B3751.98
    7e501425:9ab5c740:492f1c86                 B5.03
    39f15929:0ee197dc:bb49663d                 -85 C

Note how the currency on the first two postings of the second transaction 
gets interpreted as 'B' rather than 'A', even though they were both 
specified in dollars in the original. Moving the -85 XYZ posting to the top 
of the transaction results in the expected output from 'print --anon':

$ ledger -f test2.ldg print --anon
2017/05/26 4e8ac033
    28360b0c:45d35e72:e2034164                 A3.20
    2bda7baa:5517137b:ec60627b:52bfcb7a

2017/05/16 cb3741f1
    92a2a47e:ecc9ba22:3d7cd0b2                 -85 B
    ab71d2c8:70688fc0:dd72b4b0              A3751.98
    700b7442:080ab12b:ebf63674                 A5.03

Cheers,
Ben

-- 

--- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to