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

/// PositionSide : The representation of a Position for a single direction (long or short).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PositionSide {
    /// Number of units in the position (negative value indicates short position, positive indicates long position).
    #[serde(rename = "units", skip_serializing_if = "Option::is_none")]
    pub units: Option<f64>,
    /// Volume-weighted average of the underlying Trade open prices for the Position.
    #[serde(rename = "averagePrice", skip_serializing_if = "Option::is_none")]
    pub average_price: Option<f64>,
    /// List of the open Trade IDs which contribute to the open Position.
    #[serde(rename = "tradeIDs", skip_serializing_if = "Option::is_none")]
    pub trade_ids: Option<Vec<i32>>,
    /// Profit/loss realized by the PositionSide 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 PositionSide.
    #[serde(rename = "unrealizedPL", skip_serializing_if = "Option::is_none")]
    pub unrealized_pl: Option<f64>,
    /// Profit/loss realized by the PositionSide 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 PositionSide over the lifetime of the Account.
    #[serde(rename = "financing", skip_serializing_if = "Option::is_none")]
    pub financing: Option<f64>,
    /// The total amount of fees charged over the lifetime of the Account for the execution of guaranteed Stop Loss Orders attached to Trades for this PositionSide.
    #[serde(rename = "guaranteedExecutionFees", skip_serializing_if = "Option::is_none")]
    pub guaranteed_execution_fees: Option<f64>,
}

impl PositionSide {
    /// The representation of a Position for a single direction (long or short).
    pub fn new() -> PositionSide {
        PositionSide {
            units: None,
            average_price: None,
            trade_ids: None,
            pl: None,
            unrealized_pl: None,
            resettable_pl: None,
            financing: None,
            guaranteed_execution_fees: None,
        }
    }
}