nautilus trader - doubility-sky/daydayup GitHub Wiki
NautilusTrader is a high-performance algorithmic trading platform and event-driven backtester written in Rust and Python. It provides a professional-grade trading framework with ultra-low latency execution, supporting both cryptocurrency and traditional markets across multiple venues.
- Official Documentation - Comprehensive guide to installation, architecture, and trading strategies
- Getting Started - Quick introduction to NautilusTrader
- User Guide - Detailed user documentation
- API Reference - Complete API documentation
- Developer Guide - Contributing and extending the platform
- Blog - Official blog with updates and tutorials
- Medium Articles - Technical articles and insights
- Discord Community - Active community for support and discussions
- GitHub Discussions - Technical discussions and Q&A
- r/algotrading - General algorithmic trading discussions
A minimal example to get started with NautilusTrader:
from nautilus_trader.backtest.engine import BacktestEngine
from nautilus_trader.backtest.engine import BacktestEngineConfig
from nautilus_trader.examples.strategies.ema_cross import EMACross
from nautilus_trader.model.currencies import USD
# Configure backtest engine
config = BacktestEngineConfig(
trader_id="BACKTESTER-001",
log_level="INFO"
)
# Create backtest engine
engine = BacktestEngine(config=config)
# Add a strategy
strategy = EMACross(
instrument_id="EUR/USD.IDEALPRO",
bar_type="EUR/USD.IDEALPRO-1-MINUTE-BID",
fast_ema_period=10,
slow_ema_period=20,
)
engine.add_strategy(strategy)
# Add data and run
engine.add_instrument("EUR/USD.IDEALPRO")
engine.run()
# Analyze results
engine.trader.generate_account_report()For more examples, see Example Notebooks.
-
Installation Methods Comparison
- Which method is best for production?
- Source installation for ultimate control and performance
- Which is easiest to get started?
- PyPI installation:
pip install -U nautilus_trader
- PyPI installation:
- How to switch versions?
- PyPI:
pip install nautilus_trader==<version> - Source:
git checkouttags
- PyPI:
- Which method is best for production?
pip install -U nautilus_tradergit clone https://github.com/nautechsystems/nautilus_trader.git
cd nautilus_trader
make installdocker pull ghcr.io/nautechsystems/nautilus_trader:latest
docker run -it nautilus_trader- Python 3.10+
- Rust (for building from source)
- Redis (optional, for distributed systems)
- Platform Support
- Linux (recommended for production)
- macOS
- Windows (via WSL2)
- Strategy Configuration - Configure trading strategies and parameters
- Data Configuration - Set up data providers and historical data
- Execution Configuration - Configure order execution and risk management
- Logging Configuration - Set up logging for debugging and monitoring
- Exchange-specific Notes - Information on supported exchanges and their configurations
- Supported Venues
- Crypto: Binance, Bybit, OKX, dYdX, Kraken, Coinbase, etc.
- Traditional: Interactive Brokers
- Data Providers: Custom adapters for various data sources
- Custom Adapters - Build adapters for new exchanges or data providers
- Strategy Development - Learn how to create custom trading strategies
- Order Management - Managing orders within strategies
- Risk Management - Implementing risk controls
- Portfolio Management - Multi-asset portfolio strategies
- Example Strategies - Collection of example strategies in the official repository
- Strategy Types
- Market making
- Arbitrage
- Momentum
- Mean reversion
- Pairs trading
- Backtesting Engine - High-fidelity event-driven backtesting
- Data Management - Loading and managing historical data for backtesting
- Performance Analysis - Analyzing backtest results and performance metrics
- Key Features
- Event-driven architecture for accurate simulation
- Multi-venue and multi-asset support
- Order book simulation with configurable fill models
- Latency simulation
- Transaction cost modeling
- High-resolution tick data support
- Assumptions and Limitations - Understanding backtesting limitations
⚠️ Best Practices- Use high-quality tick data for accurate results
- Account for realistic slippage and transaction costs
- Model market impact for large orders
- Test across different market conditions
- Validate results with walk-forward analysis
- Be aware of look-ahead bias in indicator calculations
- Use proper train/test splits to avoid overfitting
- Paper Trading - Test strategies with simulated funds
- Live Deployment - Deploy strategies for live trading
- Monitoring - Monitor running strategies and system health
- Risk Controls - Pre-trade and post-trade risk management
- Commands - Command interface for controlling trading instances
- REST API - RESTful API for programmatic control
- WebSocket API - Real-time streaming data and commands
- Logging and Monitoring - System logs and performance monitoring
---
title: NautilusTrader Architecture
---
graph TB
subgraph "Application Layer"
STRAT[Trading Strategies]
ACTORS[Custom Actors]
end
subgraph "Trading Core"
EXEC[Execution Engine]
RISK[Risk Engine]
PORT[Portfolio]
DATA[Data Engine]
CACHE[Cache]
end
subgraph "Integration Layer"
ADAPTERS[Exchange Adapters]
FEEDS[Data Feeds]
end
subgraph "Infrastructure"
MSG[Message Bus]
PERSIST[Persistence]
LOGGER[Logger]
end
subgraph "External"
EXCH[Exchanges]
DATASRC[Data Sources]
end
STRAT --> EXEC
STRAT --> DATA
ACTORS --> MSG
EXEC --> RISK
EXEC --> PORT
EXEC --> ADAPTERS
DATA --> CACHE
DATA --> FEEDS
ADAPTERS <--> EXCH
FEEDS <--> DATASRC
EXEC --> MSG
DATA --> MSG
MSG --> PERSIST
MSG --> LOGGER
classDef appStyle stroke:#5FFFD7,stroke-width:3px
classDef coreStyle stroke:#00B1BB,stroke-width:3px
classDef infraStyle stroke:#E549FF,stroke-width:3px
class STRAT,ACTORS appStyle
class EXEC,RISK,PORT,DATA,CACHE coreStyle
class MSG,PERSIST,LOGGER infraStyle
- Low Latency: Sub-microsecond event processing with Rust core
- High Throughput: Handles millions of events per second
- Memory Efficient: Optimized memory usage with zero-copy operations
- Scalability: Horizontal scaling with distributed architecture
- Compile with
--releaseflag for production - Use Parquet format for efficient data storage and retrieval
- Configure cache size based on available memory
- Enable Redis for distributed caching
- Use colocation or low-latency hosting for high-frequency-trading
- Profile strategies with built-in performance monitoring tools
- Custom Indicators - Create and use custom technical indicators
- Data Aggregation - Multi-timeframe and custom bar aggregation
- Distributed Systems - Deploy across multiple machines
- Machine Learning Integration - Integrate ML models into trading strategies
- Historical Data - Download and manage historical market data
- Data Catalog - Organize and query large datasets efficiently
- Supported Data Formats
- Parquet (recommended for production)
- CSV
- Custom formats via adapters
- Data Sources
- Exchange historical data
- Third-party data providers
- Custom data feeds
- Core Technologies
- Data Science Stack
- Networking
- aiohttp - Async HTTP client/server
- websockets - WebSocket protocol
- High-Frequency Trading: Ultra-low latency execution for HFT strategies
- Market Making: Automated market making with order book support
- Statistical Arbitrage: Multi-asset statistical arbitrage strategies
- Portfolio Management: Institutional-grade portfolio management
- Research and Development: Professional backtesting and strategy research
- Crypto Trading: Multi-exchange cryptocurrency trading
- Traditional Markets: Stocks, futures, options via Interactive Brokers
- Data Visualization: Integration with TradingView for charting
- Data Analysis: Compatible with Jupyter notebooks for analysis
- Monitoring: Grafana and Prometheus for system monitoring
- Alerting: Webhook support for trade notifications
- Version Control: Git-friendly configuration and strategy code
- CI/CD: Docker support for continuous deployment
| Feature | NautilusTrader | freqtrade | hummingbot |
|---|---|---|---|
| Language | Rust + Python | Python | Python |
| Performance | Ultra-high | Medium | Medium-High |
| Backtesting | Event-driven | Vectorized | Limited |
| Live Trading | Yes | Yes | Yes |
| Traditional Markets | Yes | No | Limited |
| Order Book Support | Full Level 2/3 | Limited | Yes |
| Latency | Sub-microsecond | Millisecond | Millisecond |
| Learning Curve | High | Medium | Medium |
| Setup Complexity | High | Low-Medium | Medium |
| Community Size | Growing | Large | Medium |
| Best For | HFT, Professional | Crypto automation | Market making |
| Documentation | Excellent | Excellent | Good |
- Frequently Asked Questions
- Install on macOS x86_64
export RUSTFLAGS="-C link-arg=-Wl,-undefined,dynamic_lookup"uv pip install nautilus_trader
- Common Issues
- Performance: Ensure compiled with release mode for production
- Data: Use Parquet format for efficient historical data storage
- Memory: Configure cache settings based on available RAM
- Latency: Use colocation or proximity hosting for ultra-low latency
- Installation: Build from source may take 10-30 minutes due to Rust compilation
- Python Version: Requires Python 3.10+, not compatible with older versions
- Windows: Best experience through WSL2, native Windows support is limited
- GitHub Repository - Main source code repository
- GitHub topic of NautilusTrader tag
- Discord Community - Active community for support and discussions
- Example Notebooks - Jupyter notebooks with tutorials
- Example Strategies - Reference strategy implementations
- Video Tutorials - Official YouTube channel
- Awesome Quant - Curated list of quantitative finance libraries
- Awesome Systematic Trading - Systematic trading resources
- Comparison Resources
- vs freqtrade - More crypto-focused with simpler setup
- vs hummingbot - More market-making focused with visual dashboard
- vs QuantConnect/LEAN - Similar professional-grade platform
