nautilus_trader README

项目的 README,来自 github.com/nautechsystems/nautilus_trader。合并为一个 markdown 文件:README.md。

NautilusTrader

rustc crates.io codspeed pythons pypi-version Downloads Discord

Branch Version Status
master version build
nightly version build
develop version build
Platform Rust Python
Linux (x86_64) 1.100.0 3.13-3.15
Linux (ARM64) 1.100.0 3.13-3.15
macOS (ARM64) 1.100.0 3.13-3.15
Windows (x86_64) 1.100.0 3.13-3.15

Introduction

NautilusTrader is an open-source, production-grade, Rust-native engine for multi-asset, multi-venue trading systems.

The system spans research, deterministic simulation, and live execution within a single event-driven architecture, with Python serving as the control plane for strategy logic, configuration, and orchestration.

This separation provides the performance and safety of a compiled trading engine with the flexibility of Python for system composition and strategy development. Trading systems can also be written entirely in Rust for mission-critical workloads.

The same strategy and execution-algorithm code can run across backtest and live systems, reducing deployment divergence. Live execution still introduces venue, transport, timing, persistence, external-activity, and reconciliation behavior that a simulation may not reproduce. See Backtest and live differences.

NautilusTrader is asset-class-agnostic. Any venue with a REST API or WebSocket feed can be integrated through modular adapters. Current integrations span crypto exchanges (CEX and DEX), traditional markets (FX, equities, futures, options), and betting exchanges.

nautilus-trader

Features

nautilus

nautilus - from ancient Greek 'sailor' and naus 'ship'.

The nautilus shell consists of modular chambers with a growth factor which approximates a logarithmic spiral. The idea is that this can be translated to the aesthetics of design and architecture.

Why NautilusTrader?

Trading strategy research is often conducted in Python using vectorized approaches, while production trading systems are implemented separately using event-driven architectures in compiled languages.

NautilusTrader removes this separation.

A Rust-native core provides a deterministic event-driven runtime for both research and live execution, while Python serves as the control plane. The same architecture, execution semantics, and time model operate across both environments, allowing strategies to move from research to production without reimplementation.

Python bindings are provided via PyO3 for the Rust-native v2 runtime. During the v2 transition, v1 receives only critical security backports on the develop_v1 branch. See the v2 migration guide for migration steps and compatibility details. No Rust toolchain is required to install prebuilt wheels.

This project makes the Soundness Pledge:

"The intent of this project is to be free of soundness bugs. The developers will do their best to avoid them, and welcome help in analyzing and fixing them."

[!NOTE]

MSRV: NautilusTrader relies heavily on improvements in the Rust language and compiler. As a result, the Minimum Supported Rust Version (MSRV) is generally equal to the latest stable release of Rust.

Integrations

NautilusTrader is modularly designed to work with adapters, enabling connectivity to trading venues and data providers by translating their raw APIs into a unified interface and normalized domain model.

The following integrations are available or planned; see docs/integrations/ for details:

Name ID Type Status Docs
AX Exchange AX Derivatives Exchange status Guide
Betfair BETFAIR Sports Betting Exchange status Guide
Binance BINANCE Crypto Exchange (CEX) status Guide
Blockchain BLOCKCHAIN DeFi Data Provider status Guide
Bybit BYBIT Crypto Exchange (CEX) status Guide
CoinAPI COINAPI Data Provider status Guide
Coinbase COINBASE Crypto Exchange (CEX) status Guide
Databento DATABENTO Data Provider status Guide
Deribit DERIBIT Crypto Exchange (CEX) status Guide
Derive DERIVE Crypto Exchange (DEX) status Guide
dYdX DYDX Crypto Exchange (DEX) status Guide
FinFeed FINFEED Data Provider status Guide
Hyperliquid HYPERLIQUID Crypto Exchange (DEX) status Guide
Interactive Brokers INTERACTIVE_BROKERS Brokerage (multi-venue) status Guide
Kalshi KALSHI Prediction Market (CEX) status Guide
Kraken KRAKEN Crypto Exchange (CEX) status Guide
Lighter LIGHTER Crypto Exchange (DEX) status Guide
Lighter on Robinhood LIGHTER_ROBINHOOD Crypto Exchange (DEX) status Guide
OKX OKX Crypto Exchange (CEX) status Guide
Polymarket POLYMARKET Prediction Market (DEX) status Guide
Tardis TARDIS Crypto Data Provider status Guide

For Lighter on Robinhood, LIGHTER_ROBINHOOD is the venue and explicit client ID to register. The shared Lighter factory keeps LIGHTER as its compatibility default.

Status

See the Integrations documentation for further details.

Roadmap

The Roadmap outlines NautilusTrader's strategic direction. Current priorities include stabilizing the Rust-native core, improving documentation, and enhancing code ergonomics.

The open-source project focuses on single-node backtesting and live trading for individual and small-team quantitative traders. UI dashboards, distributed orchestration, and built-in AI/ML tooling are out of scope to maintain focus on the core engine and ecosystem sustainability. Additional external integrations (such as databases, cloud services, and monitoring tools) are also out of scope unless explicitly listed in the open-source scope.

New integration proposals within the open-source scope should start with an RFC issue to discuss suitability before submitting a PR. See Community-contributed integrations for guidelines.

Security

OpenSSF Scorecard

Security is a priority for the NautilusTrader project. We apply security controls across dependency selection, development, builds, and releases.

OpenSSF Scorecard provides an automated repository-health signal alongside manual review, CI hardening, and security audits.

Reporting a vulnerability

Report privately through GitHub Security Advisories or email [email protected] (PGP key available on request).

See the following for details:

Versioning and releases

[!WARNING]

NautilusTrader is still under active development. Some features may be incomplete, and while the API is becoming more stable, breaking changes can occur between releases. We strive to document these changes in the release notes on a best-effort basis.

We aim to follow a bi-weekly release schedule, though experimental or larger features may cause delays.

Branches

We aim to maintain a stable, passing build across all branches.

[!NOTE]

The v2 release-candidate line is the transition toward a stable API for version 2.x. Once this milestone is reached, we plan to implement a formal deprecation process for any API changes. This approach allows us to maintain a rapid development pace for now.

Precision mode

NautilusTrader supports two precision modes for its core value types (Price, Quantity, Money), which differ in their internal bit-width and maximum decimal precision.

[!NOTE]

By default, the official Python wheels ship in high-precision (128-bit) mode on all supported platforms.

For pure Rust crates, high-precision works on all platforms (including Windows) since Rust handles i128/u128 via software emulation. The default is standard-precision unless you explicitly enable the high-precision feature flag.

See the Installation Guide for further details.

Rust feature flag: To enable high-precision mode in Rust, add the high-precision feature to your Cargo.toml:

[dependencies]
nautilus-model = { version = "*", features = ["high-precision"] }

Installation

For PyPI binary wheels, use Python 3.13-3.15. Install nautilus_trader in a virtual environment to isolate dependencies.

There are two supported ways to install:

  1. Pre-built binary wheel from PyPI or the Nautech Systems package index.
  2. Build from source.

[!TIP]

We highly recommend installing using the uv package manager with a "vanilla" CPython.

Conda and other Python distributions may work but aren't officially supported.

From PyPI

This repository and the documentation cover v2. To install the v2 release-candidate wheels from PyPI using Python's pip package manager:

pip install -U nautilus_trader --pre

The v2 release-candidate wheels use 2.0.0rcN versions and are intended for community testing before the final 2.0.0 release. We do not recommend using release candidates in production environments, such as live trading controlling real capital.

The --pre flag is required until 2.0.0 is released. Without it, pip installs the latest stable v1 wheel, whose Python API differs from the v2 documentation:

# Installs the latest stable v1 wheel, which cannot run the v2 documentation
pip install -U nautilus_trader

Install optional dependencies for interactive tearsheets and charts with the visualization extra:

pip install -U "nautilus_trader[visualization]" --pre

See the Installation Guide for details.

From the Nautech Systems package index

The Nautech Systems package index (packages.nautechsystems.io) complies with PEP-503 and hosts both stable and development binary wheels for nautilus_trader. This enables users to install either the latest stable release or pre-release versions for testing.

Stable wheels

Stable wheels correspond to official releases of nautilus_trader on PyPI, and use standard versioning. As on PyPI, the latest stable release is still on the 1.x line, whose Python API differs from these v2 docs. This index also hosts development wheels, so --pre allows those versions too. To install a specific 2.x release candidate, pin its version (nautilus_trader==2.0.0rcN).

To install the latest stable release:

pip install -U nautilus_trader --index-url=https://packages.nautechsystems.io/simple

[!TIP]

Use --extra-index-url instead of --index-url to search both PyPI and the Nautech Systems package index. Pip selects the best matching version across both indexes without giving either index priority.

Development wheels

The main package index publishes v2 development wheels from both the nightly and develop branches, allowing users to test features and fixes ahead of stable releases.

This process also helps preserve compute resources and provides easy access to the exact binaries tested in CI pipelines, while adhering to PEP-440 versioning standards:

Platform Develop Nightly
Linux (x86_64) ✓ ✓
Linux (ARM64) - ✓
macOS (ARM64) - ✓
Windows (x86_64) - ✓

[!WARNING]

We do not recommend using development wheels in production environments, such as live trading controlling real capital.

Installation commands

By default, pip will install the latest stable release. Adding the --pre flag ensures that pre-release versions, including development wheels, are considered.

To install the latest available pre-release (including development wheels):

pip install -U nautilus_trader --pre --index-url=https://packages.nautechsystems.io/simple

Available versions

You can view all available versions of nautilus_trader on the package index.

To programmatically fetch and list available versions:

curl -s https://packages.nautechsystems.io/simple/nautilus-trader/index.html | sed -n 's/.*<a href="\([^"]*\)".*/\1/p' | awk -F'#' '{print $1}' | sort

[!IMPORTANT]

On Linux, confirm your glibc version with ldd --version and ensure it reports 2.35 or newer before installing binary wheels.

Branch updates

Retention policies

Verifying build provenance

All release artifacts published by the project carry cryptographic attestations generated by the CI/CD pipeline:

Both are issued via Sigstore and bound to a specific commit SHA, so verification ensures the artifact was produced by the official NautilusTrader GitHub Actions workflow and has not been tampered with since.

For step-by-step verification commands, see Verifying releases in SECURITY.md.

[!IMPORTANT]

Verification requires the GitHub CLI (gh) for Python artifacts and cosign for Docker images. Development wheels from develop and nightly branches are also attested.

From source

It's possible to install from source using pip if you first install the build dependencies as specified in the pyproject.toml.

  1. Install rustup (the Rust toolchain installer):

    • Linux and macOS:

      curl https://sh.rustup.rs -sSf | sh
      
    • Windows:

    • Verify (any system): from a terminal session run: rustc --version

  2. Enable cargo in the current shell:

    • Linux and macOS:

      source $HOME/.cargo/env
      
    • Windows:

      • Start a new PowerShell
  3. Install clang (a C language frontend for LLVM):

    • Linux (also installs lld, used as the Rust linker for faster builds):

      sudo apt-get install clang lld
      
    • macOS:

      xcode-select --install
      
    • Windows:

      1. Add Clang to your Build Tools for Visual Studio 2022:

        • Start | Visual Studio Installer | Modify | C++ Clang tools for Windows (latest) = checked | Modify
      2. Enable clang in the current shell:

        [System.Environment]::SetEnvironmentVariable('path', "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin\;" + $env:Path,"User")
        
    • Verify (any system): from a terminal session run: clang --version

  4. Install uv (see the uv installation guide for more details):

    • Linux and macOS:

      curl -LsSf https://astral.sh/uv/install.sh | sh
      
    • Windows (PowerShell):

      irm https://astral.sh/uv/install.ps1 | iex
      
  5. Clone the source with git, then sync its dependencies from the project root:

    git clone --branch develop --depth 1 https://github.com/nautechsystems/nautilus_trader
    cd nautilus_trader
    make sync
    

[!NOTE]

The --depth 1 flag fetches just the latest commit for a faster, lightweight clone.

  1. Use the uv project environment.

    The uv project environment lives at python/.venv, beside python/pyproject.toml. Run direct uv project commands from python/ or pass --project python from the repository root.

    For PyO3 compilation on Linux and macOS, run these commands from the repository root after make sync in Bash or Zsh. For Fish commands, see the developer guide's environment setup. Set PYO3_PYTHON in each shell to this checkout's python/.venv/bin/python; replace any saved export that still points to the root .venv/bin/python.

    # Set the Python executable path for PyO3
    export PYO3_PYTHON="$PWD/python/.venv/bin/python"
    
    # Linux only: Set the library path for the uv-managed Python runtime
    PYTHON_LIB_DIR="$("$PYO3_PYTHON" -c 'import sysconfig; print(sysconfig.get_config_var("LIBDIR"))')"
    export LD_LIBRARY_PATH="$PYTHON_LIB_DIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
    
    # Required for Rust tests when using uv-installed Python
    export PYTHONHOME="$("$PYO3_PYTHON" -c 'import sys; print(sys.base_prefix)')"
    

[!NOTE]

The LD_LIBRARY_PATH export is Linux-specific and not needed on macOS.

The PYTHONHOME variable is required when running make cargo-test with a uv-installed Python. Without it, tests that depend on PyO3 may fail to locate the Python runtime.

  1. Build and install NautilusTrader in release mode:

    make build
    

See the Installation Guide for other options and further details.

Redis

Using Redis with NautilusTrader is optional and only required if configured as the backend for a cache database or message bus. See the Redis section of the Installation Guide for further details.

Makefile

A Makefile is provided to automate most installation and build tasks for development. Some of the targets include:

[!TIP]

Run make help for documentation on all available make targets.

[!TIP]

See the crates/infrastructure/TESTS.md file for running the infrastructure integration tests.

Examples

Indicators and strategies can be developed in Python or Rust. For performance and latency-sensitive applications, we recommend Rust. Below are some examples:

Docker

Docker containers are built with the following variant tags:

You can pull the container images as follows:

docker pull ghcr.io/nautechsystems/<image_variant_tag> --platform linux/amd64

You can launch the backtest example container by running:

docker pull ghcr.io/nautechsystems/jupyterlab:nightly --platform linux/amd64
docker run -p 8888:8888 ghcr.io/nautechsystems/jupyterlab:nightly

Then open your browser at the following address:

http://127.0.0.1:8888/lab

[!WARNING]

Examples use log_level="ERROR" because Nautilus logging exceeds Jupyter's stdout rate limit, causing notebooks to hang at lower log levels.

Development

We aim to provide the most pleasant developer experience possible for this hybrid Rust and Python codebase. See the Developer Guide for helpful information.

Nautilus Engineering maintains the engineering standards, lint configuration, pre-commit definitions, tool pins, and repository checks shared across Nautilus projects. This repository vendors selected files at the revision recorded in .nautilus-engineering.lock; project-specific policy and CI wiring remain local.

[!TIP]

Run make build-debug after Rust changes. Python-only edits take effect on the next import from the editable installation.

After changes to PyO3 bindings, stub annotations, or wrapped Rust docs, regenerate the generated Python artifacts from the repository root:

make py-stubs

Commit the generated .pyi files and PyO3 wrapper doc comments changed by this target. See Generated Python artifacts for details.

Testing with Rust

cargo-nextest is the standard Rust test runner for NautilusTrader. Its key benefit is isolating each test in its own process, ensuring test reliability by avoiding interference. See the Rust testing guidance for details about full-suite support and the limits of plain cargo test.

You can install cargo-nextest by running:

cargo install cargo-nextest

[!TIP]

Run Rust tests with make cargo-test, which uses cargo-nextest with an efficient profile.

Contributing

Thank you for considering a contribution to NautilusTrader. We welcome high-quality work that improves the project. Before starting a substantial change, open an issue to discuss the problem and approach with the team. Small, self-contained fixes do not require prior agreement.

Before getting started, be sure to review the open-source scope outlined in the project's roadmap to understand what's in and out of scope.

Once you're ready to start working on your contribution, make sure to follow the guidelines outlined in the CONTRIBUTING.md file. This includes signing a Contributor License Agreement (CLA) to ensure that your contributions can be included in the project.

[!NOTE]

Pull requests should target the develop branch (the default branch). This is where new features and improvements are integrated before release.

Thank you again for your interest in NautilusTrader! We look forward to reviewing your contributions and working with you to improve the project.

Community

Join our community of users and contributors on Discord to chat and stay up-to-date with the latest announcements and features of NautilusTrader. Whether you're a developer looking to contribute or just want to learn more about the platform, all are welcome on our Discord server.

Features and integrations excluded by the open-source scope are also out of scope for discussion across official NautilusTrader channels, including GitHub and Discord. This includes "Show & Tell" posts about downstream implementations, even when no contribution is offered and no support or upstream inclusion is requested. Correctness and performance reports about the core trading engine remain welcome. Keep those reports focused on the core behavior.

[!WARNING]

NautilusTrader does not issue, promote, or endorse any cryptocurrency tokens. Any claims or communications suggesting otherwise are unauthorized and false.

All official updates and communications from NautilusTrader will be shared exclusively through https://nautilustrader.io, our GitHub, our Discord server, or our verified X (Twitter) account: @NautilusTrader.

If you encounter any suspicious activity, please report it to the appropriate platform and contact us at [email protected].

License

The source code for NautilusTrader is available on GitHub under the GNU Lesser General Public License v3.0.

Python wheels and other builds with the hypersync feature include code from Envio's HyperSync SDK under MPL-2.0. Use the NautilusTrader source release that matches your build to obtain the modified source in crates/adapters/blockchain/src/hypersync/types.rs and the license in crates/adapters/blockchain/licenses/.

Contributions to the project are welcome and require the completion of a standard Contributor License Agreement (CLA).


NautilusTrader™ is developed and maintained by Nautech Systems, a technology company specializing in the development of high-performance trading systems. For more information, visit https://nautilustrader.io.

Use of this software is subject to the Disclaimer.

© 2015-2026 Nautech Systems Pty Ltd. All rights reserved.

nautechsystems Ferris

nautilus_trader (nautechsystems/nautilus_trader)

正在搜索数据库…

这是什么?一个生产级的算法交易引擎:核心是 Rust 原生的事件驱动内核,由 Python 来驱动。回测和实盘交易共用同一套架构和执行语义,所以策略从研究到上线不需要重写。
它是一个 Python 库,还是引擎其实用 Rust 写的?两者合一:核心运行时是原生 Rust,通过 PyO3 绑定暴露给 Python。你用 Python 3.12-3.14 写策略,而事件驱动的执行部分在 Rust 里原生运行。
我需要懂 Rust 或者安装 Rust 工具链吗?正常使用不需要:预编译的 wheel 不需要 Rust 工具链,你全程用 Python 就行。只有从源码构建各个 crate 时才涉及 Rust,此时 MSRV 跟随最新的 Rust 稳定版。
现在就敢接真金白银用吗?还不行:v2 目前以候选版本(2.0.0rcN)发布,并不打算用于生产环境,比如用真金白银做实盘交易。v1 只接收关键安全补丁的向后移植,而且版本之间仍可能出现破坏性改动。
它是面向大型交易机构还是个人?面向做单机回测和实盘交易的个人及小型量化团队。图形化仪表盘、分布式编排和内置的 AI/ML 工具都被刻意排除在范围之外。
我能在哪些操作系统上运行它?官方 wheel 覆盖 Linux(x86_64 和 ARM64)、macOS(ARM64)和 Windows(x86_64),每个都支持 Python 3.12-3.14。
它能连接哪些交易所和券商?适配器覆盖 Binance、Bybit、Coinbase、Kraken、OKX、BitMEX、Deribit 等加密货币交易所,dYdX、Hyperliquid、Derive 等 DEX,多市场经纪商 Interactive Brokers,体育博彩平台 Betfair,预测市场 Polymarket,还有提供行情数据的 Databento 和 Tardis。
它为什么叫 NautilusTrader?Nautilus 源自古希腊语,意思是“水手”,来自“naus”(船)。鹦鹉螺外壳上沿对数螺旋生长的 modular 隔室,启发了这个项目的设计与架构美学。
Soundness Pledge 是什么?一份公开承诺,表明项目力求不出现正确性(soundness)方面的 bug:开发者会尽最大努力避免这类问题,并欢迎大家一起分析和修复。
它的价格和金额类型精度有多高?有两种模式:高精度 128 位数值,精度最多 16 位小数;标准 64 位数值,精度最多 9 位小数。官方 Python wheel 默认用高精度;纯 Rust crate 默认用标准精度,除非你启用 high-precision 特性。
大小
325.5 MB
星标
31.9K
时长
8年
提交 · 90 天