NautilusTrader Documentation

website·Indexed 33 days ago

https://nautilustrader.io/docs

An open-source, production-grade, Rust-native trading engine infrastructure for multi-asset, multi-venue trading. It provides a high-performance core with a Python control surface via PyO3, featuring components for event sourcing, deterministic simulation testing (DST), risk management, and a pluggable architecture for custom strategies and adapters.

Tokens
341.2K
Snippets
911
Records
1.9K
Agent score
70%

What's inside NautilusTrader

  1. Overview of Deterministic Simulation Testing (DST) in NautilusTrader

    Deterministic Simulation Testing (DST) allows NautilusTrader to run under a seed-controlled runtime to ensure reproducible execution. By replacing ambient process state (task wake order, timer resolution, OS thread scheduling, and randomized hash seeds) with a seeded pseudorandom sequence, two runs with the same seed, binary, configuration, and platform will produce identical observable behavior. This is primarily used to detect and replay concurrency defects such as channel wakeup ordering, drain races during shutdown, and recovery-path correctness.
  2. Overview of Databento Integration in NautilusTrader

    NautilusTrader provides an adapter for the Databento API and Databento Binary Encoding (DBN). This adapter is designed for market data retrieval and does not include an execution client. It supports loading historical DBN files, requesting historical data via HTTP API, and subscribing to real-time data feeds via TCP API. The adapter is built using the official databento-rs Rust crate, which is linked automatically during build; no separate installation of the databento library is required.
  3. Overview of Continuous Futures in Nautilus Trader

    A continuous future is a derived series that splices consecutive futures contracts into a single adjusted price stream. Because futures contracts expire, the series 'rolls' to the next contract at specific transition points. To prevent artificial price jumps caused by contract changes, each segment is adjusted into a common price frame. In Nautilus, a continuous future is defined by a target BarType (the continuous root) and a list of roll transitions provided in the request or subscription parameters.
  4. Overview of NautilusTrader Value Types

    NautilusTrader provides three specialized value types for core trading concepts. These types use internal fixed-point arithmetic to ensure performant and deterministic calculations across platforms.

    TypePurposeSignedCurrency
    QuantityTrade sizes, order amounts, positionsNo-
    PriceMarket prices, quotes, price levelsYes-
    MoneyMonetary amounts, P&L, account balancesYesYes
  5. Overview of Hyperliquid Adapter Components

    The Hyperliquid adapter is implemented in Rust with Python bindings and integrates directly with Hyperliquid's REST and WebSocket APIs. It consists of several low-level components, though most users typically interact with them via a live trading node configuration.
  6. Overview of OKX Integration Components

    The OKX adapter is implemented in Rust with PyO3 bindings for Python and does not require external OKX client libraries. It consists of several components that can be used independently or together:

    • OKXHttpClient: Low-level HTTP API connectivity.
    • OKXWebSocketClient: Low-level WebSocket API connectivity for Rust callers.
    • OKXDataClient: Market data feed manager.
    • OKXExecutionClient: Account management and trade execution gateway.
    • OKXDataClientFactory: Factory for creating OKX data clients.
    • OKXExecutionClientFactory: Factory for creating OKX execution clients.
  7. Overview of built-in market data types

    NautilusTrader provides several built-in data types categorized by their role in the market data lifecycle. These types are used across backtesting, sandbox, and live environments. Data flowing over the message bus is organized under the data root, with live streams using data.<kind>... and pipeline paths using data.pipeline.<kind>....
  8. Overview of Custom Data in NautilusTrader

    NautilusTrader allows users to define custom data types authored in either Python or Rust. Both authoring modes utilize the same runtime routing, persistence (via ParquetDataCatalog), and query pipelines as built-in data. Custom data is wrapped in a common PyO3 CustomData container to cross the Python/Rust boundary and is identified by a DataType object for routing and storage.
  9. Overview of nautilus-network transport clients

    NautilusTrader adapters utilize the nautilus-network library for network communication. The library provides three primary clients that wrap underlying Rust transports with trading-specific policies such as rate limits, liveness checks, and reconnect control.
  10. Overview of NautilusTrader Behavioral Models

    Behavioral models are pluggable components in NautilusTrader that define the rules for specific calculations or decisions within the system. They allow users to modify system behavior (such as how fills are simulated or how fees are calculated) without changing the core engine or strategy code. Models are configured as objects during setup or via runtime APIs.
  11. Overview of NautilusTrader data flow

    Data follows a consistent pathway regardless of the environment (Live, Sandbox, or Backtest):

    1. Ingestion: In live/sandbox, a venue adapter creates a normalized object. In backtests, the engine feeds data directly.
    2. Processing: The DataEngine receives the data.
    3. Storage & Distribution: The DataEngine stores cached types in the Cache and publishes all data on the MessageBus for subscribed handlers.
  12. Overview of Coinbase Advanced Trade Integration

    The Coinbase adapter for Nautilus Trader supports live market data ingestion and order execution for spot (Cash) and CFM derivatives (Margin) accounts via the Advanced Trade API. It is implemented in Rust and exposed to Python. Key components include the CoinbaseRawHttpClient for low-level REST/JWT handling, CoinbaseWebSocketClient for connectivity, and CoinbaseExecutionClient for managing orders and streams.