Skip to main content

PreCheckOrderResponse

Type Alias PreCheckOrderResponse 

Source
pub type PreCheckOrderResponse = BybitApiResponse<PreCheckResult>;
Expand description

Response structure for pre-check order requests.

Returned by the /v5/order/pre-check endpoint, this struct provides margin calculation results before and after placing an order. Bots use this to validate order feasibility and manage risk by assessing the impact on initial margin requirement (IMR) and maintenance margin requirement (MMR) in perpetual futures trading.

Aliased Type§

pub struct PreCheckOrderResponse {
    pub ret_code: i32,
    pub ret_msg: String,
    pub result: PreCheckResult,
    pub ret_ext_info: Empty,
    pub time: u64,
}

Fields§

§ret_code: i32

The return code indicating the success or failure of the request.

A value of 0 indicates success, while non-zero values correspond to specific error codes as defined in the Bybit API documentation (e.g., 10001 for invalid parameters). Trading bots should check this field to handle errors gracefully, such as retrying requests or logging issues for debugging.

§ret_msg: String

A human-readable message describing the result or error.

For successful requests, this is typically "OK". For errors, it provides a description of the issue (e.g., "invalid timestamp"). Bots should log this field for debugging and user feedback, especially when ret_code is non-zero.

§result: PreCheckResult

Contains the actual payload corresponding to the requested endpoint, as JSON.

§ret_ext_info: Empty

Additional information, typically an empty object.

This field is usually an empty Empty struct ({}) and can be ignored in most cases. However, bots should verify its presence to ensure response consistency.

§time: u64

The timestamp of the response in milliseconds.

This represents the time the response was generated by Bybit’s server. Trading bots can use this to measure latency or further synchronize operations, though result.time_second is typically more relevant for timestamp validation.