bybit/models/fast_exec_data.rs
1use crate::prelude::*;
2
3/// Represents essential data about a single trade execution for high-frequency updates.
4///
5/// This struct provides a minimal set of fields for low-latency trade processing.
6///
7/// # Bybit API Reference
8/// Part of the execution WebSocket stream (https://bybit-exchange.github.io/docs/v5/websocket/private/execution).
9///
10/// # Perpetual Futures Context
11/// Fast execution data is optimized for bots requiring minimal latency, such as high-frequency trading strategies.
12#[derive(Serialize, Deserialize, Debug, Clone)]
13#[serde(rename_all = "camelCase")]
14pub struct FastExecData {
15 /// The category of the execution (e.g., "linear").
16 ///
17 /// Specifies the contract type. Bots must handle different categories due to varying margin rules.
18 pub category: String,
19
20 /// The trading pair symbol (e.g., "BTCUSDT").
21 ///
22 /// Identifies the market for the execution. Bots filter by symbol to process relevant trades.
23 pub symbol: String,
24
25 /// The unique identifier for the execution.
26 ///
27 /// Used to track individual trades. Bots use this to match executions with orders.
28 pub exec_id: String,
29
30 /// The price at which the trade was executed.
31 ///
32 /// The actual price of the filled order. Bots use this to update position entry prices.
33 #[serde(with = "string_to_float")]
34 pub exec_price: f64,
35
36 /// The quantity executed in the trade.
37 ///
38 /// The volume of the trade. Bots use this to update position sizes and track fills.
39 #[serde(with = "string_to_float")]
40 pub exec_qty: f64,
41
42 /// The ID of the order associated with the execution.
43 ///
44 /// Links the execution to the original order. Bots use this to track order status.
45 pub order_id: String,
46
47 /// The user-defined ID for the order.
48 ///
49 /// Allows bots to assign custom identifiers for internal tracking.
50 pub order_link_id: String,
51
52 /// The side of the order ("Buy" or "Sell").
53 ///
54 /// Indicates the direction of the trade. Bots use this to update position direction.
55 pub side: String,
56
57 /// The timestamp when the execution occurred (in milliseconds).
58 ///
59 /// Indicates the exact time of the trade. Bots use this for precise timing.
60 #[serde(with = "string_to_u64")]
61 pub exec_time: u64,
62
63 /// The sequence number for the execution.
64 ///
65 /// Used to ensure executions are processed in order. Bots validate sequence numbers to avoid missing updates.
66 pub seq: u64,
67}