oanda-v20-openapi 0.2.1

The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
Documentation
/*
 * 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};

/// AccountSummary : A summary representation of a client's Account. The AccountSummary does not provide to full specification of pending Orders, open Trades and Positions.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AccountSummary {
    /// 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 Account's identifier
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// Client-assigned alias for the Account. Only provided if the Account has an alias set
    #[serde(rename = "alias", skip_serializing_if = "Option::is_none")]
    pub alias: Option<String>,
    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
    pub currency: Option<models::AccountCurrency>,
    /// The current balance of the Account.
    #[serde(rename = "balance", skip_serializing_if = "Option::is_none")]
    pub balance: Option<String>,
    /// ID of the user that created the Account.
    #[serde(rename = "createdByUserID", skip_serializing_if = "Option::is_none")]
    pub created_by_user_id: Option<i32>,
    /// 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).
    #[serde(rename = "createdTime", skip_serializing_if = "Option::is_none")]
    pub created_time: Option<String>,
    #[serde(rename = "guaranteedStopLossOrderMode", skip_serializing_if = "Option::is_none")]
    pub guaranteed_stop_loss_order_mode: Option<models::AccountGuaranteedStopLossOrderMode>,
    /// The total profit/loss realized over the lifetime of the Account.
    #[serde(rename = "pl", skip_serializing_if = "Option::is_none")]
    pub pl: Option<String>,
    /// The total realized profit/loss for the Account since it was last reset by the client.
    #[serde(rename = "resettablePL", skip_serializing_if = "Option::is_none")]
    pub resettable_pl: Option<String>,
    /// 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).
    #[serde(rename = "resettablePLTime", skip_serializing_if = "Option::is_none")]
    pub resettable_pl_time: Option<String>,
    /// The total amount of financing paid/collected over the lifetime of the Account.
    #[serde(rename = "financing", skip_serializing_if = "Option::is_none")]
    pub financing: Option<String>,
    /// The total amount of commission paid over the lifetime of the Account.
    #[serde(rename = "commission", skip_serializing_if = "Option::is_none")]
    pub commission: Option<String>,
    /// The total amount of fees charged over the lifetime of the Account for the execution of guaranteed Stop Loss Orders.
    #[serde(rename = "guaranteedExecutionFees", skip_serializing_if = "Option::is_none")]
    pub guaranteed_execution_fees: Option<String>,
    /// 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.
    #[serde(rename = "marginRate", skip_serializing_if = "Option::is_none")]
    pub margin_rate: Option<String>,
    /// 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).
    #[serde(rename = "marginCallEnterTime", skip_serializing_if = "Option::is_none")]
    pub margin_call_enter_time: Option<String>,
    /// The number of times that the Account's current margin call was extended.
    #[serde(rename = "marginCallExtensionCount", skip_serializing_if = "Option::is_none")]
    pub margin_call_extension_count: Option<i32>,
    /// 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).
    #[serde(rename = "lastMarginCallExtensionTime", skip_serializing_if = "Option::is_none")]
    pub last_margin_call_extension_time: Option<String>,
    /// The number of Trades currently open in the Account.
    #[serde(rename = "openTradeCount", skip_serializing_if = "Option::is_none")]
    pub open_trade_count: Option<i32>,
    /// The number of Positions currently open in the Account.
    #[serde(rename = "openPositionCount", skip_serializing_if = "Option::is_none")]
    pub open_position_count: Option<i32>,
    /// The number of Orders currently pending in the Account.
    #[serde(rename = "pendingOrderCount", skip_serializing_if = "Option::is_none")]
    pub pending_order_count: Option<i32>,
    /// Flag indicating that the Account has hedging enabled.
    #[serde(rename = "hedgingEnabled", skip_serializing_if = "Option::is_none")]
    pub hedging_enabled: Option<bool>,
    /// 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).
    #[serde(rename = "lastOrderFillTimestamp", skip_serializing_if = "Option::is_none")]
    pub last_order_fill_timestamp: Option<String>,
    /// The ID of the last Transaction created for the Account.
    #[serde(rename = "lastTransactionId", skip_serializing_if = "Option::is_none")]
    pub last_transaction_id: Option<String>,
}

impl AccountSummary {
    /// A summary representation of a client's Account. The AccountSummary does not provide to full specification of pending Orders, open Trades and Positions.
    pub fn new() -> AccountSummary {
        AccountSummary {
            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,
            id: None,
            alias: None,
            currency: None,
            balance: None,
            created_by_user_id: None,
            created_time: None,
            guaranteed_stop_loss_order_mode: None,
            pl: None,
            resettable_pl: None,
            resettable_pl_time: None,
            financing: None,
            commission: None,
            guaranteed_execution_fees: None,
            margin_rate: None,
            margin_call_enter_time: None,
            margin_call_extension_count: None,
            last_margin_call_extension_time: None,
            open_trade_count: None,
            open_position_count: None,
            pending_order_count: None,
            hedging_enabled: None,
            last_order_fill_timestamp: None,
            last_transaction_id: None,
        }
    }
}