How this calculation works
Buys add quantity and acquisition cost including fees. Sells remove the corresponding share of the moving-average book basis and recognize net proceeds less that cost. Remaining units are valued at your entered mark to separate unrealized change.
Sell book cost = remaining basis × sold units / held units; realized change = net proceeds − allocated costA worked example
Buy 2 at 100 with fee 2, then 1 at 160 with fee 1: basis is 363 for 3 units, or 121 per unit. Sell 1 at 180 with fee 1: realized change is 58, with 2 units and basis 242 remaining.
Good to know
A scenario from entered prices, quantities and assumptions. No live prices, wallet connection, trade execution, return forecast or tax determination. Decimal arithmetic is used; displayed values are rounded. Examples are arithmetic demonstrations, not market rates or recommendations. One asset and moving-average book-cost method only. Not a tax-basis, FIFO, specific-lot, exchange-reconciliation or regulatory report. No transfers, derivatives, shorting, funding or token-paid fees.
Reference: Investor.gov: how fees affect investment returns (opens in a new tab) ↗
Chronology changes which book cost remains
Buying two units at 100 with a fee of 2 creates book cost 202. Buying one more at 160 with fee 1 raises that to 363 for three units, or 121 per unit. Selling one at 180 with fee 1 then realizes 179 − 121 = 58.
Two units and book basis 242 remain. At an entered mark of 150, their value is 300 and their unrealized change is another 58. The combined scenario change is 116, but only the first 58 came from the completed sale.
A weighted average can summarize acquisition costs at one point in time. A chronological ledger must additionally allocate cost as units are sold and update the remaining position before processing later purchases.
Keep a book method distinct from a tax report
This tool uses moving-average book cost for one asset. It does not choose FIFO, specific identification or a jurisdiction’s taxable basis rules. A gain in this ledger should not be copied into a tax return without the appropriate separate treatment.
Fees are entered fiat amounts for each row. Buy fees increase remaining book cost; sell fees reduce proceeds. Token-paid fees, transfers, rewards, derivatives and short positions are outside this input model, and a sale exceeding held units is rejected.
The cash-and-position reconciliation is useful independently of any book convention: net cash received plus the marked remaining holdings should match total scenario profit after accounting for cash spent. A complete sale resets held quantity and basis to zero before a later purchase starts a new position.
A few questions, answered
Can I put the rows in any order?
No. Enter them chronologically. Selling before buying can be invalid here and can change the moving-average allocations.
Are fees percentages?
No. Each row contains a fiat fee amount in the selected common currency.
Can I import a wallet?
No. Values are entered and processed locally; there is no wallet connection or transaction retrieval.