NautilusTrader Skill
High-performance algorithmic trading platform with event-driven architecture. Identical code for backtesting and live trading. Rust/Cython core with Python bindings.
Always consult official docs for current API - the API evolves frequently with breaking changes before v2.x.
File Guide
Core Development
- strategy-development.md - Strategy class, lifecycle, event handlers, order submission
- backtesting.md - BacktestNode/Engine setup, fill models, data catalog
- live-trading.md - TradingNode deployment, Redis, production safety
Data & Orders
- data-models.md - QuoteTick, TradeTick, Bar, InstrumentId, BarType
- orders.md - Order types, OrderFactory, bracket orders, emulation
- cache.md - Query instruments, orders, positions, market data
Components
- actors.md - Actor base class for non-trading components
- indicators.md - Built-in indicators, registration, custom indicators
- portfolio.md - Account balances, positions, PnL calculations
- execution.md - Execution flow, risk engine, execution algorithms
Integration
- integrations.md - Binance, Bybit, Interactive Brokers status
- adapters.md - Custom adapter implementation
- architecture.md - NautilusKernel, MessageBus, engines
Reference
- examples.md - Complete working strategies
- best-practices.md - Testing, optimization, safety
- troubleshooting.md - Common issues
- installation.md - Setup, precision modes
Critical Patterns
Register indicators BEFORE subscribing:
self.register_indicator_for_bars(self.bar_type, self.ema)
self.subscribe_bars(self.bar_type) # Must be after registration
Use strategy's order_factory:
order = self.order_factory.market(
instrument_id=instrument_id,
order_side=OrderSide.BUY,
quantity=Quantity.from_str("1.0"),
)
self.submit_order(order)
BarType string format:
# Format: {instrument_id}-{step}-{aggregation}-{price_type}-{source}
bar_type = BarType.from_str("BTCUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL")
InstrumentId format:
# Format: {symbol}.{venue}
instrument_id = InstrumentId.from_str("BTCUSDT.BINANCE")
Quantity/Price from strings (avoids precision issues):
quantity = Quantity.from_str("1.5")
price = Price.from_str("50000.00")
Check indicator initialization:
def on_bar(self, bar: Bar):
if not self.ema.initialized:
return
# Safe to use self.ema.value
OMS Types
OmsType.NETTING - Single position per instrument (crypto-style)
OmsType.HEDGING - Multiple positions per instrument (traditional futures)
Account Types
AccountType.CASH - Spot trading
AccountType.MARGIN - Margin/leverage trading
1---2name: using-nautilus-trader3description: Provides expert guidance for NautilusTrader algorithmic trading platform. Covers backtesting strategies, live trading deployment, event-driven architecture, and building trading systems.4---5
6# NautilusTrader Skill
7
8High-performance algorithmic trading platform with event-driven architecture. Identical code for backtesting and live trading. Rust/Cython core with Python bindings.
9
10**Always consult official docs for current API** - the API evolves frequently with breaking changes before v2.x.
11
12- **Docs:** https://nautilustrader.io/docs/latest/
13- **API Reference:** https://nautilustrader.io/docs/latest/api_reference/
14- **Source:** https://github.com/nautechsystems/nautilus_trader
15
16## File Guide
17
18**Core Development**
19- [strategy-development.md](strategy-development.md) - Strategy class, lifecycle, event handlers, order submission
20- [backtesting.md](backtesting.md) - BacktestNode/Engine setup, fill models, data catalog
21- [live-trading.md](live-trading.md) - TradingNode deployment, Redis, production safety
22
23**Data & Orders**
24- [data-models.md](data-models.md) - QuoteTick, TradeTick, Bar, InstrumentId, BarType
25- [orders.md](orders.md) - Order types, OrderFactory, bracket orders, emulation
26- [cache.md](cache.md) - Query instruments, orders, positions, market data
27
28**Components**
29- [actors.md](actors.md) - Actor base class for non-trading components
30- [indicators.md](indicators.md) - Built-in indicators, registration, custom indicators
31- [portfolio.md](portfolio.md) - Account balances, positions, PnL calculations
32- [execution.md](execution.md) - Execution flow, risk engine, execution algorithms
33
34**Integration**
35- [integrations.md](integrations.md) - Binance, Bybit, Interactive Brokers status
36- [adapters.md](adapters.md) - Custom adapter implementation
37- [architecture.md](architecture.md) - NautilusKernel, MessageBus, engines
38
39**Reference**
40- [examples.md](examples.md) - Complete working strategies
41- [best-practices.md](best-practices.md) - Testing, optimization, safety
42- [troubleshooting.md](troubleshooting.md) - Common issues
43- [installation.md](installation.md) - Setup, precision modes
44
45## Critical Patterns
46
47**Register indicators BEFORE subscribing:**
48```python
49self.register_indicator_for_bars(self.bar_type, self.ema)
50self.subscribe_bars(self.bar_type) # Must be after registration
51```
52
53**Use strategy's order_factory:**
54```python
55order = self.order_factory.market(
56 instrument_id=instrument_id,
57 order_side=OrderSide.BUY,
58 quantity=Quantity.from_str("1.0"),
59)
60self.submit_order(order)
61```
62
63**BarType string format:**
64```python
65# Format: {instrument_id}-{step}-{aggregation}-{price_type}-{source}
66bar_type = BarType.from_str("BTCUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL")
67```
68
69**InstrumentId format:**
70```python
71# Format: {symbol}.{venue}
72instrument_id = InstrumentId.from_str("BTCUSDT.BINANCE")
73```
74
75**Quantity/Price from strings (avoids precision issues):**
76```python
77quantity = Quantity.from_str("1.5")
78price = Price.from_str("50000.00")
79```
80
81**Check indicator initialization:**
82```python
83def on_bar(self, bar: Bar):
84 if not self.ema.initialized:
85 return
86 # Safe to use self.ema.value
87```
88
89## OMS Types
90
91- `OmsType.NETTING` - Single position per instrument (crypto-style)
92- `OmsType.HEDGING` - Multiple positions per instrument (traditional futures)
93
94## Account Types
95
96- `AccountType.CASH` - Spot trading
97- `AccountType.MARGIN` - Margin/leverage trading