Skip to main content

oanda_v20_openapi/models/
account.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/// Account : The full details of a client's Account. This includes full open Trade, open Position and pending Order representation.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Account {
17    /// The Account's identifier
18    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
19    pub id: Option<String>,
20    /// Client-assigned alias for the Account. Only provided if the Account has an alias set
21    #[serde(rename = "alias", skip_serializing_if = "Option::is_none")]
22    pub alias: Option<String>,
23    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
24    pub currency: Option<models::AccountCurrency>,
25    /// The current balance of the Account.
26    #[serde(rename = "balance", skip_serializing_if = "Option::is_none")]
27    pub balance: Option<String>,
28    /// ID of the user that created the Account.
29    #[serde(rename = "createdByUserID", skip_serializing_if = "Option::is_none")]
30    pub created_by_user_id: Option<i32>,
31    /// A date and time value using either RFC3339 or UNIX time representation. The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
32    #[serde(rename = "createdTime", skip_serializing_if = "Option::is_none")]
33    pub created_time: Option<String>,
34    #[serde(rename = "guaranteedStopLossOrderMode", skip_serializing_if = "Option::is_none")]
35    pub guaranteed_stop_loss_order_mode: Option<models::AccountGuaranteedStopLossOrderMode>,
36    /// The total profit/loss realized over the lifetime of the Account.
37    #[serde(rename = "pl", skip_serializing_if = "Option::is_none")]
38    pub pl: Option<String>,
39    /// The total realized profit/loss for the Account since it was last reset by the client.
40    #[serde(rename = "resettablePL", skip_serializing_if = "Option::is_none")]
41    pub resettable_pl: Option<String>,
42    /// A date and time value using either RFC3339 or UNIX time representation. The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
43    #[serde(rename = "resettablePLTime", skip_serializing_if = "Option::is_none")]
44    pub resettable_pl_time: Option<String>,
45    /// The total amount of financing paid/collected over the lifetime of the Account.
46    #[serde(rename = "financing", skip_serializing_if = "Option::is_none")]
47    pub financing: Option<String>,
48    /// The total amount of commission paid over the lifetime of the Account.
49    #[serde(rename = "commission", skip_serializing_if = "Option::is_none")]
50    pub commission: Option<String>,
51    /// The total amount of fees charged over the lifetime of the Account for the execution of guaranteed Stop Loss Orders.
52    #[serde(rename = "guaranteedExecutionFees", skip_serializing_if = "Option::is_none")]
53    pub guaranteed_execution_fees: Option<String>,
54    /// Client-provided margin rate override for the Account. The effective margin rate of the Account is the lesser of this value and the OANDA margin rate for the Account's division. This value is only provided if a margin rate override exists for the Account.
55    #[serde(rename = "marginRate", skip_serializing_if = "Option::is_none")]
56    pub margin_rate: Option<String>,
57    /// A date and time value using either RFC3339 or UNIX time representation. The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
58    #[serde(rename = "marginCallEnterTime", skip_serializing_if = "Option::is_none")]
59    pub margin_call_enter_time: Option<String>,
60    /// The number of times that the Account's current margin call was extended.
61    #[serde(rename = "marginCallExtensionCount", skip_serializing_if = "Option::is_none")]
62    pub margin_call_extension_count: Option<i32>,
63    /// A date and time value using either RFC3339 or UNIX time representation. The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
64    #[serde(rename = "lastMarginCallExtensionTime", skip_serializing_if = "Option::is_none")]
65    pub last_margin_call_extension_time: Option<String>,
66    /// The number of Trades currently open in the Account.
67    #[serde(rename = "openTradeCount", skip_serializing_if = "Option::is_none")]
68    pub open_trade_count: Option<i32>,
69    /// The number of Positions currently open in the Account.
70    #[serde(rename = "openPositionCount", skip_serializing_if = "Option::is_none")]
71    pub open_position_count: Option<i32>,
72    /// The number of Orders currently pending in the Account.
73    #[serde(rename = "pendingOrderCount", skip_serializing_if = "Option::is_none")]
74    pub pending_order_count: Option<i32>,
75    /// Flag indicating that the Account has hedging enabled.
76    #[serde(rename = "hedgingEnabled", skip_serializing_if = "Option::is_none")]
77    pub hedging_enabled: Option<bool>,
78    /// A date and time value using either RFC3339 or UNIX time representation. The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
79    #[serde(rename = "lastOrderFillTimestamp", skip_serializing_if = "Option::is_none")]
80    pub last_order_fill_timestamp: Option<String>,
81    /// The ID of the last Transaction created for the Account.
82    #[serde(rename = "lastTransactionId", skip_serializing_if = "Option::is_none")]
83    pub last_transaction_id: Option<String>,
84    /// The total unrealized profit/loss for all Trades currently open in the Account.
85    #[serde(rename = "unrealizedPL", skip_serializing_if = "Option::is_none")]
86    pub unrealized_pl: Option<String>,
87    /// The net asset value of the Account. Equal to Account balance unrealizedPL.
88    #[serde(rename = "NAV", skip_serializing_if = "Option::is_none")]
89    pub nav: Option<String>,
90    /// Margin currently used for the Account.
91    #[serde(rename = "marginUsed", skip_serializing_if = "Option::is_none")]
92    pub margin_used: Option<String>,
93    /// Margin available for Account currency.
94    #[serde(rename = "marginAvailable", skip_serializing_if = "Option::is_none")]
95    pub margin_available: Option<String>,
96    /// The value of the Account's open positions represented in the Account's home currency.
97    #[serde(rename = "positionValue", skip_serializing_if = "Option::is_none")]
98    pub position_value: Option<String>,
99    /// The Account's margin closeout unrealized PL.
100    #[serde(rename = "marginCloseoutUnrealizedPL", skip_serializing_if = "Option::is_none")]
101    pub margin_closeout_unrealized_pl: Option<String>,
102    /// The Account's margin closeout NAV.
103    #[serde(rename = "marginCloseoutNAV", skip_serializing_if = "Option::is_none")]
104    pub margin_closeout_nav: Option<String>,
105    /// The Account's margin closeout margin used.
106    #[serde(rename = "marginCloseoutMarginUsed", skip_serializing_if = "Option::is_none")]
107    pub margin_closeout_margin_used: Option<String>,
108    /// The Account's margin closeout percentage. When this value is 1.0 or above the Account is in a margin closeout situation.
109    #[serde(rename = "marginCloseoutPercent", skip_serializing_if = "Option::is_none")]
110    pub margin_closeout_percent: Option<String>,
111    /// The value of the Account's open positions as used for margin closeout calculations represented in the Account's home currency.
112    #[serde(rename = "marginCloseoutPositionValue", skip_serializing_if = "Option::is_none")]
113    pub margin_closeout_position_value: Option<String>,
114    /// The current WithdrawalLimit for the account which will be zero or a positive value indicating how much can be withdrawn from the account.
115    #[serde(rename = "withdrawalLimit", skip_serializing_if = "Option::is_none")]
116    pub withdrawal_limit: Option<String>,
117    /// The Account's margin call margin used.
118    #[serde(rename = "marginCallMarginUsed", skip_serializing_if = "Option::is_none")]
119    pub margin_call_margin_used: Option<String>,
120    /// The Account's margin call percentage. When this value is 1.0 or above the Account is in a margin call situation.
121    #[serde(rename = "marginCallPercent", skip_serializing_if = "Option::is_none")]
122    pub margin_call_percent: Option<String>,
123    /// The details of the Trades currently open in the Account.
124    #[serde(rename = "trades", skip_serializing_if = "Option::is_none")]
125    pub trades: Option<Vec<models::TradeSummary>>,
126    /// The details all Account Positions.
127    #[serde(rename = "positions", skip_serializing_if = "Option::is_none")]
128    pub positions: Option<Vec<models::Position>>,
129    /// The details of the Orders currently pending in the Account.
130    #[serde(rename = "orders", skip_serializing_if = "Option::is_none")]
131    pub orders: Option<Vec<models::Order>>,
132}
133
134impl Account {
135    /// The full details of a client's Account. This includes full open Trade, open Position and pending Order representation.
136    pub fn new() -> Account {
137        Account {
138            id: None,
139            alias: None,
140            currency: None,
141            balance: None,
142            created_by_user_id: None,
143            created_time: None,
144            guaranteed_stop_loss_order_mode: None,
145            pl: None,
146            resettable_pl: None,
147            resettable_pl_time: None,
148            financing: None,
149            commission: None,
150            guaranteed_execution_fees: None,
151            margin_rate: None,
152            margin_call_enter_time: None,
153            margin_call_extension_count: None,
154            last_margin_call_extension_time: None,
155            open_trade_count: None,
156            open_position_count: None,
157            pending_order_count: None,
158            hedging_enabled: None,
159            last_order_fill_timestamp: None,
160            last_transaction_id: None,
161            unrealized_pl: None,
162            nav: None,
163            margin_used: None,
164            margin_available: None,
165            position_value: None,
166            margin_closeout_unrealized_pl: None,
167            margin_closeout_nav: None,
168            margin_closeout_margin_used: None,
169            margin_closeout_percent: None,
170            margin_closeout_position_value: None,
171            withdrawal_limit: None,
172            margin_call_margin_used: None,
173            margin_call_percent: None,
174            trades: None,
175            positions: None,
176            orders: None,
177        }
178    }
179}
180