Skip to main content

oanda_v20_openapi/models/
account_changes_state.rs

1/*
2 * OANDA v20 API
3 *
4 * The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
5 *
6 * The version of the OpenAPI document: 0.2.1
7 * Contact: jmicoud02@gmail.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// 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.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct AccountChangesState {
17    /// The total unrealized profit/loss for all Trades currently open in the Account.
18    #[serde(rename = "unrealizedPL", skip_serializing_if = "Option::is_none")]
19    pub unrealized_pl: Option<String>,
20    /// The net asset value of the Account. Equal to Account balance unrealizedPL.
21    #[serde(rename = "NAV", skip_serializing_if = "Option::is_none")]
22    pub nav: Option<String>,
23    /// Margin currently used for the Account.
24    #[serde(rename = "marginUsed", skip_serializing_if = "Option::is_none")]
25    pub margin_used: Option<String>,
26    /// Margin available for Account currency.
27    #[serde(rename = "marginAvailable", skip_serializing_if = "Option::is_none")]
28    pub margin_available: Option<String>,
29    /// The value of the Account's open positions represented in the Account's home currency.
30    #[serde(rename = "positionValue", skip_serializing_if = "Option::is_none")]
31    pub position_value: Option<String>,
32    /// The Account's margin closeout unrealized PL.
33    #[serde(rename = "marginCloseoutUnrealizedPL", skip_serializing_if = "Option::is_none")]
34    pub margin_closeout_unrealized_pl: Option<String>,
35    /// The Account's margin closeout NAV.
36    #[serde(rename = "marginCloseoutNAV", skip_serializing_if = "Option::is_none")]
37    pub margin_closeout_nav: Option<String>,
38    /// The Account's margin closeout margin used.
39    #[serde(rename = "marginCloseoutMarginUsed", skip_serializing_if = "Option::is_none")]
40    pub margin_closeout_margin_used: Option<String>,
41    /// The Account's margin closeout percentage. When this value is 1.0 or above the Account is in a margin closeout situation.
42    #[serde(rename = "marginCloseoutPercent", skip_serializing_if = "Option::is_none")]
43    pub margin_closeout_percent: Option<String>,
44    /// The value of the Account's open positions as used for margin closeout calculations represented in the Account's home currency.
45    #[serde(rename = "marginCloseoutPositionValue", skip_serializing_if = "Option::is_none")]
46    pub margin_closeout_position_value: Option<String>,
47    /// The current WithdrawalLimit for the account which will be zero or a positive value indicating how much can be withdrawn from the account.
48    #[serde(rename = "withdrawalLimit", skip_serializing_if = "Option::is_none")]
49    pub withdrawal_limit: Option<String>,
50    /// The Account's margin call margin used.
51    #[serde(rename = "marginCallMarginUsed", skip_serializing_if = "Option::is_none")]
52    pub margin_call_margin_used: Option<String>,
53    /// The Account's margin call percentage. When this value is 1.0 or above the Account is in a margin call situation.
54    #[serde(rename = "marginCallPercent", skip_serializing_if = "Option::is_none")]
55    pub margin_call_percent: Option<String>,
56    /// The price-dependent state of each pending Order in the Account.
57    #[serde(rename = "orders", skip_serializing_if = "Option::is_none")]
58    pub orders: Option<Vec<models::DynamicOrderState>>,
59    /// The price-dependent state for each open Trade in the Account.
60    #[serde(rename = "trades", skip_serializing_if = "Option::is_none")]
61    pub trades: Option<Vec<models::CalculatedTradeState>>,
62    /// The price-dependent state for each open Position in the Account.
63    #[serde(rename = "positions", skip_serializing_if = "Option::is_none")]
64    pub positions: Option<Vec<models::CalculatedPositionState>>,
65}
66
67impl AccountChangesState {
68    /// 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.
69    pub fn new() -> AccountChangesState {
70        AccountChangesState {
71            unrealized_pl: None,
72            nav: None,
73            margin_used: None,
74            margin_available: None,
75            position_value: None,
76            margin_closeout_unrealized_pl: None,
77            margin_closeout_nav: None,
78            margin_closeout_margin_used: None,
79            margin_closeout_percent: None,
80            margin_closeout_position_value: None,
81            withdrawal_limit: None,
82            margin_call_margin_used: None,
83            margin_call_percent: None,
84            orders: None,
85            trades: None,
86            positions: None,
87        }
88    }
89}
90