Skip to main content

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//! - `examples`: Enables the crate's example binaries.
37//! - `execution` (default): Enables order execution and networking support.
38//! - `extension-module`: Builds the crate as a Python extension module. This is the feature used by
39//!   the `nautilus_trader` package and includes `python` and `gateway`.
40//! - `gateway`: Enables the Dockerized IB Gateway manager via
41//!   [`bollard`](https://crates.io/crates/bollard), including its PyO3 bindings when combined with
42//!   `python`.
43//! - `python`: Enables [PyO3](https://pyo3.rs) bindings for configs, enums, the historical
44//!   client, and the instrument provider.
45
46#![warn(rustc::all)]
47#![deny(unsafe_code)]
48// Clippy: allow style lints that would require large refactors across the adapter
49#![allow(
50    clippy::collapsible_if,
51    clippy::if_not_else,
52    clippy::uninlined_format_args,
53    clippy::map_unwrap_or,
54    clippy::redundant_clone,
55    clippy::ignored_unit_patterns,
56    clippy::items_after_statements,
57    clippy::bool_to_int_with_if,
58    clippy::cloned_instead_of_copied,
59    clippy::option_if_let_else,
60    clippy::type_complexity,
61    clippy::module_inception,
62    clippy::result_large_err,
63    clippy::implicit_clone,
64    clippy::single_char_pattern,
65    clippy::bind_instead_of_map,
66    clippy::explicit_iter_loop,
67    clippy::too_many_arguments,
68    clippy::missing_errors_doc,
69    clippy::doc_overindented_list_items,
70    clippy::needless_borrows_for_generic_args
71)]
72#![deny(nonstandard_style)]
73#![deny(missing_debug_implementations)]
74#![deny(clippy::missing_panics_doc)]
75#![deny(rustdoc::broken_intra_doc_links)]
76// pyo3's `from_py_object` generates `.clone()` on `Copy` fields that clippy flags from the
77// macro expansion; an item-level `allow` cannot reach the expansion
78#![allow(clippy::clone_on_copy)]
79
80pub mod common;
81pub mod config;
82pub mod data;
83pub mod error;
84pub mod execution;
85pub mod factories;
86pub mod gateway;
87pub mod historical;
88pub mod providers;
89
90#[cfg(feature = "python")]
91pub mod python;