nomy_data_models/enums/
trade_direction.rs1#![allow(clippy::too_many_arguments, unused_imports, non_camel_case_types)]
2use serde::{Deserialize, Serialize};
8
9#[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 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}