Skip to content

Cost basis

Cost basis assigns acquisition cost to assets and sold quantities. Follow fee-inclusive lots, FIFO and specific identification to reconcile realised and unrealised gains.

Cost basis is the acquisition cost assigned to an asset or a quantity of an asset, including the acquisition costs required by the stated accounting convention. It is the reference amount subtracted from sale proceeds to measure a realised gain or loss. For a quant maintaining a trade ledger, the practical question is often which purchase cost belongs to the shares just sold, and which stays with the shares still held?
A cost basis records an acquisition history; it is not the holding's current market value. Tax reporting uses an adjusted basis, which can differ from the original purchase cost. For purchased shares, the US IRS Publication 551 generally includes purchase commissions and requires subsequent basis adjustments. Broker performance reports also specify their own matching and fee presentation, as IBKR's reporting guide illustrates.

Two purchases, one partial sale

Consider fictional ordinary shares in one currency, USD. The first acquisition is lot A; the second is lot B. Include each acquisition fee in that lot's basis and allocate it equally across its shares. There are no distributions, corporate actions, financing charges, tax adjustments or currency changes.

AcquisitionSharesPrice per share (USD)Acquisition fee (USD)Lot basis (USD)Basis per share (USD)
A, bought first10010.005.001,00510.05
B, bought later4012.004.0048412.10
Total140—9.001,489—

For lot ii, with quantity qiq_i, purchase price pip_i and allocated acquisition fee fif_i, this convention gives

Bi=qipi+fi,bi=Biqi.B_i=q_i p_i+f_i,\qquad b_i=\frac{B_i}{q_i}.
Here BiB_i is the lot's total basis in USD and bib_i is its basis in USD per share. Deduct each transaction cost once: a fee already included in basis must not be subtracted again when calculating profit.
Now sell 60 shares at USD 15, paying a USD 3 sale fee. Net proceeds are 60(15)−3=89760(15)-3=897 USD. The sale closes 60 shares under either allocation below; only the acquisition cost matched to them changes.
FIFO: match the oldest shares first. All 60 come from A. Their assigned basis is 60(10.05)=60360(10.05)=603 USD, so realised P&L is 897−603=294897-603=294 USD. The remaining holding contains 40 shares from A and 40 from B, with basis 40(10.05)+484=88640(10.05)+484=886 USD.
Specific identification: match particular lots. Suppose 40 shares from B and 20 from A are validly identified for this sale. Their assigned basis is 40(12.10)+20(10.05)=68540(12.10)+20(10.05)=685 USD, so realised P&L is 897−685=212897-685=212 USD. The remaining 80 shares are all from A, with basis 80(10.05)=80480(10.05)=804 USD. This is an allocation comparison, not a recommendation to choose a tax method; the US identification conditions are explained below.

The gain has moved between columns

Mark the remaining 80 shares at USD 15 per share. Their market value is USD 1,200 under either allocation. Unrealised P&L compares that same market value with the basis left in the holding.
Accounting allocationSold basis (USD)Realised gain (USD)Remaining basis (USD)Unrealised gain (USD)Combined gain (USD)
FIFO603294886314608
Identify 40 B + 20 A685212804396608
Fictional USD share ledger: FIFO assigns 603 of basis to the sale, realises 294 and leaves 314 unrealised. Identifying 40 shares from B and 20 from A assigns 685 of basis, realises 212 and leaves 396 unrealised. Both total 608.
Fictional USD share ledger: FIFO assigns 603 of basis to the sale, realises 294 and leaves 314 unrealised. Identifying 40 shares from B and 20 from A assigns 685 of basis, realises 212 and leaves 396 unrealised. Both total 608.
Original fictional fee-inclusive lot ledger. Both bars use the same USD scale, net proceeds of 897 and remaining market value of 1,200. No tax, income, financing or future liquidation costs are included.

The second allocation reduces realised gain by USD 82 and increases unrealised gain by exactly USD 82. It does not generate an extra economic profit. Write NN for net sale proceeds, MM for remaining market value, BsB_s for sold basis and BrB_r for remaining basis. Because the original basis is partitioned as B0=Bs+BrB_0=B_s+B_r,

Πrealised+Πunrealised=(N−Bs)+(M−Br)=N+M−B0.\Pi_{\mathrm{realised}}+\Pi_{\mathrm{unrealised}} =(N-B_s)+(M-B_r)=N+M-B_0.
In this example, 897+1,200−1,489=608897+1{,}200-1{,}489=608 USD. The identity uses the same fills, fees, mark and currency under both allocations. Tax payments or other cash flows would need their own entries. The remaining value is a mark, not guaranteed liquidation proceeds; no hypothetical future sale fee has been deducted.
The Positions, Trades, Fills and P&L lesson develops the underlying cash-and-holdings reconciliation, including partial fills and execution away from a mark. Its preview is public; the full lesson requires membership.

An average purchase figure does not identify sold shares

Before the sale, dividing total fee-inclusive basis by total shares gives 1,489/140≈10.6357141{,}489/140\approx10.635714 USD per share. This is a useful descriptive average. It does not preserve which shares were bought when or determine which basis is assigned to a partial disposal.

Nor is it the market's volume-weighted average price: that benchmark weights market trades over a specified window. An account's own acquisition history, its fees and its remaining lots answer a different question from execution quality against that benchmark.

Tax-lot rules are a separate contract

For US taxable stock lots held by a broker, IRS Publication 550, 2025 edition, says adequate identification requires specifying the particular stock to the broker at the time of sale or transfer and receiving written confirmation within a reasonable time. If shares cannot be adequately identified, basis follows the earliest acquisitions—FIFO. A later spreadsheet allocation alone does not establish compliance.

Average basis is not a universal election for ordinary shares. The publication describes eligibility for mutual-fund shares and certain dividend-reinvestment-plan shares, with additional conditions. These US rules do not establish the permitted method in another jurisdiction, account or instrument.

Finally, original purchase cost may cease to be the appropriate tax basis. Stock splits, returns of capital, wash-sale adjustments, gifts and inheritances can require different treatment, as the Form 8949 instructions explain. Currency translation also needs an explicit reporting convention. A robust quant ledger retains lot dates, quantities, actual fills, acquisition costs, disposal matches and subsequent adjustments rather than treating one displayed “average cost” as the whole accounting record.

Sources

Last updated
  • cost basis
  • tax lots
  • lot accounting
  • realised profit
  • unrealised profit
  • transaction costs
← Back to the glossaryBack to top ↑