How should a crypto trading bot be backtested?

A credible backtest prevents future data from leaking into past decisions, uses executable prices, includes fees, slippage, latency and funding, and evaluates out-of-sample periods. Profit alone is insufficient; inspect drawdown, trade count, regime dependence and sensitivity to parameters.

Transparent formula

Net strategy return = gross trade PnL − fees − slippage − funding − execution failures

Worked example

A strategy showing 8 bps gross edge per trade but paying 5 bps round-trip fees and 2 bps slippage has only 1 bp before funding and errors. Small assumptions can erase the apparent edge.

Use this sequence

  1. Lock the signal definition before testing.
  2. Use time-ordered train and test periods.
  3. Model all execution costs.
  4. Paper trade before live deployment.

Common mistakes

  • Optimizing hundreds of parameters on one sample.
  • Using closing price for an unavailable fill.
  • Ignoring exchange outages and rate limits.

Verify next

Frequently asked questions

What is look-ahead bias?

It occurs when a historical decision uses information that was not available at that time.

How much out-of-sample data is enough?

Enough to include multiple market conditions and a meaningful number of trades; there is no universal minimum.

When should a bot go live?

Only after stable paper results, operational monitoring, risk limits and a small controlled live test.

This page provides calculation and research frameworks, not investment, legal or tax advice.