nautilus_binance/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
17//! [Binance](https://www.binance.com) cryptocurrency exchange.
18//!
19//! The `nautilus-binance` crate provides client bindings (HTTP & WebSocket) and data
20//! models for the official **Binance API**. Live data and
21//! execution clients are available for:
22//!
23//! - Spot markets, including Binance US (api.binance.com)
24//! - USD-M Futures (fapi.binance.com)
25//! - COIN-M Futures (dapi.binance.com)
26//!
27//! The crate also includes shared enums, endpoint constants, URL routing, and
28//! credential plumbing for adjacent Binance surfaces such as Margin and European Options.
29//! Those surfaces do not have live data or execution clients in this crate.
30//! Portfolio Margin likewise has no live clients here, but its signed REST transport
31//! is available in [`papi`].
32//!
33//! The official Binance API reference can be found at <https://developers.binance.com/en/docs/>.
34//!
35//! # NautilusTrader
36//!
37//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native trading engine
38//! with a deterministic, event-driven architecture for multi-asset, multi-venue systems.
39//!
40//! The system spans research, simulation, and live execution, providing research-to-live semantic parity.
41//!
42//! # Feature Flags
43//!
44//! Feature flags control code inclusion for Rust builds and Python bindings:
45//!
46//! - `arrow`: Enables Apache Arrow data support.
47//! - `examples`: Enables the crate's example binaries.
48//! - `extension-module`: Builds as a Python extension module.
49//! - `high-precision` (default): Enables
50//! [high-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation/#precision-mode)
51//! to use 128-bit value types.
52//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
53//!
54//! # Integrator Attribution
55//!
56//! Spot and Futures execution clients and HTTP clients that build orders from Nautilus types encode
57//! supported client order IDs with NautilusTrader's Link and Trade integration prefix. Raw HTTP and
58//! WebSocket API trading clients preserve caller-supplied IDs.
59//!
60//! See [attribution details](https://nautilustrader.io/docs/nightly/integrations/binance/#link--trade).
61//!
62//! # Documentation
63//!
64//! - [Integration guide](https://nautilustrader.io/docs/nightly/integrations/binance/)
65//! - [Rust examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/crates/adapters/binance/examples)
66//! - [Python examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/examples/live/binance)
67
68#![warn(rustc::all)]
69#![deny(unsafe_code)]
70#![deny(nonstandard_style)]
71#![deny(missing_debug_implementations)]
72#![deny(clippy::missing_errors_doc)]
73#![deny(clippy::missing_panics_doc)]
74#![deny(rustdoc::broken_intra_doc_links)]
75// pyo3's `from_py_object` generates `.clone()` on `Copy` fields that clippy flags from the
76// macro expansion; an item-level `allow` cannot reach the expansion
77#![allow(clippy::clone_on_copy)]
78
79pub mod common;
80pub mod config;
81pub mod data_types;
82pub mod factories;
83pub mod futures;
84pub mod papi;
85pub mod spot;
86
87pub(crate) mod book;
88
89#[cfg(feature = "arrow")]
90pub mod arrow;
91
92#[cfg(feature = "python")]
93pub mod python;