Skip to main content

bybit/models/
order_history.rs

1use crate::prelude::*;
2
3/// Represents a collection of historical orders with pagination information.
4///
5/// This struct contains the list of orders and a cursor for fetching additional pages.
6/// In perpetual futures, bots use this to analyze trading history, calculate performance
7/// metrics, and adjust strategies based on past executions.
8#[derive(Serialize, Deserialize, Clone, Debug)]
9#[serde(rename_all = "camelCase")]
10pub struct OrderHistory {
11    /// The category of the orders (e.g., "spot", "linear").
12    ///
13    /// Indicates the market of the orders (e.g., Spot or Linear for perpetual futures).
14    /// Bots should verify this matches the query to ensure correct data processing.
15    pub category: String,
16
17    /// The list of historical orders.
18    ///
19    /// Contains detailed information about each order. Bots should iterate over this
20    /// to extract metrics like execution price, fees, and status for perpetual futures
21    /// analysis.
22    pub list: Vec<Order>,
23
24    /// The cursor for fetching the next page of results.
25    ///
26    /// Used for pagination when the query returns more orders than the `limit`. Bots
27    /// should include this in subsequent requests to retrieve additional orders in
28    /// perpetual futures trading.
29    #[serde(skip_serializing_if = "String::is_empty")]
30    pub next_page_cursor: String,
31}