nautilus_interactive_brokers/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
17//! [Interactive Brokers](https://www.interactivebrokers.com).
18//!
19//! The `nautilus-interactive-brokers` crate wraps the [`ibapi`](https://crates.io/crates/ibapi)
20//! client and connects it to NautilusTrader's live data, execution, historical data, and
21//! instrument loading infrastructure.
22//!
23//! # NautilusTrader
24//!
25//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native
26//! engine for multi-asset, multi-venue trading systems.
27//!
28//! The system spans research, deterministic simulation, and live execution within a single
29//! event-driven architecture, providing research-to-live semantic parity.
30//!
31//! # Feature flags
32//!
33//! This crate provides feature flags to control source code inclusion during compilation,
34//! depending on the intended use case (Rust-only builds vs. Python bindings through PyO3).
35//!
36//! - `python`: Enables PyO3 bindings for configs, enums, the historical client, the instrument
37//! provider.
38//! - `gateway`: Enables the Dockerized IB Gateway helper via
39//! [`bollard`](https://crates.io/crates/bollard), including its PyO3 bindings when combined with
40//! `python`.
41//! - `extension-module`: Builds as a Python extension module (used together with `python` and `gateway`).
42//!
43//! # Documentation
44//!
45//! See <https://docs.rs/nautilus-interactive-brokers> for the latest API documentation.
46
47#![warn(rustc::all)]
48#![deny(unsafe_code)]
49// Clippy: allow style lints that would require large refactors across the adapter
50#![allow(
51 clippy::collapsible_if,
52 clippy::if_not_else,
53 clippy::uninlined_format_args,
54 clippy::map_unwrap_or,
55 clippy::redundant_clone,
56 clippy::ignored_unit_patterns,
57 clippy::items_after_statements,
58 clippy::bool_to_int_with_if,
59 clippy::cloned_instead_of_copied,
60 clippy::option_if_let_else,
61 clippy::type_complexity,
62 clippy::await_holding_lock,
63 clippy::module_inception,
64 clippy::result_large_err,
65 clippy::implicit_clone,
66 clippy::single_char_pattern,
67 clippy::bind_instead_of_map,
68 clippy::explicit_iter_loop,
69 clippy::too_many_arguments,
70 clippy::missing_errors_doc,
71 clippy::doc_overindented_list_items,
72 clippy::needless_borrows_for_generic_args
73)]
74#![deny(nonstandard_style)]
75#![deny(missing_debug_implementations)]
76#![deny(clippy::missing_panics_doc)]
77#![deny(rustdoc::broken_intra_doc_links)]
78// pyo3's `from_py_object` generates `.clone()` on `Copy` fields that clippy flags from the
79// macro expansion; an item-level `allow` cannot reach the expansion
80#![allow(clippy::clone_on_copy)]
81
82pub mod common;
83pub mod config;
84pub mod data;
85pub mod error;
86pub mod execution;
87pub mod factories;
88pub mod gateway;
89pub mod historical;
90pub mod providers;
91
92#[cfg(feature = "python")]
93pub mod python;