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//! The official Interactive Brokers TWS API reference can be found at
24//! <https://ibkrcampus.com/campus/ibkr-api-page/twsapi-doc/>.
25//!
26//! # NautilusTrader
27//!
28//! [NautilusTrader](https://nautilustrader.io) is an open-source, production-grade, Rust-native trading engine
29//! with a deterministic, event-driven architecture for multi-asset, multi-venue systems.
30//!
31//! The system spans research, simulation, and live execution, providing research-to-live semantic parity.
32//!
33//! # Feature Flags
34//!
35//! Feature flags control code inclusion for Rust builds and Python bindings:
36//!
37//! - `examples`: Enables the crate's example binaries.
38//! - `execution` (default): Enables order execution and networking support.
39//! - `extension-module`: Builds the crate as a Python extension module. This is the feature used by
40//! the `nautilus_trader` package and includes `python` and `gateway`.
41//! - `gateway`: Enables the Dockerized IB Gateway manager via
42//! [`bollard`](https://crates.io/crates/bollard), including its PyO3 bindings when combined with
43//! `python`.
44//! - `python`: Enables [PyO3](https://pyo3.rs) bindings for configs, enums, the historical
45//! client, and the instrument provider.
46//!
47//! # Documentation
48//!
49//! - [Integration guide](https://nautilustrader.io/docs/nightly/integrations/interactive_brokers/)
50//! - [Rust examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/crates/adapters/interactive_brokers/examples)
51//! - [Python examples](https://github.com/nautechsystems/nautilus_trader/tree/develop/examples/live/interactive_brokers)
52
53#![warn(rustc::all)]
54#![deny(unsafe_code)]
55// Clippy: allow style lints that would require large refactors across the adapter
56#![allow(
57 clippy::collapsible_if,
58 clippy::if_not_else,
59 clippy::uninlined_format_args,
60 clippy::map_unwrap_or,
61 clippy::redundant_clone,
62 clippy::ignored_unit_patterns,
63 clippy::items_after_statements,
64 clippy::bool_to_int_with_if,
65 clippy::cloned_instead_of_copied,
66 clippy::option_if_let_else,
67 clippy::type_complexity,
68 clippy::module_inception,
69 clippy::result_large_err,
70 clippy::implicit_clone,
71 clippy::single_char_pattern,
72 clippy::bind_instead_of_map,
73 clippy::explicit_iter_loop,
74 clippy::too_many_arguments,
75 clippy::missing_errors_doc,
76 clippy::doc_overindented_list_items,
77 clippy::needless_borrows_for_generic_args
78)]
79#![deny(nonstandard_style)]
80#![deny(missing_debug_implementations)]
81#![deny(clippy::missing_panics_doc)]
82#![deny(rustdoc::broken_intra_doc_links)]
83// pyo3's `from_py_object` generates `.clone()` on `Copy` fields that clippy flags from the
84// macro expansion; an item-level `allow` cannot reach the expansion
85#![allow(clippy::clone_on_copy)]
86
87pub mod common;
88pub mod config;
89pub mod data;
90pub mod data_types;
91pub mod execution;
92pub mod factories;
93pub mod gateway;
94pub mod historical;
95pub mod providers;
96
97#[cfg(feature = "python")]
98pub mod python;
99
100#[cfg(test)]
101mod stubs;