Skip to main content

nautilus_polymarket/
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 the [Polymarket](https://polymarket.com) prediction market.
17//!
18//! The `nautilus-polymarket` crate provides market data and order execution for binary outcome contracts
19//! through the Polymarket CLOB APIs. It includes market discovery, authenticated HTTP and WebSocket
20//! clients, order signing, and execution reconciliation, plus Deposit Wallet position operations
21//! through the Relayer API.
22//!
23//! The official Polymarket API reference can be found at <https://docs.polymarket.com/>.
24//!
25//! # NautilusTrader
26//!
27//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native trading engine
28//! with a deterministic, event-driven architecture for multi-asset, multi-venue systems.
29//!
30//! The system spans research, simulation, and live execution, providing research-to-live semantic parity.
31//!
32//! # Feature Flags
33//!
34//! Feature flags control code inclusion for Rust builds and Python bindings:
35//!
36//! - `allowances`: Enables the `polymarket-set-allowances` binary.
37//! - `examples`: Enables the crate's example binaries.
38//! - `extension-module`: Builds as a Python extension module.
39//! - `high-precision` (default): Enables
40//!   [high-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation/#precision-mode)
41//!   to use 128-bit value types.
42//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
43//!
44//! # Integrator Attribution
45//!
46//! Orders signed by the adapter carry the fixed NautilusTrader builder code with zero builder fees.
47//!
48//! See [attribution details](https://nautilustrader.io/docs/nightly/integrations/polymarket/#builder-code-attribution).
49//!
50//! # Documentation
51//!
52//! - [Integration guide](https://nautilustrader.io/docs/nightly/integrations/polymarket/)
53//! - [Rust examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/crates/adapters/polymarket/examples)
54//! - [Python examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/examples/live/polymarket)
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// pyo3's `from_py_object` generates `.clone()` on `Copy` fields that clippy flags from the
63// macro expansion; an item-level `allow` cannot reach the expansion
64#![allow(clippy::clone_on_copy)]
65
66pub mod common;
67pub mod config;
68pub mod data;
69pub mod data_types;
70pub mod execution;
71pub mod factories;
72pub mod filters;
73pub mod http;
74pub mod models;
75pub mod positions;
76pub mod providers;
77pub mod session;
78pub mod signing;
79pub mod websocket;
80
81mod book;
82mod polybolt;
83mod resolve;
84
85#[cfg(feature = "python")]
86pub mod python;