NautilusTrader: The AI-First Algorithmic Trading Platform for Quants
NautilusTrader: High-Performance Algorithmic Trading Platform
Project Description
NautilusTrader is an open-source, high-performance, and production-grade algorithmic trading platform. It provides quantitative traders with an event-driven engine for backtesting portfolios of automated trading strategies on historical data and deploying those same strategies live without code changes. The platform is designed to be "AI-first," enabling the development and deployment of algorithmic trading strategies within a performant and robust Python-native environment. It aims to solve the parity challenge between research/backtesting and production live trading environments.
NautilusTrader prioritizes software correctness and safety to support Python-native, mission-critical trading system workloads. It is asset-class-agnostic, supporting high-frequency trading across various asset classes and instrument types, including FX, Equities, Futures, Options, Crypto, and Betting, across multiple venues simultaneously. Its core components are written in Rust and Cython for performance, while maintaining a Python-native environment for traders and firms.
Usage Instructions
NautilusTrader can be installed via pre-built binary wheels from PyPI or the Nautech Systems package index, or by building from source. It is recommended to use the latest supported Python version and install NautilusTrader within a virtual environment.
Installation
Recommended: Use the uv
package manager with a "vanilla" CPython.
From PyPI:
pip install -U nautilus_trader
From Nautech Systems package index (for stable or development wheels):
- Stable wheels:
pip install -U nautilus_trader --index-url=https://packages.nautechsystems.io/simple
- Development wheels (latest pre-release):
pip install -U nautilus_trader --pre --index-url=https://packages.nautechsystems.io/simple
- Specific development wheel:
pip install nautilus_trader==1.208.0a20241212 --index-url=https://packages.nautechsystems.io/simple
From Source:
- Install rustup:
- Linux/macOS:
curl https://sh.rustup.rs -sSf | sh
- Windows: Download and install
rustup-init.exe
, then install "Desktop development with C++" with Build Tools for Visual Studio 2019.
- Linux/macOS:
- Enable cargo:
- Linux/macOS:
source $HOME/.cargo/env
- Windows: Start new PowerShell.
- Linux/macOS:
- Install clang:
- Linux:
sudo apt-get install clang
- Windows: Add Clang to Build Tools for Visual Studio 2019.
- Linux:
- Enable clang (Windows):
[System.Environment]::SetEnvironmentVariable('path', "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\x64\bin\;" + $env:Path,"User")
- Install
uv
:curl -LsSf https://astral.sh/uv/install.sh | sh
- Clone and install:
git clone --branch develop --depth 1 https://github.com/nautechsystems/nautilus_trader cd nautilus_trader uv sync --all-extras
Docker Usage
Container images are available with various tags. For example, to run the JupyterLab nightly container:
docker pull ghcr.io/nautechsystems/jupyterlab:nightly --platform linux/amd64
docker run -p 8888:8888 ghcr.io/nautechsystems/jupyterlab:nightly
http://127.0.0.1:8888/lab
.
Key Features
- High-Performance: Core written in Rust with asynchronous networking using tokio.
- Reliable: Rust-powered type- and thread-safety, with optional Redis-backed state persistence.
- Portable: OS independent (Linux, macOS, Windows) and deployable via Docker.
- Flexible: Modular adapters allow integration with any REST API or WebSocket feed.
- Advanced Order Management: Supports various time-in-force options (IOC, FOK, GTC, GTD, DAY, AT_THE_OPEN, AT_THE_CLOSE), advanced order types, conditional triggers, execution instructions (post-only, reduce-only, icebergs), and contingency orders (OCO, OUO, OTO).
- Customizable: User-defined custom components and systems leveraging cache and message bus.
- Backtesting Capabilities: Supports multiple venues, instruments, and strategies simultaneously with historical quote tick, trade tick, bar, order book, and custom data at nanosecond resolution.
- Live Deployment: Identical strategy implementations for backtesting and live trading.
- Multi-venue: Facilitates market-making and statistical arbitrage strategies.
- AI Training: Fast backtest engine suitable for training AI trading agents (RL/ES).
- Python-Native Environment: Critical core components are in Rust/Cython for performance, providing a Python-native environment for professional traders.
- High-Precision Modes: Supports 64-bit (standard) and 128-bit (high) integer precision for core value types (Price, Quantity, Money).
Target Users
- Quantitative Traders: Individuals or firms developing and deploying algorithmic trading strategies.
- Developers: Those interested in building high-performance trading systems or contributing to an open-source platform.
- Researchers: Academics or industry professionals conducting research in algorithmic trading, machine learning, and AI in finance.
Project Links
- GitHub Repository: https://github.com/nautechsystems/nautilus_trader
- Website: https://nautilustrader.io
- Documentation: https://nautilustrader.io/docs/
- Support Email:
[email protected]
- Discord Community: Join via the website or GitHub page.
Application Scenarios
- Algorithmic Trading: Developing and executing automated trading strategies across various asset classes (FX, Equities, Futures, Options, Crypto, Betting).
- High-Frequency Trading (HFT): Leveraging the platform's performance and low-latency capabilities for HFT strategies.
- Backtesting and Simulation: Rigorously testing trading strategies against historical data with granular precision (nanosecond resolution).
- Quantitative Research: Conducting research into trading strategy effectiveness and market behavior.
- AI/Machine Learning in Trading: Training and deploying AI trading agents using the fast backtesting engine.
- Market Making: Implementing market-making strategies across multiple venues.
- Statistical Arbitrage: Developing and executing strategies that exploit price discrepancies across related assets or markets.
- Cross-Venue Trading: Operating simultaneously on different trading venues due to its multi-venue capabilities.