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

/// Position : The specification of a Position within an Account.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Position {
    #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")]
    pub instrument: Option<models::InstrumentName>,
    /// Profit/loss realized by the Position over the lifetime of the Account.
    #[serde(rename = "pl", skip_serializing_if = "Option::is_none")]
    pub pl: Option<f64>,
    /// The unrealized profit/loss of all open Trades that contribute to this Position.
    #[serde(rename = "unrealizedPL", skip_serializing_if = "Option::is_none")]
    pub unrealized_pl: Option<f64>,
    /// Margin currently used by the Position.
    #[serde(rename = "marginUsed", skip_serializing_if = "Option::is_none")]
    pub margin_used: Option<f64>,
    /// Profit/loss realized by the Position since the Account's resettablePL was last reset by the client.
    #[serde(rename = "resettablePL", skip_serializing_if = "Option::is_none")]
    pub resettable_pl: Option<f64>,
    /// The total amount of financing paid/collected for this instrument over the lifetime of the Account.
    #[serde(rename = "financing", skip_serializing_if = "Option::is_none")]
    pub financing: Option<f64>,
    /// The total amount of commission paid for this instrument over the lifetime of the Account.
    #[serde(rename = "commission", skip_serializing_if = "Option::is_none")]
    pub commission: Option<f64>,
    /// The total amount of fees charged over the lifetime of the Account for the execution of guaranteed Stop Loss Orders for this instrument.
    #[serde(rename = "guaranteedExecutionFees", skip_serializing_if = "Option::is_none")]
    pub guaranteed_execution_fees: Option<f64>,
    #[serde(rename = "long", skip_serializing_if = "Option::is_none")]
    pub long: Option<Box<models::PositionSide>>,
    #[serde(rename = "short", skip_serializing_if = "Option::is_none")]
    pub short: Option<Box<models::PositionSide>>,
}

impl Position {
    /// The specification of a Position within an Account.
    pub fn new() -> Position {
        Position {
            instrument: None,
            pl: None,
            unrealized_pl: None,
            margin_used: None,
            resettable_pl: None,
            financing: None,
            commission: None,
            guaranteed_execution_fees: None,
            long: None,
            short: None,
        }
    }
}