nautilus_tardis/python/
mod.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2025 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 csv;
20pub mod enums;
21pub mod http;
22pub mod machine;
23
24use pyo3::prelude::*;
25
26/// Loaded as nautilus_pyo3.tardis
27///
28/// # Errors
29///
30/// Returns a `PyErr` if registering any module components fails.
31#[pymodule]
32pub fn tardis(_: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
33    m.add_class::<super::machine::types::InstrumentMiniInfo>()?;
34    m.add_class::<super::machine::types::ReplayNormalizedRequestOptions>()?;
35    m.add_class::<super::machine::types::StreamNormalizedRequestOptions>()?;
36    m.add_class::<super::machine::TardisMachineClient>()?;
37    m.add_class::<super::http::client::TardisHttpClient>()?;
38    m.add_function(wrap_pyfunction!(
39        enums::py_tardis_exchange_from_venue_str,
40        m
41    )?)?;
42    m.add_function(wrap_pyfunction!(
43        config::py_bar_spec_to_tardis_trade_bar_string,
44        m
45    )?)?;
46    m.add_function(wrap_pyfunction!(machine::py_run_tardis_machine_replay, m)?)?;
47    m.add_function(wrap_pyfunction!(csv::py_load_tardis_deltas, m)?)?;
48    m.add_function(wrap_pyfunction!(
49        csv::py_load_tardis_depth10_from_snapshot5,
50        m
51    )?)?;
52    m.add_function(wrap_pyfunction!(
53        csv::py_load_tardis_depth10_from_snapshot25,
54        m
55    )?)?;
56    m.add_function(wrap_pyfunction!(csv::py_load_tardis_quotes, m)?)?;
57    m.add_function(wrap_pyfunction!(csv::py_load_tardis_trades, m)?)?;
58
59    Ok(())
60}