Skip to main content

nautilus_bitmex/
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 [BitMEX](https://bitmex.com) cryptocurrency exchange.
17//!
18//! The `nautilus-bitmex` crate provides client bindings (HTTP & WebSocket), data
19//! models and helper utilities that wrap the official **BitMEX API**.
20//!
21//! The official BitMEX API reference can be found at <https://www.bitmex.com/app/apiOverview>.
22//! All public links inside this crate reference the official documentation.
23//!
24//! # NautilusTrader
25//!
26//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native
27//! engine for multi-asset, multi-venue trading systems.
28//!
29//! The system spans research, deterministic simulation, and live execution within a single
30//! event-driven architecture, providing research-to-live semantic parity.
31//!
32//! # Feature Flags
33//!
34//! This crate provides feature flags to control source code inclusion during compilation,
35//! depending on the intended use case, i.e. whether to provide Python bindings
36//! for the [nautilus_trader](https://pypi.org/project/nautilus_trader) Python package,
37//! or as part of a Rust only build.
38//!
39//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
40//! - `extension-module`: Builds as a Python extension module.
41//!
42//! [High-precision mode](https://nautilustrader.io/docs/nightly/getting_started/installation#precision-mode) (128-bit value types) is enabled by default.
43
44#![warn(rustc::all)]
45#![deny(unsafe_code)]
46#![deny(nonstandard_style)]
47#![deny(missing_debug_implementations)]
48#![deny(clippy::missing_errors_doc)]
49#![deny(clippy::missing_panics_doc)]
50#![deny(rustdoc::broken_intra_doc_links)]
51
52pub mod broadcast;
53pub mod common;
54pub mod config;
55pub mod data;
56pub mod execution;
57pub mod factories;
58pub mod http;
59pub mod websocket;
60
61#[cfg(feature = "python")]
62pub mod python;
63
64// Re-exports
65pub use crate::{
66    broadcast::{
67        canceller::{BroadcasterMetrics, CancelBroadcaster, CancelBroadcasterConfig, ClientStats},
68        submitter::{SubmitBroadcaster, SubmitBroadcasterConfig},
69    },
70    common::{consts::BITMEX_VENUE, enums::BitmexSide},
71    data::BitmexDataClient,
72    execution::BitmexExecutionClient,
73    factories::{BitmexDataClientFactory, BitmexExecFactoryConfig, BitmexExecutionClientFactory},
74    http::{client::BitmexHttpClient, error::BitmexHttpError},
75    websocket::{client::BitmexWebSocketClient, error::BitmexWsError},
76};