Accounting

FIFO lots and cost basis through partial sells and splits

Cost basis is easy until you sell part of a position. Tracking each purchase as a lot is what keeps realised profit, remaining cost and unrealised profit consistent.

Why lots matter

If you hold one “average cost” number per security, you can report a position but you cannot answer which shares were sold, what they cost, or what the remaining shares cost. A lot is a single purchase with its own date, quantity and unit cost. With FIFO (first in, first out), a sell consumes the oldest lots first.

A worked example

Buy 100 shares at 10 in January, then 100 shares at 12 in February. Later, sell 150 shares at 15.

StepDetailAmount
Lot 1100 × 101,000
Lot 2100 × 121,200
Sell 150 at 15Proceeds2,250
Cost consumed (FIFO)100 from lot 1 (1,000) + 50 from lot 2 (600)1,600
Realised profit2,250 − 1,600650
Remaining position50 shares from lot 2 at 12cost 600

The key point: after the sell, the remaining cost is 600, not the original 2,200. If a system keeps showing 2,200 it will overstate cost, understate unrealised profit and make every return figure that depends on it unreliable. Remaining cost must fall in proportion to the quantity sold from each lot.

Splits and dividends

  • Stock split: a 2-for-1 split on the 50 remaining shares gives 100 shares. Total cost stays 600, so unit cost halves from 12 to 6. Cost does not change; quantity and unit cost do.
  • Cash dividend: it is income, not a change in cost basis. It should be recorded as a transaction and included in total return.
  • Back-dated trades: inserting a purchase in the past changes which lots a later sell consumes, so lots must be replayable from events rather than stored as overwritten balances.
Design principle. Build positions from events (buy, sell, split, dividend) and derive quantity, cost and realised profit from them. That makes any date reproducible and any number explainable.

Checks worth running

  • Sum of lot quantities equals the position quantity for every security.
  • Remaining cost equals the sum of remaining quantity × unit cost per lot.
  • Realised profit plus remaining cost reconciles to total purchase cost.
  • Cost basis is unchanged by a split.

CapLens runs checks of this kind automatically as part of its 400+ integrity checks. See governance and auditability and the portfolio and lots tour.

Book a live demo