pub struct InsurancePool {
pub coin: String,
pub symbols: String,
pub balance: f64,
pub update_time: u64,
}Expand description
Represents a single insurance pool entry in the WebSocket stream.
Contains information about the insurance pool balance for a specific symbol or group of symbols. Insurance pools are used to cover losses when a trader’s position is liquidated below the bankruptcy price, preventing auto-deleveraging of other traders.
Fields§
§coin: StringThe coin/token of the insurance pool (e.g., “USDT”, “USDC”, “BTC”).
Specifies the currency used for the insurance pool. For inverse contracts, this would be the base coin (e.g., “BTC” for BTCUSD).
symbols: StringThe symbol(s) associated with this insurance pool.
For isolated insurance pools, this is a single symbol name (e.g., “BTCUSDT”). For shared insurance pools, this may contain multiple symbols or be a group identifier. Note: Shared insurance pool data is not pushed via WebSocket.
balance: f64The current balance of the insurance pool in the specified coin.
A positive balance indicates the fund has surplus to cover losses. A negative balance indicates the fund is depleted and may trigger ADL (Auto-Deleveraging).
update_time: u64The timestamp when this insurance pool data was last updated (in milliseconds).
Indicates when the balance information was refreshed by Bybit’s systems. For shared insurance pools, this field follows a T+1 refresh mechanism and is updated daily at 00:00 UTC.
Implementations§
Source§impl InsurancePool
impl InsurancePool
Sourcepub fn new(coin: &str, symbols: &str, balance: f64, update_time: u64) -> Self
pub fn new(coin: &str, symbols: &str, balance: f64, update_time: u64) -> Self
Constructs a new InsurancePool with specified parameters.
Sourcepub fn is_coin(&self, coin: &str) -> bool
pub fn is_coin(&self, coin: &str) -> bool
Returns true if this insurance pool is for a specific coin.
Sourcepub fn is_symbol(&self, symbol: &str) -> bool
pub fn is_symbol(&self, symbol: &str) -> bool
Returns true if this insurance pool is for a specific symbol.
Note: For shared insurance pools, the symbols field may contain multiple symbols or a group identifier, so this check may not be accurate for all cases.
Sourcepub fn is_positive(&self) -> bool
pub fn is_positive(&self) -> bool
Returns true if the insurance pool balance is positive.
Sourcepub fn is_non_positive(&self) -> bool
pub fn is_non_positive(&self) -> bool
Returns true if the insurance pool balance is negative or zero.
A non-positive balance may indicate that ADL (Auto-Deleveraging) could be triggered.
Sourcepub fn update_datetime(&self) -> DateTime<Utc>
pub fn update_datetime(&self) -> DateTime<Utc>
Returns the update time as a chrono DateTime.
Sourcepub fn time_since_update(&self) -> u64
pub fn time_since_update(&self) -> u64
Returns the time since the last update in seconds.
Sourcepub fn is_stale(&self) -> bool
pub fn is_stale(&self) -> bool
Checks if the data is stale (older than 5 minutes).
The WebSocket pushes updates every 1 second, so data older than 5 minutes might be considered stale for real-time trading decisions.
Sourcepub fn absolute_balance(&self) -> f64
pub fn absolute_balance(&self) -> f64
Returns the absolute value of the balance.
Useful for display purposes when the sign indicates deficit/surplus.
Sourcepub fn signed_balance_string(&self) -> String
pub fn signed_balance_string(&self) -> String
Returns a string representation of the balance with sign.
Positive balances show “+” prefix, negative balances show “-” prefix.
Trait Implementations§
Source§impl Clone for InsurancePool
impl Clone for InsurancePool
Source§fn clone(&self) -> InsurancePool
fn clone(&self) -> InsurancePool
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more