How to Include Fees and Slippage in a Crypto Bot Backtest

CryptoRebateHub Editorial Team

Build a basis-point cost model with two-sided fees, spread, slippage, latency, partial fills, funding, failures, and conservative rebates.

A realistic bot backtest needs two-sided fees, spread, slippage, latency, partial fills, holding costs, failures, and only verified rebates. Put every component in basis points and run multiple scenarios.

Net-return equation

Use net bps = gross bps - entry fee - exit fee - spread - entry slippage - exit slippage - funding/borrow - failure cost + realized rebate. A single currency amount is hard to compare across position sizes; bps keeps the model portable.

Do not fill at the signal candle close

If a signal is known only after a candle closes, filling at the same close assumes impossible timing. Use the next executable event, the contemporaneous best bid or ask, price after measured latency, available depth, and a defined cancel, chase, or abandon rule.

Maker probability and partial fills

Do not mark every limit order as maker. A simple model is expected fee = maker probability × maker rate + taker probability × taker rate. A better model replays order-book events and estimates queue position. Preserve unfilled quantity instead of pretending the whole order filled.

Slippage and failure regimes

Segment slippage by pair liquidity, order size relative to depth, volatility, time of day, and news or liquidation events. Keep API timeouts, post-only cancellations, precision rejects, stale data, and risk blocks in the sample. Deleting them creates survivor bias.

Three scenarios and rebate treatment

Run optimistic, base, and stress cases. The base should use measured maker/taker mix, P75 slippage, and median latency. Stress can use taker-heavy fees, P90/P95 slippage, high latency, and zero rebate. Compare the output with position-size tool.

FAQ

Can I use a fixed one-bps slippage assumption?

Only as a rough placeholder. Slippage should vary with liquidity, size, and volatility.

Should failed orders be removed?

No. They are part of execution quality and can create direct or opportunity costs.

Can the full advertised rebate be included?

Use only stable, settled history in the base case and set it to zero in stress.

Bottom line

The goal of a backtest is not the prettiest curve. It is an estimate of what remains after production friction.