bybit/models/
execution.rs

1use crate::prelude::*;
2
3/// Represents an execution event in Bybit's perpetual futures market.
4///
5/// This struct is used in WebSocket streams to provide details about trade executions, such as price, quantity, and fees.
6///
7/// # Bybit API Reference
8/// The Bybit API (https://bybit-exchange.github.io/docs/v5/websocket/private/execution) provides execution data via WebSocket.
9///
10/// # Perpetual Futures Context
11/// Executions represent filled orders or partial fills. Bots use this data to track trade performance, calculate costs, and update position states.
12#[derive(Serialize, Deserialize, Debug, Clone)]
13#[serde(rename_all = "camelCase")]
14pub struct Execution {
15    /// The unique identifier for the execution event.
16    ///
17    /// Used to track specific executions. Bots can use this to correlate events with internal trade records.
18    pub id: String,
19
20    /// The WebSocket topic (e.g., "execution").
21    ///
22    /// Identifies the execution data stream. Bots use this to filter relevant messages.
23    pub topic: String,
24
25    /// The timestamp when the event was created (in milliseconds).
26    ///
27    /// Indicates when the execution occurred. Bots use this for time-based analysis.
28    pub creation_time: u64,
29
30    /// The execution data for the event.
31    ///
32    /// Contains details about the executed trades. Bots process this to update trade logs and positions.
33    pub data: Vec<ExecutionData>,
34}