bybit/models/
trade_update.rs

1use crate::prelude::*;
2
3/// Structure for WebSocket trade update events.
4///
5/// Contains real-time updates on executed trades for a trading pair. Bots use this for price discovery, trade signal generation, and market momentum analysis in perpetual futures trading.
6#[derive(Serialize, Deserialize, Debug, Clone)]
7#[serde(rename_all = "camelCase")]
8pub struct TradeUpdate {
9    /// The WebSocket topic for the event (e.g., "trade.BTCUSDT").
10    ///
11    /// Specifies the data stream for the trade update. Bots use this to verify the correct market.
12    pub topic: String,
13
14    /// The event type (e.g., "snapshot").
15    ///
16    /// Indicates the type of trade update, typically a snapshot of recent trades. Bots use this to process trade data appropriately.
17    #[serde(rename = "type")]
18    pub event_type: String,
19
20    /// The timestamp of the event in milliseconds.
21    ///
22    /// Indicates when the trade update was generated. Bots use this to ensure data freshness and align with other market data.
23    #[serde(rename = "ts")]
24    pub timestamp: u64,
25
26    /// A list of trade details.
27    ///
28    /// Contains the executed trades, including price, volume, and side. Bots use this to analyze market activity and generate trading signals.
29    pub data: Vec<WsTrade>,
30}