Skip to main content

nomy_data_models/enums/
trade_direction.rs

1#![allow(clippy::too_many_arguments, unused_imports, non_camel_case_types)]
2//! TradeDirection enum definition.
3//!
4//! This file is generated automatically from the Python enum.
5//! Do not edit this file manually.
6
7use serde::{Deserialize, Serialize};
8
9/// Enum for trade direction.
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
11pub enum TradeDirection {
12    #[serde(rename = "open_long")]
13    OPEN_LONG,
14    #[serde(rename = "open_short")]
15    OPEN_SHORT,
16    #[serde(rename = "close_long")]
17    CLOSE_LONG,
18    #[serde(rename = "close_short")]
19    CLOSE_SHORT,
20    #[serde(rename = "long_to_short")]
21    LONG_TO_SHORT,
22    #[serde(rename = "short_to_long")]
23    SHORT_TO_LONG,
24}
25
26impl TradeDirection {
27    /// Convert to string representation.
28    pub fn as_str(&self) -> &'static str {
29        match self {
30            TradeDirection::OPEN_LONG => "open_long",
31            TradeDirection::OPEN_SHORT => "open_short",
32            TradeDirection::CLOSE_LONG => "close_long",
33            TradeDirection::CLOSE_SHORT => "close_short",
34            TradeDirection::LONG_TO_SHORT => "long_to_short",
35            TradeDirection::SHORT_TO_LONG => "short_to_long",
36        }
37    }
38}