Skip to main content

Crate nautilus_okx

Crate nautilus_okx 

Source
Expand description

NautilusTrader adapter for the OKX cryptocurrency exchange.

The nautilus-okx crate provides instrument loading, live market data, and order execution through the OKX v5 API. It includes typed HTTP and WebSocket clients and live-node factories for spot, derivatives, spreads, and event contracts.

All public links inside this crate reference the English version.

The official OKX API reference can be found at https://www.okx.com/docs-v5/en/.

§NautilusTrader

NautilusTrader is an open-source, production-grade, Rust-native trading engine with a deterministic, event-driven architecture for multi-asset, multi-venue systems.

The system spans research, simulation, and live execution, providing research-to-live semantic parity.

§Feature Flags

Feature flags control code inclusion for Rust builds and Python bindings:

  • examples: Enables the crate’s example binaries.
  • extension-module: Builds as a Python extension module.
  • high-precision (default): Enables high-precision mode to use 128-bit value types.
  • python: Enables Python bindings from PyO3.
  • simulation: Enables deterministic simulation testing with MadSim.

§Integrator Attribution

HTTP and WebSocket order submissions set tag to NautilusTrader’s fixed integration ID. Caller-provided tags are replaced.

§Documentation

Re-exports§

pub use crate::common::enums::OKXInstrumentType;
pub use crate::common::enums::OKXOrderType;
pub use crate::common::enums::OKXPositionMode;
pub use crate::common::enums::OKXPositionSide;
pub use crate::common::enums::OKXSide;
pub use crate::common::models::OKXInstrument;
pub use crate::data::OKXDataClient;
pub use crate::execution::OKXExecutionClient;
pub use crate::http::client::OKXHttpClient;
pub use crate::http::error::OKXHttpError;
pub use crate::websocket::client::OKXWebSocketClient;
pub use crate::websocket::error::OKXWsError;

Modules§

common
Common functionality shared across the OKX adapter.
config
Configuration structures for the OKX adapter.
data
Live market data client implementation for the OKX adapter.
execution
Live execution client implementation for the OKX adapter.
factories
Factory functions for creating OKX clients and components.
http
HTTP/REST client implementation for the OKX v5 API.
python
Python bindings from pyo3.
websocket
WebSocket client implementation for the OKX v5 API.