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
59
60
61
62
63
/*
* 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,
}
}
}