1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* 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,
}
}
}