nomy-data-models 0.35.9

Data model definitions for Nomy wallet analysis data processing
Documentation
#![allow(clippy::too_many_arguments, unused_imports, non_camel_case_types)]
//! TradeDirection enum definition.
//!
//! This file is generated automatically from the Python enum.
//! Do not edit this file manually.

use serde::{Deserialize, Serialize};

/// Enum for trade direction.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TradeDirection {
    #[serde(rename = "open_long")]
    OPEN_LONG,
    #[serde(rename = "open_short")]
    OPEN_SHORT,
    #[serde(rename = "close_long")]
    CLOSE_LONG,
    #[serde(rename = "close_short")]
    CLOSE_SHORT,
    #[serde(rename = "long_to_short")]
    LONG_TO_SHORT,
    #[serde(rename = "short_to_long")]
    SHORT_TO_LONG,
}

impl TradeDirection {
    /// Convert to string representation.
    pub fn as_str(&self) -> &'static str {
        match self {
            TradeDirection::OPEN_LONG => "open_long",
            TradeDirection::OPEN_SHORT => "open_short",
            TradeDirection::CLOSE_LONG => "close_long",
            TradeDirection::CLOSE_SHORT => "close_short",
            TradeDirection::LONG_TO_SHORT => "long_to_short",
            TradeDirection::SHORT_TO_LONG => "short_to_long",
        }
    }
}