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};

/// DynamicOrderState : The dynamic state of an Order. This is only relevant to TrailingStopLoss Orders, as no other Order type has dynamic state.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DynamicOrderState {
    /// The Order's ID.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<i32>,
    /// The Order's calculated trailing stop value.
    #[serde(rename = "trailingStopValue", skip_serializing_if = "Option::is_none")]
    pub trailing_stop_value: Option<f64>,
    /// 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.
    #[serde(rename = "triggerDistance", skip_serializing_if = "Option::is_none")]
    pub trigger_distance: Option<f64>,
    /// 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.
    #[serde(rename = "isTriggerDistanceExact", skip_serializing_if = "Option::is_none")]
    pub is_trigger_distance_exact: Option<bool>,
}

impl DynamicOrderState {
    /// The dynamic state of an Order. This is only relevant to TrailingStopLoss Orders, as no other Order type has dynamic state.
    pub fn new() -> DynamicOrderState {
        DynamicOrderState {
            id: None,
            trailing_stop_value: None,
            trigger_distance: None,
            is_trigger_distance_exact: None,
        }
    }
}