nautilus_serialization/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 arrow;
19
20use pyo3::prelude::*;
21
22/// Loaded as nautilus_pyo3.serialization
23///
24/// # Errors
25///
26/// Returns a `PyErr` if registering any module components fails.
27#[pymodule]
28pub fn serialization(_: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
29    m.add_function(wrap_pyfunction!(
30        crate::python::arrow::get_arrow_schema_map,
31        m
32    )?)?;
33    m.add_function(wrap_pyfunction!(
34        crate::python::arrow::pyobjects_to_arrow_record_batch_bytes,
35        m
36    )?)?;
37    m.add_function(wrap_pyfunction!(
38        crate::python::arrow::py_order_book_deltas_to_arrow_record_batch_bytes,
39        m
40    )?)?;
41    m.add_function(wrap_pyfunction!(
42        crate::python::arrow::py_order_book_depth10_to_arrow_record_batch_bytes,
43        m
44    )?)?;
45    m.add_function(wrap_pyfunction!(
46        crate::python::arrow::py_quote_ticks_to_arrow_record_batch_bytes,
47        m
48    )?)?;
49    m.add_function(wrap_pyfunction!(
50        crate::python::arrow::py_trade_ticks_to_arrow_record_batch_bytes,
51        m
52    )?)?;
53    m.add_function(wrap_pyfunction!(
54        crate::python::arrow::py_bars_to_arrow_record_batch_bytes,
55        m
56    )?)?;
57    Ok(())
58}