bybit/models/pre_check_result.rs
1use serde::{Deserialize, Serialize};
2
3/// Represents the result of a pre-check order request from Bybit.
4///
5/// This struct captures the margin calculation results before and after placing an order,
6/// allowing bots to assess the impact on initial margin requirement (IMR) and maintenance
7/// margin requirement (MMR). The values are expressed in basis points (e.g., 30 means 0.30%).
8/// Bots should use this to validate order feasibility and manage risk in perpetual futures trading.
9#[derive(Debug, Serialize, Deserialize, Clone)]
10pub struct PreCheckResult {
11 /// Unique order identifier assigned by Bybit.
12 ///
13 /// This ID can be used to reference the order in subsequent API calls. Bots should
14 /// store this for tracking and reconciliation purposes.
15 pub order_id: String,
16
17 /// User-defined custom order identifier.
18 ///
19 /// Allows bots to tag orders with a custom ID for internal tracking and management.
20 /// This is particularly useful for correlating pre-check results with actual order placement.
21 pub order_link_id: String,
22
23 /// Initial margin rate before placing the order, expressed in basis points (1/10000).
24 ///
25 /// For example, a value of 30 represents an IMR of 30/10000 = 0.30%. Bots should
26 /// compare this with `post_imr_e4` to understand how the order affects margin requirements.
27 pub pre_imr_e4: i64,
28
29 /// Maintenance margin rate before placing the order, expressed in basis points (1/10000).
30 ///
31 /// For example, a value of 21 represents an MMR of 21/10000 = 0.21%. This indicates
32 /// the minimum margin required to maintain the position before order placement.
33 pub pre_mmr_e4: i64,
34
35 /// Initial margin rate after placing the order, expressed in basis points (1/10000).
36 ///
37 /// This calculated value shows the projected IMR if the order is executed. Bots should
38 /// ensure this remains within acceptable limits to avoid margin calls in perpetual futures.
39 pub post_imr_e4: i64,
40
41 /// Maintenance margin rate after placing the order, expressed in basis points (1/10000).
42 ///
43 /// This calculated value shows the projected MMR if the order is executed. Bots should
44 /// monitor this to prevent liquidation risks in volatile perpetual futures markets.
45 pub post_mmr_e4: i64,
46}