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 level | Use when |
|---|---|
| High‑level | You want BacktestNode, config objects, data catalogs, and batch runs. |
| Low‑level | You 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:
| Step | Page | Use it for |
|---|---|---|
| 1 | APIs and repeated runs | Choose API level, load data, and run batches. |
| 2 | Data and venues | Match data granularity with venue book_type. |
| 3 | Execution flow | Understand sequencing, timers, and trade IDs. |
| 4 | Fill prices and matching | Understand deterministic matching behavior. |
| 5 | Trade execution | Use trade ticks, aggressor sides, and queues. |
| 6 | Bar execution | Use bars, OHLC sequencing, and bar timing. |
| 7 | Fill models | Configure slippage and probabilistic fills. |
| 8 | Accounts and margin | Configure funding, balances, and margin models. |
Related guides
- Strategies - Develop strategies to backtest.
- Visualization - Generate tearsheets from backtest results.
- Reports - Analyze backtest performance data.