Crypto Backtesting Costs: Fees, Spread, Slippage, and Funding
A strategy trades gross signals but keeps net money. Fees are only one part of the difference: the bid-ask spread, execution delay, adverse slippage, market impact, and futures funding can each erase a small historical edge.
Separate every cost component
Do not hide friction inside one unexplained percentage. Trading fees depend on venue, product, account tier, and whether the order adds or removes liquidity. Spread exists before the order is submitted. Slippage measures the difference between the reference and execution price. Funding applies to eligible perpetual positions at settlement times.
Assign each component a reference point so costs are not counted twice. If the reference price is a candle mid or last trade, the spread may need to be added before slippage; if the model already uses executable bid and ask, charging the full spread again duplicates friction. Price impact is also not a second label for slippage: it describes how the strategy's own size consumes available depth and can vary nonlinearly. Document the chosen reference, order side, order intent, assumed depth, and conversion currency for every component.
Build the model from fills upward. For each simulated execution retain timestamp, side, quantity, reference price, adjusted fill price, notional, maker or taker classification, fee rate, fee amount, and applicable funding events. Aggregate those rows into a trade and portfolio only after the components reconcile. This approach exposes grid additions, partial closes, reversals, and fee currency conversions that a trade-level percentage would miss. It also makes the backtest comparable with Paper and sandbox logs later.
| Component | When it appears | How to model it |
|---|---|---|
| Trading fee | On each fill | Notional multiplied by the applicable maker or taker rate |
| Spread | When crossing bid and ask | Use executable bid for sells and ask for buys |
| Slippage | Between reference and fill | Apply an adverse basis-point adjustment |
| Price impact | When size consumes depth | Increase cost with size and liquidity |
| Funding | At perpetual settlements | Apply signed historical rates to open notional |
Count entry, additions, and exit separately
A position with one entry and one exit pays at least two execution events. Grid or DCA strategies may pay fees and spread on every addition, partial close, and final close. Turnover often matters more than the advertised rate, so calculate cost from the actual simulated fills rather than from trade count alone.
Reconcile costs at three levels. The sum of fill fees and execution adjustments should equal the cost of each completed trade; the trade totals should equal the portfolio report; and the difference between gross and net performance should be explainable by fees, spread or slippage, funding, and any other named component. Investigate rounding and conversion differences instead of placing them in an unexplained residual. A cost model that cannot reconcile is not ready for sensitivity analysis.
fee total = sum(fill notional × fill fee rate)Use each execution, not only the opening position size. If fee assets or discounts differ, normalize them to the report currency with a documented conversion assumption.
Model spread and slippage in the adverse direction
A buy normally executes no better than the available ask and a sell no better than the bid unless a resting limit order receives a fill. Market orders can be protected or converted by an exchange, but that does not guarantee the reference price. Fast markets, thin books, and larger notional increase uncertainty.[3]
adverse buy price = reference price × (1 + slippage bps / 10,000)For a sell, subtract the adjustment. Run several scenarios instead of claiming one fixed basis-point value represents every symbol, size, and volatility regime.
Add futures-specific carrying and failure costs
Perpetual funding can be received or paid while a position remains open. Leverage changes margin usage and makes adverse moves more dangerous; it does not reduce fee notional. A futures test should show signed funding separately and model a liquidation boundary rather than allowing equity to pass through impossible states.
Stress costs until the decision changes
Calculate a base case and at least two less favorable cases. Raise fee assumptions, widen slippage, and delay execution. The objective is not to predict the exact fill but to learn how much friction the strategy can absorb before net PnL, drawdown, or risk-adjusted performance becomes unacceptable.[1][2]
Express sensitivity as a break-even budget, not only three finished reports. Divide the remaining net edge by turnover or fill count to estimate how many additional basis points per execution would erase it, then verify the approximation with a rerun. Compare that budget with observed Paper and sandbox deviations by symbol and volatility regime. A strategy whose entire edge is smaller than ordinary variation in spread and fill quality should be rejected or redesigned, even when the base-case curve is attractive.
| Scenario | Fees | Slippage | Decision |
|---|---|---|---|
| Base | Expected account tier | 5 bps per market fill | Record, do not approve yet |
| Conservative | Next worse tier | 10 bps | Must remain within risk gate |
| Stress | Taker on every fill | 20 bps | Identify the break-even boundary |
Audit the friction in one result
Use an existing trade journal and reconstruct net PnL from its executions.
- List every fill and calculate notional, fee rate, and fee amount independently.
- Estimate spread and adverse slippage for entry, additions, and exit.
- Add signed funding for every settlement crossed by a futures position.
- Repeat with conservative assumptions and record where the decision changes.
Cost-model checklist
A credible net result should answer each of these questions.
- Maker and taker assumptions match the actual simulated order behavior.
- Every fill, including grid additions and partial exits, contributes cost.
- Spread, slippage, and price impact are not treated as identical concepts.
- Funding is signed, time-aware, and separated from trading PnL.
- The strategy survives a documented less-favorable cost scenario.
Why a cost model remains an estimate
Historical candles do not reveal future queue position or full order-book response to your size. Fee schedules, account tiers, rebates, funding, liquidity, and symbol rules can change. Stress testing provides a boundary for the decision; it cannot promise a future execution price or eliminate market impact.
Sources and further reading
Product behavior is checked against SteadyEdge documentation and code; changing exchange and platform details link to current official sources.
Find the strategy's friction budget
Open a report with fees and funding visible, then calculate the maximum additional slippage the strategy can absorb before it violates the acceptance gate.