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. |
The pages in this section describe the current Rust backtest engine and its Python package-root API.
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.
Logging
The platform provides logging for both backtesting and live trading using a high-performance logging subsystem implemented in Rust with a standardized...
Backtest APIs and Repeated Runs
NautilusTrader provides a low-level BacktestEngine API for direct control and a high-level BacktestNode API for catalog-backed, configurable runs.