Skip to main content

Crate nautilus_kalshi

Crate nautilus_kalshi 

Source
Expand description

NautilusTrader adapter for Kalshi, a regulated event contracts exchange.

The nautilus-kalshi crate provides instrument loading, live and historical market data, and order execution for binary event contracts through the Kalshi API v2. It includes typed HTTP and WebSocket clients, account and execution reconciliation, and live-node factories.

Execution recovery uses authoritative venue reports. Unknown write outcomes block further order commands until reconciliation resolves them. Direct client reconnects continue report collection while writes remain blocked; node startup waits for write readiness.

The official Kalshi API reference can be found at https://docs.kalshi.com/.

§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 book stress scenarios.
  • extension-module: Builds as a Python extension module.
  • fuzz: Enables libFuzzer integration for fuzz targets.
  • high-precision (default): Enables high-precision mode to use 128-bit value types.
  • python: Enables Python bindings from PyO3.
  • simulation: Routes HTTP through deterministic network seams with cfg(madsim). Simulation supports plaintext local HTTP peers; TLS and proxies remain native-only.

§Documentation

Modules§

book
Order-book synchronization for selected Kalshi markets.
common
Types, constants, and parsing shared across HTTP and WebSocket layers.
config
Configuration structures for the Kalshi adapter.
data
Live Kalshi data client.
execution
Live Kalshi execution client.
factories
Factories for Kalshi data and execution clients.
http
HTTP client, request models, and parsers for Kalshi REST APIs.
providers
Instrument provider for the Kalshi adapter.
python
Python bindings from pyo3.
websocket
WebSocket client, messages, and parsers for Kalshi streaming APIs.