nautilus_kraken/common/
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 that model Kraken string/int enums across HTTP and WebSocket payloads.
17
18use serde::{Deserialize, Serialize};
19use strum::{AsRefStr, Display, EnumString, FromRepr};
20
21#[derive(
22    Clone,
23    Copy,
24    Debug,
25    Default,
26    Display,
27    AsRefStr,
28    EnumString,
29    FromRepr,
30    PartialEq,
31    Eq,
32    Hash,
33    Serialize,
34    Deserialize,
35)]
36#[cfg_attr(
37    feature = "python",
38    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
39)]
40#[serde(rename_all = "lowercase")]
41#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
42pub enum KrakenEnvironment {
43    #[default]
44    Mainnet,
45    Testnet,
46}
47
48#[derive(
49    Clone,
50    Copy,
51    Debug,
52    Default,
53    Display,
54    AsRefStr,
55    EnumString,
56    FromRepr,
57    PartialEq,
58    Eq,
59    Hash,
60    Serialize,
61    Deserialize,
62)]
63#[cfg_attr(
64    feature = "python",
65    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
66)]
67#[serde(rename_all = "lowercase")]
68#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
69pub enum KrakenProductType {
70    #[default]
71    Spot,
72    Futures,
73}
74
75#[derive(
76    Clone,
77    Copy,
78    Debug,
79    Display,
80    AsRefStr,
81    EnumString,
82    FromRepr,
83    PartialEq,
84    Eq,
85    Hash,
86    Serialize,
87    Deserialize,
88)]
89#[cfg_attr(
90    feature = "python",
91    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
92)]
93#[serde(rename_all = "lowercase")]
94#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
95pub enum KrakenOrderType {
96    Market,
97    Limit,
98    #[serde(rename = "stop-loss")]
99    #[strum(serialize = "stop-loss")]
100    StopLoss,
101    #[serde(rename = "take-profit")]
102    #[strum(serialize = "take-profit")]
103    TakeProfit,
104    #[serde(rename = "stop-loss-limit")]
105    #[strum(serialize = "stop-loss-limit")]
106    StopLossLimit,
107    #[serde(rename = "take-profit-limit")]
108    #[strum(serialize = "take-profit-limit")]
109    TakeProfitLimit,
110    #[serde(rename = "settle-position")]
111    #[strum(serialize = "settle-position")]
112    SettlePosition,
113}
114
115#[derive(
116    Clone,
117    Copy,
118    Debug,
119    Display,
120    AsRefStr,
121    EnumString,
122    FromRepr,
123    PartialEq,
124    Eq,
125    Hash,
126    Serialize,
127    Deserialize,
128)]
129#[cfg_attr(
130    feature = "python",
131    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
132)]
133#[serde(rename_all = "lowercase")]
134#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
135pub enum KrakenOrderSide {
136    Buy,
137    Sell,
138}
139
140#[derive(
141    Clone,
142    Copy,
143    Debug,
144    Display,
145    AsRefStr,
146    EnumString,
147    FromRepr,
148    PartialEq,
149    Eq,
150    Hash,
151    Serialize,
152    Deserialize,
153)]
154#[cfg_attr(
155    feature = "python",
156    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
157)]
158#[serde(rename_all = "UPPERCASE")]
159#[strum(ascii_case_insensitive, serialize_all = "UPPERCASE")]
160pub enum KrakenTimeInForce {
161    #[serde(rename = "GTC")]
162    #[strum(serialize = "GTC")]
163    GoodTilCancelled,
164    #[serde(rename = "IOC")]
165    #[strum(serialize = "IOC")]
166    ImmediateOrCancel,
167    #[serde(rename = "GTD")]
168    #[strum(serialize = "GTD")]
169    GoodTilDate,
170}
171
172#[derive(
173    Clone,
174    Copy,
175    Debug,
176    Display,
177    AsRefStr,
178    EnumString,
179    FromRepr,
180    PartialEq,
181    Eq,
182    Hash,
183    Serialize,
184    Deserialize,
185)]
186#[cfg_attr(
187    feature = "python",
188    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
189)]
190#[serde(rename_all = "lowercase")]
191#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
192pub enum KrakenOrderStatus {
193    Pending,
194    Open,
195    Closed,
196    Canceled,
197    Expired,
198}
199
200#[derive(
201    Clone,
202    Copy,
203    Debug,
204    Display,
205    AsRefStr,
206    EnumString,
207    FromRepr,
208    PartialEq,
209    Eq,
210    Hash,
211    Serialize,
212    Deserialize,
213)]
214#[cfg_attr(
215    feature = "python",
216    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
217)]
218#[serde(rename_all = "lowercase")]
219#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
220pub enum KrakenPositionSide {
221    Long,
222    Short,
223}
224
225#[derive(
226    Clone,
227    Copy,
228    Debug,
229    Display,
230    AsRefStr,
231    EnumString,
232    FromRepr,
233    PartialEq,
234    Eq,
235    Hash,
236    Serialize,
237    Deserialize,
238)]
239#[cfg_attr(
240    feature = "python",
241    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
242)]
243#[serde(rename_all = "snake_case")]
244#[strum(ascii_case_insensitive, serialize_all = "snake_case")]
245pub enum KrakenPairStatus {
246    Online,
247    #[serde(rename = "cancel_only")]
248    #[strum(serialize = "cancel_only")]
249    CancelOnly,
250    #[serde(rename = "post_only")]
251    #[strum(serialize = "post_only")]
252    PostOnly,
253    #[serde(rename = "limit_only")]
254    #[strum(serialize = "limit_only")]
255    LimitOnly,
256    #[serde(rename = "reduce_only")]
257    #[strum(serialize = "reduce_only")]
258    ReduceOnly,
259}
260
261#[derive(
262    Clone,
263    Copy,
264    Debug,
265    Display,
266    AsRefStr,
267    EnumString,
268    FromRepr,
269    PartialEq,
270    Eq,
271    Hash,
272    Serialize,
273    Deserialize,
274)]
275#[cfg_attr(
276    feature = "python",
277    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
278)]
279#[serde(rename_all = "lowercase")]
280#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
281pub enum KrakenSystemStatus {
282    Online,
283    Maintenance,
284    #[serde(rename = "cancel_only")]
285    #[strum(serialize = "cancel_only")]
286    CancelOnly,
287    #[serde(rename = "post_only")]
288    #[strum(serialize = "post_only")]
289    PostOnly,
290}
291
292#[derive(
293    Clone,
294    Copy,
295    Debug,
296    Display,
297    AsRefStr,
298    EnumString,
299    FromRepr,
300    PartialEq,
301    Eq,
302    Hash,
303    Serialize,
304    Deserialize,
305)]
306#[cfg_attr(
307    feature = "python",
308    pyo3::pyclass(module = "nautilus_trader.core.nautilus_pyo3.kraken", eq, eq_int)
309)]
310#[serde(rename_all = "lowercase")]
311#[strum(ascii_case_insensitive, serialize_all = "lowercase")]
312pub enum KrakenAssetClass {
313    Currency,
314}