Skip to main content

bybit/models/
trade_history_request.rs

1use crate::prelude::*;
2
3/// Parameters for requesting trade history data.
4///
5/// Used to construct a request to the `/v5/execution/list` endpoint to retrieve historical trade executions. Bots use this to analyze past trades, calculate performance metrics, and refine trading strategies for perpetual futures.
6#[derive(Clone, Default)]
7pub struct TradeHistoryRequest<'a> {
8    /// The product category (e.g., Linear, Inverse).
9    ///
10    /// Specifies the instrument type. Bots must set this to fetch trade history for the correct contract type (e.g., `Linear` for USDT-margined perpetuals).
11    pub category: Category,
12
13    /// The trading pair symbol (e.g., "BTCUSDT").
14    ///
15    /// Optionally filters trades by symbol. If unset, trades for all symbols in the category are returned. Bots should specify this for targeted analysis.
16    pub symbol: Option<Cow<'a, str>>,
17
18    /// The order ID.
19    ///
20    /// Optionally filters trades by a specific order ID. Useful for bots tracking executions for a particular order.
21    pub order_id: Option<Cow<'a, str>>,
22
23    /// The user-defined order link ID.
24    ///
25    /// Optionally filters trades by a custom order identifier. Bots can use this to correlate trades with specific strategies.
26    pub order_link_id: Option<Cow<'a, str>>,
27
28    /// The base coin (e.g., "BTC").
29    ///
30    /// Optionally filters trades by the base asset. Useful for bots analyzing trades across multiple pairs of the same asset.
31    pub base_coin: Option<Cow<'a, str>>,
32
33    /// The start time for the trade history (Unix timestamp in milliseconds).
34    ///
35    /// Defines the beginning of the time range. Bots should set this for historical trade analysis, such as performance over a specific period.
36    pub start_time: Option<u64>,
37
38    /// The end time for the trade history (Unix timestamp in milliseconds).
39    ///
40    /// Defines the end of the time range. Bots should set this to limit data to a specific period, optimizing performance.
41    pub end_time: Option<u64>,
42
43    /// The execution type (e.g., "Trade", "Funding").
44    ///
45    /// Optionally filters trades by execution type. Bots can use this to focus on specific trade events, such as excluding funding fee executions.
46    pub exec_type: Option<Cow<'a, str>>,
47
48    /// The maximum number of records to return (1-50, default: 50).
49    ///
50    /// Controls the number of trade records returned. Bots should set a reasonable limit to balance data completeness with performance.
51    pub limit: Option<u64>,
52}