Skip to main content

nautilus_interactive_brokers/python/
mod.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//! Python bindings from `pyo3`.
17
18pub mod config;
19pub mod conversion;
20
21#[cfg(feature = "python")]
22pub mod data;
23
24#[cfg(feature = "python")]
25pub mod execution;
26
27#[cfg(feature = "gateway")]
28#[cfg(feature = "python")]
29pub mod gateway;
30
31#[cfg(feature = "python")]
32pub mod historical;
33
34#[cfg(feature = "python")]
35pub mod providers;
36
37use pyo3::prelude::*;
38
39/// Loaded as `nautilus_pyo3.interactive_brokers`.
40///
41/// # Errors
42///
43/// Returns an error if any bindings fail to register with the Python module.
44#[pymodule]
45#[allow(unused_variables)]
46pub fn interactive_brokers(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
47    m.add_class::<crate::config::MarketDataType>()?;
48    m.add_class::<crate::config::InteractiveBrokersDataClientConfig>()?;
49    m.add_class::<crate::config::InteractiveBrokersExecClientConfig>()?;
50    m.add_class::<crate::config::InteractiveBrokersInstrumentProviderConfig>()?;
51    m.add_class::<crate::config::DockerizedIBGatewayConfig>()?;
52    m.add_class::<crate::config::TradingMode>()?;
53    m.add_class::<crate::data::InteractiveBrokersDataClient>()?;
54    m.add_class::<crate::execution::InteractiveBrokersExecutionClient>()?;
55    m.add_class::<crate::historical::HistoricalInteractiveBrokersClient>()?;
56    m.add_class::<crate::providers::instruments::InteractiveBrokersInstrumentProvider>()?;
57
58    #[cfg(feature = "gateway")]
59    {
60        m.add_class::<crate::gateway::dockerized::ContainerStatus>()?;
61        m.add_class::<crate::gateway::dockerized::DockerizedIBGateway>()?;
62    }
63
64    Ok(())
65}