nautilus_kraken/websocket/
enums.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//! Enumerations for Kraken WebSocket v2 API.
17
18use serde::{Deserialize, Serialize};
19use strum::{AsRefStr, Display, EnumString, FromRepr};
20
21#[derive(
22    Clone,
23    Copy,
24    Debug,
25    Display,
26    AsRefStr,
27    EnumString,
28    FromRepr,
29    PartialEq,
30    Eq,
31    Hash,
32    Serialize,
33    Deserialize,
34)]
35#[cfg_attr(
36    feature = "python",
37    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
38)]
39#[serde(rename_all = "lowercase")]
40#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
41pub enum KrakenWsMethod {
42    Subscribe,
43    Unsubscribe,
44    Ping,
45    Pong,
46}
47
48#[derive(
49    Clone,
50    Copy,
51    Debug,
52    Display,
53    AsRefStr,
54    EnumString,
55    FromRepr,
56    PartialEq,
57    Eq,
58    Hash,
59    Serialize,
60    Deserialize,
61)]
62#[cfg_attr(
63    feature = "python",
64    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
65)]
66#[serde(rename_all = "lowercase")]
67#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
68pub enum KrakenWsChannel {
69    Ticker,
70    #[serde(rename = "trade")]
71    #[strum(serialize = "trade")]
72    Trade,
73    #[serde(rename = "book")]
74    #[strum(serialize = "book")]
75    Book,
76    #[serde(rename = "ohlc")]
77    #[strum(serialize = "ohlc")]
78    Ohlc,
79    #[serde(rename = "spread")]
80    #[strum(serialize = "spread")]
81    Spread,
82    // Private channels
83    #[serde(rename = "executions")]
84    #[strum(serialize = "executions")]
85    Executions,
86    #[serde(rename = "balances")]
87    #[strum(serialize = "balances")]
88    Balances,
89}
90
91#[derive(
92    Clone,
93    Copy,
94    Debug,
95    Display,
96    AsRefStr,
97    EnumString,
98    FromRepr,
99    PartialEq,
100    Eq,
101    Hash,
102    Serialize,
103    Deserialize,
104)]
105#[cfg_attr(
106    feature = "python",
107    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
108)]
109#[serde(rename_all = "lowercase")]
110#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
111pub enum KrakenWsMessageType {
112    Heartbeat,
113    Status,
114    Subscribe,
115    Unsubscribe,
116    Update,
117    Snapshot,
118    Error,
119}