Skip to main content

oanda_v20_openapi/models/
dynamic_order_state.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/// DynamicOrderState : The dynamic state of an Order. This is only relevant to TrailingStopLoss Orders, as no other Order type has dynamic state.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DynamicOrderState {
17    /// The Order's ID.
18    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
19    pub id: Option<i32>,
20    /// The Order's calculated trailing stop value.
21    #[serde(rename = "trailingStopValue", skip_serializing_if = "Option::is_none")]
22    pub trailing_stop_value: Option<f64>,
23    /// The distance between the Trailing Stop Loss Order's trailingStopValue and the current Market Price. This represents the distance (in price units) of the Order from a triggering price. If the distance could not be determined, this value will not be set.
24    #[serde(rename = "triggerDistance", skip_serializing_if = "Option::is_none")]
25    pub trigger_distance: Option<f64>,
26    /// True if an exact trigger distance could be calculated. If false, it means the provided trigger distance is a best estimate. If the distance could not be determined, this value will not be set.
27    #[serde(rename = "isTriggerDistanceExact", skip_serializing_if = "Option::is_none")]
28    pub is_trigger_distance_exact: Option<bool>,
29}
30
31impl DynamicOrderState {
32    /// The dynamic state of an Order. This is only relevant to TrailingStopLoss Orders, as no other Order type has dynamic state.
33    pub fn new() -> DynamicOrderState {
34        DynamicOrderState {
35            id: None,
36            trailing_stop_value: None,
37            trigger_distance: None,
38            is_trigger_distance_exact: None,
39        }
40    }
41}
42