I am quite keen on the @@ syntax, as I like to deal with commodities
on a net basis. However, there is a bit of an inconsistency between @@
and @.

Suppose I have the ledger file:

2008/01/01 * Purchase Apple shares
        Equities        1000 AAPL @ $2
        Cash

2008/06/30 * Sell some Apple shares
        Equities        -500 AAPL @ $2.5
        Cash


If I type:
   ledger -f example01.txt -jB reg Equities
I get the output:
2008-01-01 2000
2008-06-30 -1250

The above is correct. $2000 goes in as equities as an asset, and £1250
is marked as a negative, thereby reducing the equity balance.

Now. Suppose I decide I would rather use the @@ command. I would have
a ledger file:
2008/01/01 * Purchase Apple shares
    Equities    1000 AAPL @@ $2000
    Cash

2008/06/30 * Sell some Apple shares
    Equities    -500 AAPL @@ $1250
    Cash

If I type:
   ledger -f example01.txt -jB reg Equities
I now get the output:
2008-01-01 2000
2008-06-30 1250

The above is incorrect, because the +1250 has changed to -1250. It
implies the purchase of shares, rather than a sale. I can't just
change the $1250 to -$1250 in the ledger file, either, because it
complains:
Error: A posting's cost may not be negative

Reply via email to