一键导入
nt-adapters
Use when working with exchange or data provider adapters, HTTP/WebSocket clients, instrument providers, or venue integration in NautilusTrader.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when working with exchange or data provider adapters, HTTP/WebSocket clients, instrument providers, or venue integration in NautilusTrader.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when working with strategy logic, order execution, risk management, position/portfolio tracking, or exec algorithms in NautilusTrader.
Use when working with backtesting engine, fill models, matching engine, simulated exchange, or backtest configuration in NautilusTrader.
Use when working with market data pipelines, data storage, ParquetDataCatalog, serialization, or cache operations in NautilusTrader.
Use when working with live trading nodes, system boot, NautilusKernel, engine configuration, component lifecycle, or deployment in NautilusTrader.
Use when learning NautilusTrader from scratch or deepening understanding. Provides a structured curriculum from installation to building custom NT components in Python and Rust.
Use when working with domain model types, instruments, identifiers, value types, enums, or currencies in NautilusTrader.
| name | nt-adapters |
| description | Use when working with exchange or data provider adapters, HTTP/WebSocket clients, instrument providers, or venue integration in NautilusTrader. |
NautilusTrader adapter domain — exchange/data provider integrations, HTTP/WebSocket clients, and instrument providers.
Python modules: adapters/* (16 adapters), adapters/_template/
Rust crates: All 16 adapters/* crates, nautilus_network, nautilus_cryptography
Supported adapters: Binance, Bybit, OKX, Kraken, Deribit, dYdX, Hyperliquid, BitMEX, Interactive Brokers, Databento, Tardis, Betfair, Polymarket, Architect (AX), Blockchain, Shioaji
nt-livent-tradingnt-datant-modelfrom nautilus_trader.adapters.binance.config import BinanceDataClientConfig, BinanceExecClientConfig
from nautilus_trader.adapters.binance.factories import BinanceLiveDataClientFactory, BinanceLiveExecClientFactory
data_config = BinanceDataClientConfig(
api_key="...",
api_secret="...",
account_type=BinanceAccountType.USDT_FUTURE,
)
exec_config = BinanceExecClientConfig(
api_key="...",
api_secret="...",
account_type=BinanceAccountType.USDT_FUTURE,
)
# Instrument discovery happens automatically when adapter connects
# Access instruments via cache:
instruments = self.cache.instruments(venue=Venue("BINANCE"))
instrument = self.cache.instrument(InstrumentId.from_str("ETHUSDT-PERP.BINANCE"))
Each adapter follows the same config pattern:
{Adapter}DataClientConfig — data feed configuration{Adapter}ExecClientConfig — execution configuration{Adapter}InstrumentProviderConfig — instrument discovery settingsfrom nautilus_trader.adapters.binance.providers import BinanceInstrumentProvider
class MyInstrumentProvider(BinanceInstrumentProvider):
async def load_all_async(self, filters=None):
await super().load_all_async(filters)
# Add custom instrument filtering/transformation
Extend data/exec clients to handle venue-specific message formats or additional endpoints.
Each Rust adapter provides factory and config types for wiring into a LiveNode. The pattern is the same across all adapters:
use nautilus_live::node::LiveNode;
use nautilus_model::identifiers::{AccountId, TraderId};
use nautilus_common::enums::Environment;
// Import adapter-specific types
use nautilus_binance::{
common::enums::BinanceProductType,
config::{BinanceDataClientConfig, BinanceExecClientConfig},
factories::{BinanceDataClientFactory, BinanceExecutionClientFactory},
};
let data_config = BinanceDataClientConfig {
product_types: vec![BinanceProductType::UsdM],
..Default::default()
};
let exec_config = BinanceExecClientConfig {
trader_id: TraderId::from("TRADER-001"),
account_id: AccountId::from("BINANCE-001"),
product_types: vec![BinanceProductType::UsdM],
..Default::default()
};
let mut node = LiveNode::builder(trader_id, Environment::Live)?
.add_data_client(
None,
Box::new(BinanceDataClientFactory::new()),
Box::new(data_config),
)?
.add_exec_client(
None,
Box::new(BinanceExecutionClientFactory::new()),
Box::new(exec_config),
)?
.build()?;
Each adapter exposes:
{Adapter}DataClientConfig — data feed configuration{Adapter}ExecClientConfig — execution configuration{Adapter}DataClientFactory — creates data client instances{Adapter}ExecutionClientFactory — creates execution client instances| Adapter | Crate | Data | Execution |
|---|---|---|---|
| Architect AX | nautilus-architect-ax | Yes | Yes |
| Betfair | nautilus-betfair | Yes | Yes |
| Binance | nautilus-binance | Yes | Yes |
| BitMEX | nautilus-bitmex | Yes | Yes |
| Bybit | nautilus-bybit | Yes | Yes |
| Databento | nautilus-databento | Yes | No |
| Deribit | nautilus-deribit | Yes | Yes |
| dYdX | nautilus-dydx | Yes | Yes |
| Hyperliquid | nautilus-hyperliquid | Yes | Yes |
| Kraken | nautilus-kraken | Yes | Yes |
| OKX | nautilus-okx | Yes | Yes |
| Polymarket | nautilus-polymarket | Yes | Yes |
| Sandbox | nautilus-sandbox | Yes | Yes |
| Tardis | nautilus-tardis | Yes | No |
Most adapters include node_data_tester.rs and node_exec_tester.rs:
# Run a data tester
cargo run -p nautilus-binance --example node-data-tester-futures
# Run an execution tester
cargo run -p nautilus-okx --example node-exec-tester
See references/examples/rust_adapters/ for all adapter examples.
Adapters read credentials from environment variables. Common pattern with dotenvy:
dotenvy::dotenv().ok();
// Adapter reads OKX_API_KEY, OKX_API_SECRET, etc. automatically
Each adapter's integration guide documents its required variables.
A new adapter requires these components:
LiveNode builderuse nautilus_network::http::HttpClient;
use nautilus_network::websocket::WebSocketClient;
pub struct MyExchangeDataClient {
http_client: HttpClient,
ws_client: WebSocketClient,
}
impl MyExchangeDataClient {
pub fn new(config: MyExchangeConfig) -> Self { /* ... */ }
pub fn connect(&mut self) -> anyhow::Result<()> { /* ... */ }
pub fn subscribe_trade_ticks(&mut self, instrument_id: InstrumentId) -> anyhow::Result<()> { /* ... */ }
}
Implement the factory trait so LiveNode::builder().add_data_client() can construct your client:
pub struct MyDataClientFactory;
impl MyDataClientFactory {
pub fn new() -> Self { Self }
}
For Python access, add #[pyclass] configs with dispatch in add_native_strategy:
#[pyclass] and #[pymethods] for Python-visible typescrates/pyo3/src/lib.rsPython::attach() for callback forwardingreferences/guides/ffi.md for detailed FFI patternsreferences/guides/rust.md for Rust coding standardsData client testing (TC-D01 to TC-D72):
references/guides/spec_data_testing.mdExecution client testing (TC-E01+):
references/guides/spec_exec_testing.mdnautilus_trader/adapters/{name}/{Name}DataClientConfig, {Name}ExecClientConfig{Name}LiveDataClientFactory, {Name}LiveExecClientFactory{Name}InstrumentProviderAdapters use factory pattern for client instantiation:
class MyAdapterLiveDataClientFactory(LiveDataClientFactory):
@staticmethod
def create(loop, name, config, msgbus, cache, clock):
return MyDataClient(...)
Each supported venue has detailed integration documentation covering:
references/integrations/ for per-venue docsreferences/concepts/ — adapters, live tradingreferences/api/ — adapter APIs (per-venue), live APIreferences/integrations/ — per-venue integration guides (16 venues)references/guides/ — adapter development, data/exec testing specs, FFI, Rust, coding standardsreferences/examples/ — live adapter examples (per-venue), Rust adapter examplestemplates/ — data_provider.py, exchange.py