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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
* 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};
/// AccountChangesState : An AccountChangesState Object is used to represent an Account's current price-dependent state. Price-dependent Account state is dependent on OANDA's current Prices, and includes things like unrealized PL, NAV and Trailing Stop Loss Order state.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AccountChangesState {
/// The total unrealized profit/loss for all Trades currently open in the Account.
#[serde(rename = "unrealizedPL", skip_serializing_if = "Option::is_none")]
pub unrealized_pl: Option<String>,
/// The net asset value of the Account. Equal to Account balance unrealizedPL.
#[serde(rename = "NAV", skip_serializing_if = "Option::is_none")]
pub nav: Option<String>,
/// Margin currently used for the Account.
#[serde(rename = "marginUsed", skip_serializing_if = "Option::is_none")]
pub margin_used: Option<String>,
/// Margin available for Account currency.
#[serde(rename = "marginAvailable", skip_serializing_if = "Option::is_none")]
pub margin_available: Option<String>,
/// The value of the Account's open positions represented in the Account's home currency.
#[serde(rename = "positionValue", skip_serializing_if = "Option::is_none")]
pub position_value: Option<String>,
/// The Account's margin closeout unrealized PL.
#[serde(rename = "marginCloseoutUnrealizedPL", skip_serializing_if = "Option::is_none")]
pub margin_closeout_unrealized_pl: Option<String>,
/// The Account's margin closeout NAV.
#[serde(rename = "marginCloseoutNAV", skip_serializing_if = "Option::is_none")]
pub margin_closeout_nav: Option<String>,
/// The Account's margin closeout margin used.
#[serde(rename = "marginCloseoutMarginUsed", skip_serializing_if = "Option::is_none")]
pub margin_closeout_margin_used: Option<String>,
/// The Account's margin closeout percentage. When this value is 1.0 or above the Account is in a margin closeout situation.
#[serde(rename = "marginCloseoutPercent", skip_serializing_if = "Option::is_none")]
pub margin_closeout_percent: Option<String>,
/// The value of the Account's open positions as used for margin closeout calculations represented in the Account's home currency.
#[serde(rename = "marginCloseoutPositionValue", skip_serializing_if = "Option::is_none")]
pub margin_closeout_position_value: Option<String>,
/// The current WithdrawalLimit for the account which will be zero or a positive value indicating how much can be withdrawn from the account.
#[serde(rename = "withdrawalLimit", skip_serializing_if = "Option::is_none")]
pub withdrawal_limit: Option<String>,
/// The Account's margin call margin used.
#[serde(rename = "marginCallMarginUsed", skip_serializing_if = "Option::is_none")]
pub margin_call_margin_used: Option<String>,
/// The Account's margin call percentage. When this value is 1.0 or above the Account is in a margin call situation.
#[serde(rename = "marginCallPercent", skip_serializing_if = "Option::is_none")]
pub margin_call_percent: Option<String>,
/// The price-dependent state of each pending Order in the Account.
#[serde(rename = "orders", skip_serializing_if = "Option::is_none")]
pub orders: Option<Vec<models::DynamicOrderState>>,
/// The price-dependent state for each open Trade in the Account.
#[serde(rename = "trades", skip_serializing_if = "Option::is_none")]
pub trades: Option<Vec<models::CalculatedTradeState>>,
/// The price-dependent state for each open Position in the Account.
#[serde(rename = "positions", skip_serializing_if = "Option::is_none")]
pub positions: Option<Vec<models::CalculatedPositionState>>,
}
impl AccountChangesState {
/// An AccountChangesState Object is used to represent an Account's current price-dependent state. Price-dependent Account state is dependent on OANDA's current Prices, and includes things like unrealized PL, NAV and Trailing Stop Loss Order state.
pub fn new() -> AccountChangesState {
AccountChangesState {
unrealized_pl: None,
nav: None,
margin_used: None,
margin_available: None,
position_value: None,
margin_closeout_unrealized_pl: None,
margin_closeout_nav: None,
margin_closeout_margin_used: None,
margin_closeout_percent: None,
margin_closeout_position_value: None,
withdrawal_limit: None,
margin_call_margin_used: None,
margin_call_percent: None,
orders: None,
trades: None,
positions: None,
}
}
}