nautilus_kraken/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
18use pyo3::prelude::*;
19
20use crate::{
21    common::enums::{
22        KrakenAssetClass, KrakenEnvironment, KrakenOrderSide, KrakenOrderStatus, KrakenOrderType,
23        KrakenPairStatus, KrakenPositionSide, KrakenProductType, KrakenSystemStatus,
24        KrakenTimeInForce,
25    },
26    http::client::KrakenHttpClient,
27    websocket::{
28        client::KrakenWebSocketClient,
29        enums::{KrakenWsChannel, KrakenWsMessageType, KrakenWsMethod},
30    },
31};
32
33pub mod enums;
34pub mod http;
35pub mod urls;
36pub mod websocket;
37
38#[pymodule]
39pub fn kraken(m: &Bound<'_, PyModule>) -> PyResult<()> {
40    m.add_class::<KrakenEnvironment>()?;
41    m.add_class::<KrakenProductType>()?;
42    m.add_class::<KrakenOrderType>()?;
43    m.add_class::<KrakenOrderSide>()?;
44    m.add_class::<KrakenTimeInForce>()?;
45    m.add_class::<KrakenOrderStatus>()?;
46    m.add_class::<KrakenPositionSide>()?;
47    m.add_class::<KrakenPairStatus>()?;
48    m.add_class::<KrakenSystemStatus>()?;
49    m.add_class::<KrakenAssetClass>()?;
50    m.add_class::<KrakenWsMethod>()?;
51    m.add_class::<KrakenWsChannel>()?;
52    m.add_class::<KrakenWsMessageType>()?;
53
54    m.add_class::<KrakenHttpClient>()?;
55    m.add_class::<KrakenWebSocketClient>()?;
56
57    m.add_function(wrap_pyfunction!(urls::py_get_http_base_url, m)?)?;
58    m.add_function(wrap_pyfunction!(urls::py_get_ws_public_url, m)?)?;
59    m.add_function(wrap_pyfunction!(urls::py_get_ws_private_url, m)?)?;
60
61    Ok(())
62}