* Peter Ross <[email protected]> [2011-09-30 17:41]:
> 1/1 Buy 2 shares of ACME @ $100
> 2/2 Buy 1 share of ACME @ $200
> 
> Now on the 3/3 I wish to sell 2 shares of ACME @ $150.  I can either
> sell 1 share bought on 1/1 and another on the 2/2 for $0 capital gain,
> or I can sell both 1/1 shares for a $100 capital gain.

The correct way to do this is:

D $100.00

2011-09-01 * Buy 2 shares of ACME @ $100
    Assets:Broker                                  2 ACME @ $100.00
    Assets:Cash

2011-09-10 * Buy 1 share of ACME @ $200
    Assets:Broker                                  1 ACME @ $200.00
    Assets:Cash

2011-09-20 * Sell 2 shares of ACME at $150
    Assets:Broker                       -1 ACME {$100.00} @ $150.00
    Assets:Broker                       -1 ACME {$200.00} @ $150.00
    Assets:Cash

Note that the automatic Equity entries generated by ledger are
imho wrong (as discussed on this list a few months ago).  I must open
a bug report about this.

> I want to record the decision I made so that I can determine at a
> late date how many shares at the various price levels I own.

You'll be interested in the bal --lot-prices option.  For example,
after buying the 2 shares at $100 and 1 at $200 it would show you:

$ ledger -f a.ledger bal --lot-prices Assets:Broker
    2 ACME {$100.00}
    1 ACME {$200.00}  Assets:Broker

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

Reply via email to