NautilusTrader
ConceptsBacktesting
These docs track the unreleased nightly build and may change without notice. Switch to the latest stable docs.

Backtesting

Backtesting simulates trading against historical data using the same core system components used in live trading: built-in engines, the Cache, the MessageBus, Portfolio, Actors, Strategies, Execution Algorithms, and user-defined modules.

A BacktestEngine processes a stream of historical data. When the stream is exhausted, the engine produces results and performance metrics for analysis. NautilusTrader offers two API levels for backtesting:

API levelUse when
High‑levelYou want BacktestNode, config objects, data catalogs, and batch runs.
Low‑levelYou want direct BacktestEngine control and manual component setup.

Reading guide

The generated sidebar may sort these pages alphabetically. Use this order when reading the section end to end:

StepPageUse it for
1APIs and repeated runsChoose API level, load data, and run batches.
2Data and venuesMatch data granularity with venue book_type.
3Execution flowUnderstand sequencing, timers, and trade IDs.
4Fill prices and matchingUnderstand deterministic matching behavior.
5Trade executionUse trade ticks, aggressor sides, and queues.
6Bar executionUse bars, OHLC sequencing, and bar timing.
7Fill modelsConfigure slippage and probabilistic fills.
8Accounts and marginConfigure funding, balances, and margin models.
  • Strategies - Develop strategies to backtest.
  • Visualization - Generate tearsheets from backtest results.
  • Reports - Analyze backtest performance data.

On this page