oanda_v20_openapi/models/trade_order_trigger_condition.rs
1/*
2 * OANDA v20 API
3 *
4 * The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
5 *
6 * The version of the OpenAPI document: 0.2.1
7 * Contact: jmicoud02@gmail.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// TradeOrderTriggerCondition : Specification of which price component should be used when determining if an Order should be triggered and filled. This allows Orders to be triggered based on the bid, ask, mid, default (ask for buy, bid for sell) or inverse (ask for sell, bid for buy) price depending on the desired behaviour. Orders are always filled using their default price component. A special restriction applies when creating a guaranteed Stop Loss Order. In this case the TriggerCondition value must either be \"DEFAULT\", or the \"natural\" trigger side \"DEFAULT\" results in. So for a Stop Loss Order for a long trade valid values are \"DEFAULT\" and \"BID\", and for short trades \"DEFAULT\" and \"ASK\" are valid.
15/// Specification of which price component should be used when determining if an Order should be triggered and filled. This allows Orders to be triggered based on the bid, ask, mid, default (ask for buy, bid for sell) or inverse (ask for sell, bid for buy) price depending on the desired behaviour. Orders are always filled using their default price component. A special restriction applies when creating a guaranteed Stop Loss Order. In this case the TriggerCondition value must either be \"DEFAULT\", or the \"natural\" trigger side \"DEFAULT\" results in. So for a Stop Loss Order for a long trade valid values are \"DEFAULT\" and \"BID\", and for short trades \"DEFAULT\" and \"ASK\" are valid.
16#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
17pub enum TradeOrderTriggerCondition {
18 #[serde(rename = "DEFAULT")]
19 Default,
20 #[serde(rename = "INVERSE")]
21 Inverse,
22 #[serde(rename = "BID")]
23 Bid,
24 #[serde(rename = "ASK")]
25 Ask,
26 #[serde(rename = "MID")]
27 Mid,
28
29}
30
31impl std::fmt::Display for TradeOrderTriggerCondition {
32 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
33 match self {
34 Self::Default => write!(f, "DEFAULT"),
35 Self::Inverse => write!(f, "INVERSE"),
36 Self::Bid => write!(f, "BID"),
37 Self::Ask => write!(f, "ASK"),
38 Self::Mid => write!(f, "MID"),
39 }
40 }
41}
42
43impl Default for TradeOrderTriggerCondition {
44 fn default() -> TradeOrderTriggerCondition {
45 Self::Default
46 }
47}
48