1

I could not find the detailed information about lot tracking in ledger and would appreciate if someone took the time to make it explicit.

If I have two purchase transactions for a fund, at 100 units each, and then I sell 150 in a single transaction, how would the ledger entries look like?

In this simplified example I'd like to learn the basics of lot tracking, which would then apply to more complex scenarios.

Having an automatic FIFO principle applied would help. If not, I'm wondering how to identify which lots are to be sold when there are dozens of transactions in the account.

Thanks!

Simon Michael
  • 366
  • 1
  • 10
Alen Siljak
  • 187
  • 12

2 Answers2

3

I believe the Ledger manual's 4.5.2 Buying and Selling Stock has the answer: you can specify the exact lot you mean to sell by writing its purchase price and/or date. If using both, I think it would be like this:

2005/08/01 Stock sale
    Assets:Broker                    -50 AAPL {$30.00} [2004/05/01] @ $50.00
    Expenses:Broker:Commissions        $19.95
    Income:Capital Gains           $-1,000.00
    Assets:Broker                   $2,480.05
Simon Michael
  • 366
  • 1
  • 10
0

In the US, you can designate to your broker which shares are to be sold. If the lots are not designated at the time of sale, the basis of the stock sold is FIFO. For mutual funds and certain DRIPS, and average cost per share can be used to determine gain P&L but you can't flip flop back and forth once averaging is chosen.

In your example, there are two purchases of 100 shares each and a sale of 200 shares. There is no designation since all shares are being sold in one transaction, FIFO applies. This doesn't change if there are dozens of trades in the account (buy multiple lots and then sell all at once) and then repeat the same sequence again.

When there are dozens of transactions in the account and one is scaling a position up and down (+100, +100, + 300, -400, etc.) then designation must occur at the time of sale. In this example, with designation, the 100 shares not sold could be from any of the 3 purchases. You cannot mix and match these, after the fact. If no designation had been made, 100 shares of the third purchase would be owned after the sale of 400 shares (FIFO).

Bob Baerker
  • 77,328
  • 15
  • 101
  • 175