Skip to main content

longbridge/grid/requests/
get_grid_order_detail.rs

1use serde::Serialize;
2
3/// Options for get grid trading order detail request
4#[derive(Debug, Serialize, Clone)]
5pub struct GetGridOrderDetailOptions {
6    order_id: String,
7    /// History cursor for paging through the trigger history
8    #[serde(skip_serializing_if = "Option::is_none")]
9    history_id: Option<String>,
10    #[serde(skip_serializing_if = "Option::is_none")]
11    limit: Option<i32>,
12}
13
14impl GetGridOrderDetailOptions {
15    /// Create a new `GetGridOrderDetailOptions`
16    #[inline]
17    pub fn new(order_id: impl Into<String>) -> Self {
18        Self {
19            order_id: order_id.into(),
20            history_id: None,
21            limit: None,
22        }
23    }
24
25    /// Set the history cursor
26    #[inline]
27    #[must_use]
28    pub fn history_id(self, history_id: impl Into<String>) -> Self {
29        Self {
30            history_id: Some(history_id.into()),
31            ..self
32        }
33    }
34
35    /// Set the page size
36    #[inline]
37    #[must_use]
38    pub fn limit(self, limit: i32) -> Self {
39        Self {
40            limit: Some(limit),
41            ..self
42        }
43    }
44}