How to Calculate Crypto P&L by Trade Type
Last updated: November 10, 2026
Key Takeaways
- You calculate spot trade P&L by subtracting your total cost from your total proceeds, then subtracting trading fees.
- A crypto swap usually means you disposed of one asset and acquired another in the same transaction, so you calculate two sides, not one.
- Perpetual futures and margin trading change P&L because you are no longer just comparing buy and sell prices; you are also tracking leverage, borrowing costs, funding, and liquidation thresholds.
- You calculate short P&L by reversing the direction of the price movement: you profit when the asset falls and lose when it rises.
How to calculate crypto profit and loss by trade type depends on the trade type, not just the coin price change. A spot buy, a swap, a perpetual futures position, a margin trade, and a short position all use different inputs, and the wrong formula can make a winning trade look like a loss or the reverse.
This article is informational, not financial advice. A qualified adviser should be consulted for your own situation, especially because tax rules, reporting rules, and exchange records differ by country and change often.
Who this applies to, and what I’m assuming you already know
This applies to a trader who wants to calculate crypto profit and loss from a specific transaction, not to choose an exchange, file a tax return, or estimate portfolio performance over a year. I’m assuming you already know the asset you traded, the entry and exit prices, the quantity, and whether the trade was spot, a swap, a perpetual futures contract, margin, or a short. I’m also assuming you can read your exchange history well enough to find fees, funding charges, and liquidation or borrowing costs if they exist.
This is not the right approach if you only have a wallet transfer, a chain bridge, or a deposit with no true trade. Those are not the same as a trade, and forcing them into a P&L formula usually creates garbage numbers. It is also the wrong tool if your goal is tax treatment by jurisdiction; that depends on local rules, and you should consult a qualified tax professional because the same 1 BTC movement can be treated very differently. See the IRS digital assets page and HMRC’s cryptoasset guidance for examples of how jurisdiction-specific the rules can be.
The subject here is trade type P&L calculation, and that means matching the formula to the exact transaction structure. A spot trade usually uses simple realized gain or loss. A derivatives trade may include notional value, leverage, mark price, funding, and offsetting legs. A swap may involve two assets leaving and entering at the same time. A short position reverses the direction of profit.
For a broader framework, the hub on how to calculate crypto profit and loss sits above this page and gives the general vocabulary. This page is the one to keep open when you need the trade-specific math.
How do I calculate crypto P&L for a spot trade?
You calculate crypto P&L for a spot trade by subtracting your total cost from your total proceeds, then subtracting trading fees. For a plain buy-and-sell, the structure is simple: cost basis = amount paid for the coin plus fees; proceeds = amount received when you sold, minus fees. Realized P&L = proceeds – cost basis.
Here is the step-by-step method I would use for a single spot trade:
- Record the buy quantity in the coin’s native units. Write down the exact amount, such as 0.25 ETH or 1,200 DOGE, not the dollar value. Verify the quantity from the trade fill, not the wallet balance. If the amount is rounded or partial, your P&L will drift.
- Record the buy price per unit and the quote currency. Use the execution price, such as 2,500 USDT per ETH, not the chart price. Verify whether the platform shows an average fill price across multiple fills. If you use the wrong price source, the gain can be overstated or understated.
- Add acquisition fees to the cost basis. Include trading commission, spread if separately charged, and any direct fee taken in quote currency. Verify whether the fee was charged in the base asset or quote asset. A fee paid in the coin itself reduces the quantity received and can change cost basis.
- Record the sell quantity and sell price. Match the sale quantity exactly to the units you are disposing of. Verify that the sale is a complete or partial close, because partial sales need allocation rules. A mismatch here means you are not calculating the same asset lot.
- Subtract disposal fees from proceeds. If the exchange charged 12 USDT to sell, that 12 reduces proceeds. Verify whether the fee was netted from the sale or billed separately. If you ignore it, the profit is too high.
- Compute realized P&L for that lot. Use the formula: sale proceeds minus total cost basis. A positive result is a gain; a negative result is a loss. Verify the sign before you copy it into a spreadsheet. Reversing the sign is one of the most common errors.
- Allocate lots if you bought the same coin more than once. Use the accounting method that applies to your records, such as FIFO, specific identification, or another method required in your jurisdiction. Verify that the method is consistent across all sales. Mixing methods on the same asset creates inconsistent results.
- Convert to your reporting currency only after the trade math is correct. If you report in USD but traded in USDT or EUR, convert each leg at the correct date and time if that is required in your records. Verify the exchange rate source. A bad conversion rate can make a clean crypto calculation look wrong.
A simple example helps: if you buy 2 SOL for 100 USDT and pay 1 USDT in fees, your total cost basis is 101 USDT. If you later sell those 2 SOL for 130 USDT and pay 1 USDT in fees, your proceeds are 129 USDT. Your realized P&L is 28 USDT.
The main limitation is obvious: spot P&L is only simple when the trade is simple. If you used two fills, partial fills, rebates, or a fee token discount, the arithmetic still works, but the bookkeeping gets less forgiving.
How do crypto swaps change the calculation?
A crypto swap usually means you disposed of one asset and acquired another in the same transaction, so you calculate two sides, not one. That is the part many generic guides miss. The swap has an embedded sale of the outgoing coin and an acquisition of the incoming coin, each with its own value at the time of exchange.
For example, if you swap 0.5 ETH for 1,500 USDC, the outgoing ETH side is the one that creates gain or loss. You compare the fair market value received for that ETH, minus any swap fee, against the ETH cost basis you originally carried. The USDC side becomes the new cost basis for the asset you received.
The procedure is:
- Identify the exact timestamp of the swap, because value can move fast over a 5-minute window.
- Determine the fair market value of the asset you gave up at that timestamp.
- Subtract the cost basis of the asset given up to get the realized gain or loss on the disposed leg.
- Use the value of the asset received, net of swap fees, as the new basis for the incoming asset.
- Keep both legs in the same reporting currency, if possible, so the arithmetic is auditable.
Treating a swap as a non-event is usually a mistake for recordkeeping, because the asset changed hands and a value was realized at the moment of exchange. A second mistake is assuming the whole transaction is one line item. It is usually two. If you are unsure how your exchange reports it, consult a qualified tax or accounting professional and compare the trade ticket to the exchange’s own records.
This matters most with meme coin trades, where slippage and spread can be large relative to the position size. On a 2-minute move in a thin market, the price shown before submission may not match the executed swap price. If the execution was poor, the P&L reflects that reality, not the headline chart.
What changes with perpetual futures and margin trading?
Perpetual futures and margin trading change P&L because you are no longer just comparing buy and sell prices; you are also tracking leverage, borrowing costs, funding, and liquidation thresholds. A perpetual futures contract has no expiry date, so unrealized P&L can change every second with the mark price, which is the exchange’s reference price for position valuation.
For a perp position, the core trade P&L is usually:
- Long position: exit value minus entry value, adjusted for fees and funding.
- Short position: entry value minus exit value, adjusted for fees and funding.
Margin trading adds borrowed funds to the picture. Your trade may show a profit on price movement while still producing a smaller net result after interest, borrowing fees, and trading commissions. That is why margin P&L and spot P&L are not interchangeable.
The clean way to calculate it is:
- Record the contract size or borrowed notional, not just the coin quantity.
- Record the entry price and the exit or mark price.
- Multiply price change by the position size and contract multiplier, if the market uses one.
- Subtract opening and closing fees.
- Subtract funding payments on perpetuals, if any.
- Subtract borrowing or interest charges on margin trades.
- Check whether the position was reduced, flipped, or closed by liquidation.
Because liquidation can happen automatically, your realized P&L is not the same as the unrealized P&L you saw before liquidation. Liquidation penalties, insurance fees, or closing charges can make the final result materially worse. That is one reason this page is not for readers who only want a rough “up or down” guess.
The standard approach also stops working cleanly if you crossed multiple funding intervals on a perp or held a margin position across several days. In that case, the time dimension matters as much as the trade price.
How do you calculate P&L on a short position?
You calculate P&L on a short position by reversing the direction of the price movement: you profit when the asset falls and lose when it rises. In the simplest form, short P&L = entry price – exit price, multiplied by the quantity, then adjusted for fees and borrow costs.
That reversal is the key idea. A long position wants price up. A short position wants price down. If you keep the long formula and just plug in the numbers, you will get the wrong answer half the time.
A short calculation should include:
- The opening sale price, which creates the short exposure.
- The closing buyback price, which removes it.
- The quantity shorted.
- Borrow fees or margin interest, if the asset was borrowed.
- Exchange fees on both legs.
Suppose a trader shorts 10 units at 40 USDT and buys them back at 32 USDT. The gross trade gain is 80 USDT before fees. If the exchange charged fees on both sides, those fees reduce the result. If borrowing was involved for 3 days, that cost also reduces the result. The same principle applies whether the short is done through a spot borrow, a margin account, or a derivative.
This section is one of the places where people confuse realized and unrealized P&L. Realized P&L appears only when the short is closed or partially closed. Until then, the trade may show an unrealized gain or loss that can reverse before settlement.
The short formula is not for someone who cannot confirm the close-out price. If the position was bought back in several fills, the weighted average exit price matters. If the position was liquidated, the liquidation price and any penalty matter more than the price you hoped to close at.
What should I check before I trust the number?
You should check the trade structure, the fee treatment, the lot method, and the reporting currency before you trust any crypto P&L number. Most bad numbers come from one of those four places, not from the subtraction itself.
A good pre-check list is:
- Trade type: spot, swap, perp, margin, or short.
- Fee currency: quote asset, base asset, or a third token.
- Lot allocation: FIFO, specific identification, or another jurisdictional method.
- Price source: execution price, average fill price, or mark price.
- Currency conversion: the reporting currency and the exact conversion date/time.
- Missing charges: funding, borrow interest, liquidation penalty, maker/taker fee tier, or spread.
Each one changes the result in a way that simple calculators often miss. If a spreadsheet gives you a clean number but ignores one of those items, that number is tidy, not necessarily correct. That distinction matters in money work.
A practical rule is to keep one row per trade leg and one column for each adjustment. If a trade has more than 8 columns, the format is not the problem; the trade is. At that point, a record review by a qualified adviser or tax professional may be the better move, especially if you are dealing with multi-exchange history, chain swaps, or leveraged positions.
What are the most common mistakes?
The most common mistakes are using the wrong trade type formula, ignoring fees, mixing up realized and unrealized P&L, and collapsing multiple fills into one bad average. Each one can distort the number enough to mislead your records.
-
Using a spot formula for a derivative trade.
Consequence: you miss funding, leverage, and contract mechanics.
Correct alternative: use the contract’s P&L convention and include all carry costs. -
Ignoring fees because they look small.
Consequence: small trades become visibly wrong, especially on meme coins or frequent scalps.
Correct alternative: include every execution fee and any borrow or funding charge. -
Treating a swap as a non-event.
Consequence: the outgoing asset’s gain or loss is missed entirely.
Correct alternative: split the swap into disposal and acquisition legs. -
Using chart price instead of fill price.
Consequence: the result reflects the market fantasy, not the executed trade.
Correct alternative: use the execution record and, if needed, the weighted average fill. -
Forgetting that a short reverses direction.
Consequence: gains become losses on paper and vice versa.
Correct alternative: calculate short P&L as entry minus exit, not exit minus entry. -
Mixing currencies without a conversion rule.
Consequence: the same trade can produce different numbers in different spreadsheets.
Correct alternative: convert every leg using one consistent reporting method.
These errors are easy to make because the trade tickets often hide the detail in small print. A line that looks simple in the interface can still contain multiple legs, fees, or valuation dates. See the IRS digital assets guidance, HMRC cryptoasset records guidance, and CFTC educational material on derivatives for the kind of detail that often sits behind a single trade line.
Drafted with AI; not yet reviewed by a person.