pub struct WalletData {
pub account_im_rate: Option<f64>,
pub account_mm_rate: Option<f64>,
pub total_equity: f64,
pub total_wallet_balance: f64,
pub total_margin_balance: Option<f64>,
pub total_available_balance: Option<f64>,
pub total_perp_upl: f64,
pub total_initial_margin: Option<f64>,
pub total_maintenance_margin: Option<f64>,
pub coin: Vec<CoinData>,
pub account_ltv: Option<f64>,
pub account_type: Option<String>,
}Expand description
Represents wallet data, including balances and margin metrics, for a Bybit account.
This struct provides a snapshot of the account’s financial state, used for monitoring margin, equity, and risk in perpetual futures trading (https://bybit-exchange.github.io/docs/v5/account/wallet-balance). For trading bots, wallet data is critical for ensuring sufficient margin, avoiding liquidations, and optimizing capital allocation.
Fields§
§account_im_rate: Option<f64>Initial margin rate for the account, as a string (e.g., “0.1” for 10%).
This represents the ratio of initial margin to total equity, a key risk metric in perpetual futures. A higher rate indicates greater leverage and risk (https://bybit-exchange.github.io/docs/v5/account/risk-limit).
Bot Implication: Bots monitor account_im_rate to ensure compliance with Bybit’s margin requirements, adjusting positions to avoid margin calls.
account_mm_rate: Option<f64>Maintenance margin rate for the account, as a string (e.g., “0.05” for 5%).
This is the minimum margin ratio required to maintain open positions. Falling below this triggers a margin call or liquidation (https://bybit-exchange.github.io/docs/v5/account/risk-limit).
Bot Implication: Bots prioritize account_mm_rate to prevent forced liquidations, especially in volatile markets where margin requirements can spike.
total_equity: f64Total equity in the account, in USDT or the base currency.
This represents the account’s net worth, including wallet balance and unrealized PNL (https://bybit-exchange.github.io/docs/v5/account/wallet-balance).
Bot Implication: Bots use total_equity to assess overall account health and allocate capital across positions, ensuring sufficient buffer for market swings.
total_wallet_balance: f64Total wallet balance, excluding unrealized PNL.
This is the actual cash balance in the account, available for trading or withdrawal (https://bybit-exchange.github.io/docs/v5/account/wallet-balance).
Bot Implication: Bots track total_wallet_balance to ensure liquidity for new trades and margin requirements, avoiding funding shortages.
total_margin_balance: Option<f64>Total margin balance, including wallet balance and unrealized PNL.
This reflects the account’s total margin capacity, used to support open positions (https://bybit-exchange.github.io/docs/v5/account/wallet-balance).
Bot Implication: Bots use total_margin_balance to calculate leverage limits and ensure positions are adequately margined.
total_available_balance: Option<f64>Total available balance for new trades or withdrawals.
This is the portion of the wallet balance not tied up in margin or open positions (https://bybit-exchange.github.io/docs/v5/account/wallet-balance).
Bot Implication: Bots rely on total_available_balance to determine capacity for new trades, ensuring no over-allocation of funds.
total_perp_upl: f64Total unrealized profit and loss for perpetual futures positions.
This reflects the paper gains or losses on open positions, impacting equity and margin calculations (https://bybit-exchange.github.io/docs/v5/account/position).
Bot Implication: Bots monitor total_perp_upl to assess position performance and adjust risk controls, as large unrealized losses can trigger liquidations.
total_initial_margin: Option<f64>Total initial margin required for open positions and orders.
This is the collateral required to open and maintain positions, based on Bybit’s risk limits (https://bybit-exchange.github.io/docs/v5/account/risk-limit).
Bot Implication: Bots track total_initial_margin to ensure sufficient margin allocation, preventing rejections or forced closures.
total_maintenance_margin: Option<f64>Total maintenance margin required to keep positions open.
This is the minimum collateral needed to avoid liquidation, typically lower than initial margin (https://bybit-exchange.github.io/docs/v5/account/risk-limit).
Bot Implication: Bots prioritize total_maintenance_margin to maintain account stability, as falling below this triggers risk management actions.
coin: Vec<CoinData>List of coin-specific balance data for the account.
This breaks down the wallet by currency, providing granular balance and margin details (https://bybit-exchange.github.io/docs/v5/account/wallet-balance).
Bot Implication: Bots use coin to manage multi-currency accounts, ensuring proper funding and collateral allocation per currency.
account_ltv: Option<f64>Loan-to-value ratio for the account, as a string (e.g., “0.2” for 20%).
This measures borrowed funds relative to total equity, a leverage risk indicator in Bybit’s unified margin account (https://bybit-exchange.github.io/docs/v5/account/risk-limit).
Bot Implication: Bots monitor account_ltv to control leverage risk, as high LTV increases liquidation probability in adverse markets.
account_type: Option<String>Type of account, e.g., “UNIFIED”, if specified.
This indicates the account’s margin mode, such as unified (cross-margin) or isolated (per-position margin) (https://bybit-exchange.github.io/docs/v5/account/margin-mode).
Bot Implication: Bots must align strategies with account_type, as margin modes affect risk calculations and liquidation mechanics.
Trait Implementations§
Source§impl Clone for WalletData
impl Clone for WalletData
Source§fn clone(&self) -> WalletData
fn clone(&self) -> WalletData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more