Skip to main content

longbridge/grid/requests/
get_grid_trigger_history.rs

1use serde::Serialize;
2
3/// Options for get grid trading trigger history request.
4///
5/// Note: the required parameter is named `grid_order_id` (not `order_id`);
6/// passing the wrong name makes the server return the account-wide trigger
7/// history instead of the order-scoped one.
8#[derive(Debug, Serialize, Clone)]
9pub struct GetGridTriggerHistoryOptions {
10    grid_order_id: String,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    page: Option<i32>,
13    #[serde(skip_serializing_if = "Option::is_none")]
14    limit: Option<i32>,
15}
16
17impl GetGridTriggerHistoryOptions {
18    /// Create a new `GetGridTriggerHistoryOptions`
19    #[inline]
20    pub fn new(grid_order_id: impl Into<String>) -> Self {
21        Self {
22            grid_order_id: grid_order_id.into(),
23            page: None,
24            limit: None,
25        }
26    }
27
28    /// Set the page number
29    #[inline]
30    #[must_use]
31    pub fn page(self, page: i32) -> Self {
32        Self {
33            page: Some(page),
34            ..self
35        }
36    }
37
38    /// Set the page size
39    #[inline]
40    #[must_use]
41    pub fn limit(self, limit: i32) -> Self {
42        Self {
43            limit: Some(limit),
44            ..self
45        }
46    }
47}