rusty_ems/exchanges/bybit/
models.rs

1use serde::Deserialize;
2
3#[derive(Debug, Deserialize)]
4/// Bybit execution report data structure
5///
6/// Contains execution report information received from Bybit WebSocket streams.
7/// This structure represents the response format from Bybit's V5 API execution reports.
8pub struct BybitExecutionReport {
9    /// Trading category (spot, linear, inverse, option)
10    pub category: String,
11    /// Symbol/instrument identifier
12    pub symbol: String,
13    #[serde(rename = "orderId")]
14    /// Exchange-generated order ID
15    pub order_id: String,
16    #[serde(rename = "orderLinkId")]
17    /// Client-provided order link ID for tracking
18    pub order_link_id: String,
19    /// Order side (Buy/Sell)
20    pub side: String,
21    #[serde(rename = "orderPrice")]
22    /// Order price as string
23    pub order_price: String,
24    #[serde(rename = "orderQty")]
25    /// Order quantity as string
26    pub order_qty: String,
27    #[serde(rename = "leavesQty")]
28    /// Remaining quantity to be filled
29    pub leaves_qty: String,
30    #[serde(rename = "orderType")]
31    /// Order type (Market, Limit, etc.)
32    pub order_type: String,
33    #[serde(rename = "stopOrderType")]
34    /// Stop order type
35    pub stop_order_type: String,
36    #[serde(rename = "execFee")]
37    /// Execution fee amount
38    pub exec_fee: String,
39    #[serde(rename = "execId")]
40    /// Execution ID
41    pub exec_id: String,
42    #[serde(rename = "execPrice")]
43    /// Execution price
44    pub exec_price: String,
45    #[serde(rename = "execQty")]
46    /// Executed quantity
47    pub exec_qty: String,
48    #[serde(rename = "execType")]
49    /// Execution type (Trade, AdlTrade, etc.)
50    pub exec_type: String,
51    #[serde(rename = "execValue")]
52    /// Execution value
53    pub exec_value: String,
54    #[serde(rename = "execTime")]
55    /// Execution timestamp
56    pub exec_time: String,
57    #[serde(rename = "isMaker")]
58    /// Whether the order is maker order
59    pub is_maker: bool,
60    #[serde(rename = "feeRate")]
61    /// Fee rate applied to the trade
62    pub fee_rate: String,
63    #[serde(rename = "tradeIv")]
64    /// Trade implied volatility (for options)
65    pub trade_iv: String,
66    #[serde(rename = "markIv")]
67    /// Mark implied volatility (for options)
68    pub mark_iv: String,
69    #[serde(rename = "markPrice")]
70    /// Mark price at execution
71    pub mark_price: String,
72    #[serde(rename = "indexPrice")]
73    /// Index price at execution
74    pub index_price: String,
75    #[serde(rename = "underlyingPrice")]
76    /// Underlying price (for derivatives)
77    pub underlying_price: String,
78    #[serde(rename = "blockTradeId")]
79    /// Block trade ID
80    pub block_trade_id: String,
81    #[serde(rename = "closedSize")]
82    /// Closed position size
83    pub closed_size: String,
84    /// Sequence number for ordering
85    pub seq: i64,
86}