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

/// CalculatedPositionState : The dynamic (calculated) state of a Position
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CalculatedPositionState {
    #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")]
    pub instrument: Option<models::InstrumentName>,
    /// The Position's net unrealized profit/loss
    #[serde(rename = "netUnrealizedPL", skip_serializing_if = "Option::is_none")]
    pub net_unrealized_pl: Option<f64>,
    /// The unrealized profit/loss of the Position's long open Trades
    #[serde(rename = "longUnrealizedPL", skip_serializing_if = "Option::is_none")]
    pub long_unrealized_pl: Option<f64>,
    /// The unrealized profit/loss of the Position's short open Trades
    #[serde(rename = "shortUnrealizedPL", skip_serializing_if = "Option::is_none")]
    pub short_unrealized_pl: Option<f64>,
    /// Margin currently used by the Position.
    #[serde(rename = "marginUsed", skip_serializing_if = "Option::is_none")]
    pub margin_used: Option<f64>,
}

impl CalculatedPositionState {
    /// The dynamic (calculated) state of a Position
    pub fn new() -> CalculatedPositionState {
        CalculatedPositionState {
            instrument: None,
            net_unrealized_pl: None,
            long_unrealized_pl: None,
            short_unrealized_pl: None,
            margin_used: None,
        }
    }
}