Core Concepts
Cost Basis
How Ledger tracks the original purchase price of every asset so that realised gains and losses are calculated against a documented, auditable lot history.
Cost Basis
Cost basis is the figure that determines whether a sale produced a gain or a loss, and by how much. It captures the original cost of acquiring an asset — the price paid plus any acquisition fees — so that when the asset is later sold or swapped, Ledger can subtract the basis from the proceeds and report the difference as a realised gain or loss. The accuracy of every tax line, every performance metric, and every portfolio-level profit-and-loss number depends on the cost basis being right.
In a multi-buy, multi-sell environment — which is what most crypto portfolios become within a few months of activity — the question of which units were sold becomes important. The same asset may have been acquired at five different prices over the course of a year; a partial sale draws from one or more of those acquisitions, and the choice of which lot to draw from changes the realised gain. Ledger handles this with explicit lot tracking and a per-portfolio choice of accounting method.
Accounting methods#
Ledger supports three of the most common cost-basis methods. The choice is made at the portfolio level and applied consistently to every disposal in that portfolio, so that the realised-gain story for the year reads the same regardless of which lot was sold first chronologically.
FIFO — First In, First Out#
FIFO disposes of the oldest units first. It's the default choice in Ledger because it's the most widely accepted method for tax reporting in most jurisdictions, and because it tends to produce the most intuitive results: the gain on a sale is calculated against what you paid for the first batch you bought.
Bought 1 ETH @ $2,000 (Jan)
Bought 1 ETH @ $3,000 (Mar)
Sold 1 ETH @ $3,500 (Jun)
Realised gain = $3,500 - $2,000 = $1,500 (FIFO uses the Jan lot)LIFO — Last In, First Out#
LIFO disposes of the most recently acquired units first. In a rising market this can reduce the realised gain on a sale by drawing from a more expensive lot, but the method isn't permitted for tax purposes in every jurisdiction — check your local rules before selecting it.
HIFO — Highest In, First Out#
HIFO disposes of the highest-cost units first regardless of when they were acquired. It's used to minimise the realised gain at the time of disposal and is a common choice for tax-loss harvesting strategies.
Lot tracking#
Each acquisition creates a lot: a record of the quantity acquired, the cost per unit, the date, and a pointer back to the source transaction. When you later dispose of an asset, Ledger walks the lots in the order dictated by your chosen method and records exactly which lots were consumed. The disposal entry on the journal carries those references, so the reasoning behind every realised-gain figure is reconstructable from the data alone.
Fee treatment#
Acquisition fees — exchange fees on a buy, gas costs on a swap — add to the cost basis of the lot they're paid against. Disposal fees reduce the proceeds at the time of sale. Both effects move in the same direction for the taxpayer: they lower the net taxable gain. Ledger applies them automatically; you don't need to record fees as separate adjustments.
Unrealised P&L#
For assets you still hold, Ledger reports an unrealised profit-or-loss figure alongside the realised one. The calculation is simple: it takes the current market price of the asset, multiplies by the quantity remaining in your lots, and subtracts the weighted average cost of those lots. The number changes whenever the market moves; it becomes a realised gain or loss the moment the asset is disposed of.