bluefin_api 1.7.0

Bluefin API
Documentation
/*
 * Bluefin API
 *
 * Bluefin API
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// AccountUpdate : Account information for the data stream.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AccountUpdate {
    /// The optional group ID of the account.
    #[serde(rename = "groupId", skip_serializing_if = "Option::is_none")]
    pub group_id: Option<String>,
    #[serde(rename = "tradingFees", skip_serializing_if = "Option::is_none")]
    pub trading_fees: Option<models::TradingFees>,
    /// If the user can trade.
    #[serde(rename = "canTrade")]
    pub can_trade: bool,
    /// If the current user can deposit to the account.
    #[serde(rename = "canDeposit")]
    pub can_deposit: bool,
    /// If the current user can withdraw from the account.
    #[serde(rename = "canWithdraw")]
    pub can_withdraw: bool,
    /// Total effective balance in USD (e9 format).
    #[serde(rename = "crossEffectiveBalanceE9")]
    pub cross_effective_balance_e9: String,
    /// The sum of initial margin required across all cross positions (e9 format).
    #[serde(rename = "crossMarginRequiredE9")]
    pub cross_margin_required_e9: String,
    /// The sum of initial margin required across all open orders (e9 format).
    #[serde(rename = "totalOrderMarginRequiredE9")]
    pub total_order_margin_required_e9: String,
    /// The amount of margin available to open new positions and orders (e9 format).
    #[serde(rename = "marginAvailableE9")]
    pub margin_available_e9: String,
    /// The sum of maintenance margin required across all cross positions (e9 format).
    #[serde(rename = "crossMaintenanceMarginRequiredE9")]
    pub cross_maintenance_margin_required_e9: String,
    /// The amount of margin available before liquidation (e9 format).
    #[serde(rename = "crossMaintenanceMarginAvailableE9")]
    pub cross_maintenance_margin_available_e9: String,
    /// The ratio of the maintenance margin required to the account value (e9 format).
    #[serde(rename = "crossMaintenanceMarginRatioE9")]
    pub cross_maintenance_margin_ratio_e9: String,
    /// The leverage of the account (e9 format).
    #[serde(rename = "crossLeverageE9")]
    pub cross_leverage_e9: String,
    /// Total unrealized profit (e9 format).
    #[serde(rename = "totalUnrealizedPnlE9")]
    pub total_unrealized_pnl_e9: String,
    /// Unrealized profit of cross positions (e9 format).
    #[serde(rename = "crossUnrealizedPnlE9")]
    pub cross_unrealized_pnl_e9: String,
    /// An implicitly negative number that sums only the losses of all cross positions.
    #[serde(rename = "crossUnrealizedLossE9")]
    pub cross_unrealized_loss_e9: String,
    /// The total value of the cross account, combining the cross effective balance and unrealized PnL across all cross positions, and subtracting any pending funding payments on any cross position. 
    #[serde(rename = "crossAccountValueE9")]
    pub cross_account_value_e9: String,
    /// The total value of the account, combining the total effective balance and unrealized PnL across all positions, and subtracting any pending funding payments on any position. 
    #[serde(rename = "totalAccountValueE9")]
    pub total_account_value_e9: String,
    /// Last update time in milliseconds since Unix epoch.
    #[serde(rename = "updatedAtMillis")]
    pub updated_at_millis: i64,
    #[serde(rename = "assets")]
    pub assets: Vec<models::Asset>,
    /// Deprecated: Replaced with authorizedWallets.
    #[serde(rename = "authorizedAccounts")]
    pub authorized_accounts: Vec<String>,
    /// The wallets that are authorized to trade on behalf of the current account.
    #[serde(rename = "authorizedWallets")]
    pub authorized_wallets: Vec<models::AuthorizedWallet>,
}

impl AccountUpdate {
    /// Account information for the data stream.
    pub fn new(can_trade: bool, can_deposit: bool, can_withdraw: bool, cross_effective_balance_e9: String, cross_margin_required_e9: String, total_order_margin_required_e9: String, margin_available_e9: String, cross_maintenance_margin_required_e9: String, cross_maintenance_margin_available_e9: String, cross_maintenance_margin_ratio_e9: String, cross_leverage_e9: String, total_unrealized_pnl_e9: String, cross_unrealized_pnl_e9: String, cross_unrealized_loss_e9: String, cross_account_value_e9: String, total_account_value_e9: String, updated_at_millis: i64, assets: Vec<models::Asset>, authorized_accounts: Vec<String>, authorized_wallets: Vec<models::AuthorizedWallet>) -> AccountUpdate {
        AccountUpdate {
            group_id: None,
            trading_fees: None,
            can_trade,
            can_deposit,
            can_withdraw,
            cross_effective_balance_e9,
            cross_margin_required_e9,
            total_order_margin_required_e9,
            margin_available_e9,
            cross_maintenance_margin_required_e9,
            cross_maintenance_margin_available_e9,
            cross_maintenance_margin_ratio_e9,
            cross_leverage_e9,
            total_unrealized_pnl_e9,
            cross_unrealized_pnl_e9,
            cross_unrealized_loss_e9,
            cross_account_value_e9,
            total_account_value_e9,
            updated_at_millis,
            assets,
            authorized_accounts,
            authorized_wallets,
        }
    }
}