Skip to main content

bybit/models/
ticker.rs

1use derive_more::TryUnwrap;
2
3use crate::prelude::*;
4
5/// Enum representing ticker data for different market types.
6///
7/// Encapsulates ticker data for linear perpetuals, spot markets, options, and futures contracts, allowing bots to process market-specific metrics like funding rates, USD index prices, or options Greeks. Bots use this to handle ticker updates in a type-safe manner.
8#[derive(Debug, Serialize, Deserialize, Clone, TryUnwrap)]
9#[serde(untagged)]
10pub enum Ticker {
11    /// Ticker data for linear perpetual futures.
12    ///
13    /// Contains metrics like funding rate and open interest for USDT-margined contracts. Bots use this for perpetual futures trading strategies.
14    Linear(LinearTickerData),
15
16    /// Ticker data for spot markets.
17    ///
18    /// Contains metrics like 24-hour volume and USD index price for spot trading pairs. Bots use this for spot market analysis.
19    Spot(SpotTickerData),
20
21    /// Ticker data for options contracts.
22    ///
23    /// Contains metrics like Greeks (delta, gamma, vega, theta), implied volatility, and other options-specific data. Bots use this for options trading strategies.
24    Options(OptionsTicker),
25
26    /// Ticker data for futures contracts (including inverse and USDC futures).
27    ///
28    /// Contains metrics for futures contracts with delivery dates. Bots use this for futures trading strategies.
29    Futures(FuturesTicker),
30}