oanda-v20-openapi 0.2.1

The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
Documentation
/*
 * OANDA v20 API
 *
 * The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
 *
 * The version of the OpenAPI document: 0.2.1
 * Contact: jmicoud02@gmail.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// MarketOrderReason : The reason that the Market Order was created
/// The reason that the Market Order was created
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum MarketOrderReason {
    #[serde(rename = "CLIENT_ORDER")]
    ClientOrder,
    #[serde(rename = "TRADE_CLOSE")]
    TradeClose,
    #[serde(rename = "POSITION_CLOSEOUT")]
    PositionCloseout,
    #[serde(rename = "MARGIN_CLOSEOUT")]
    MarginCloseout,
    #[serde(rename = "DELAYED_TRADE_CLOSE")]
    DelayedTradeClose,

}

impl std::fmt::Display for MarketOrderReason {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Self::ClientOrder => write!(f, "CLIENT_ORDER"),
            Self::TradeClose => write!(f, "TRADE_CLOSE"),
            Self::PositionCloseout => write!(f, "POSITION_CLOSEOUT"),
            Self::MarginCloseout => write!(f, "MARGIN_CLOSEOUT"),
            Self::DelayedTradeClose => write!(f, "DELAYED_TRADE_CLOSE"),
        }
    }
}

impl Default for MarketOrderReason {
    fn default() -> MarketOrderReason {
        Self::ClientOrder
    }
}