Skip to main content

nautilus_kalshi/
lib.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.
3//  https://nautechsystems.io
4//
5//  Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6//  You may not use this file except in compliance with the License.
7//  You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9//  Unless required by applicable law or agreed to in writing, software
10//  distributed under the License is distributed on an "AS IS" BASIS,
11//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//  See the License for the specific language governing permissions and
13//  limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! [NautilusTrader](https://nautilustrader.io) adapter for [Kalshi](https://kalshi.com), a regulated event contracts exchange.
17//!
18//! The `nautilus-kalshi` crate provides instrument loading, live and historical market data, and order execution
19//! for binary event contracts through the **Kalshi API v2**. It includes typed HTTP and WebSocket clients,
20//! account and execution reconciliation, and live-node factories.
21//!
22//! Execution recovery uses authoritative venue reports. Unknown write outcomes block further order commands until
23//! reconciliation resolves them. Direct client reconnects continue report collection while writes remain blocked;
24//! node startup waits for write readiness.
25//!
26//! The official Kalshi API reference can be found at <https://docs.kalshi.com/>.
27//!
28//! # NautilusTrader
29//!
30//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native trading engine
31//! with a deterministic, event-driven architecture for multi-asset, multi-venue systems.
32//!
33//! The system spans research, simulation, and live execution, providing research-to-live semantic parity.
34//!
35//! # Feature Flags
36//!
37//! Feature flags control code inclusion for Rust builds and Python bindings:
38//!
39//! - `examples`: Enables book stress scenarios.
40//! - `extension-module`: Builds as a Python extension module.
41//! - `fuzz`: Enables libFuzzer integration for fuzz targets.
42//! - `high-precision` (default): Enables
43//!   [high-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation/#precision-mode)
44//!   to use 128-bit value types.
45//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
46//! - `simulation`: Routes HTTP through deterministic network seams with `cfg(madsim)`.
47//!   Simulation supports plaintext local HTTP peers; TLS and proxies remain native-only.
48//!
49//! # Documentation
50//!
51//! - [Integration guide](https://nautilustrader.io/docs/nightly/integrations/kalshi/)
52//! - [Rust examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/crates/adapters/kalshi/examples)
53//! - [Python examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/examples/live/kalshi)
54//! - [Data and execution benchmarks](https://github.com/nautechsystems/nautilus_trader/tree/develop/crates/adapters/kalshi/benches/BENCHMARKS.md)
55
56#![warn(rustc::all)]
57#![deny(unsafe_code)]
58#![deny(nonstandard_style)]
59#![deny(missing_debug_implementations)]
60#![deny(clippy::missing_panics_doc)]
61#![deny(rustdoc::broken_intra_doc_links)]
62
63pub mod book;
64
65pub mod common;
66pub mod config;
67pub mod data;
68pub mod execution;
69pub mod factories;
70pub mod http;
71pub mod providers;
72pub mod websocket;
73
74#[cfg(feature = "python")]
75pub mod python;