bybit/models/
websocket_events.rs

1use crate::prelude::*;
2
3/// Enum representing various WebSocket event types.
4///
5/// Encapsulates different types of WebSocket events, such as order book updates, trades, and position changes, received from Bybit’s WebSocket API. Bots use this to handle real-time market and account data for trading strategies.
6#[derive(Debug, Serialize, Deserialize, Clone)]
7#[serde(untagged)]
8pub enum WebsocketEvents {
9    /// An order book update event.
10    ///
11    /// Contains real-time updates to the order book for a trading pair. Bots use this for market depth analysis and liquidity monitoring.
12    OrderBookEvent(OrderBookUpdate),
13
14    /// A trade event.
15    ///
16    /// Contains details of executed trades in the market. Bots use this for price discovery and trade signal generation.
17    TradeEvent(TradeUpdate),
18
19    /// A ticker event.
20    ///
21    /// Contains real-time ticker data, such as last price and volume. Bots use this for monitoring market conditions and technical analysis.
22    TickerEvent(WsTicker),
23
24    /// A liquidation event.
25    ///
26    /// Contains details of liquidation events in the market. Bots use this to assess market risk and volatility.
27    LiquidationEvent(Liquidation),
28
29    /// A kline (candlestick) event.
30    ///
31    /// Contains real-time candlestick data for a trading pair. Bots use this for technical analysis and trend detection.
32    KlineEvent(WsKline),
33
34    /// A position update event.
35    ///
36    /// Contains updates to the account’s positions. Bots use this to track position changes and manage risk in real time.
37    PositionEvent(PositionEvent),
38
39    /// An execution event.
40    ///
41    /// Contains details of order executions for the account. Bots use this to confirm trade executions and update order status.
42    ExecutionEvent(Execution),
43
44    /// An order update event.
45    ///
46    /// Contains updates to the account’s orders. Bots use this to monitor order status and implement dynamic order management.
47    OrderEvent(OrderEvent),
48
49    /// A wallet update event.
50    ///
51    /// Contains updates to the account’s wallet balance and margin. Bots use this to monitor account health and manage capital.
52    Wallet(WalletEvent),
53
54    /// A trade stream event.
55    ///
56    /// Contains real-time trade stream data, typically for high-frequency trading. Bots use this for low-latency trade monitoring.
57    TradeStream(TradeStreamEvent),
58
59    /// A fast execution event.
60    ///
61    /// Contains minimal execution data for low-latency processing. Bots use this for high-frequency trading and rapid execution confirmation.
62    FastExecEvent(FastExecution),
63}