/*
* 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};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Account {
/// The (optional) group ID of the account. Accounts belonging to the same group cannot trade against each other.
#[serde(rename = "groupId", skip_serializing_if = "Option::is_none")]
pub group_id: Option<String>,
#[serde(rename = "tradingFees")]
pub trading_fees: 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>,
#[serde(rename = "positions")]
pub positions: Vec<models::Position>,
/// Deprecated: Replaced with authorizedWallets.
#[serde(rename = "authorizedAccounts")]
pub authorized_accounts: Vec<String>,
/// The address of the account.
#[serde(rename = "accountAddress")]
pub account_address: String,
/// The wallets that are authorized to trade on behalf of the current account.
#[serde(rename = "authorizedWallets")]
pub authorized_wallets: Vec<models::AuthorizedWallet>,
}
impl Account {
pub fn new(trading_fees: models::TradingFees, 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>, positions: Vec<models::Position>, authorized_accounts: Vec<String>, account_address: String, authorized_wallets: Vec<models::AuthorizedWallet>) -> Account {
Account {
group_id: None,
trading_fees,
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,
positions,
authorized_accounts,
account_address,
authorized_wallets,
}
}
}