longbridge/grid/requests/
get_grid_orders.rs1use serde::Serialize;
2
3use crate::Market;
4
5#[derive(Debug, Default, Serialize, Clone)]
7pub struct GetGridOrdersOptions {
8 #[serde(skip_serializing_if = "Option::is_none")]
9 page: Option<i32>,
10 #[serde(skip_serializing_if = "Option::is_none")]
11 limit: Option<i32>,
12 #[serde(skip_serializing_if = "Option::is_none")]
13 market: Option<Market>,
14 #[serde(skip_serializing_if = "Option::is_none")]
16 status: Option<String>,
17 #[serde(skip_serializing_if = "Option::is_none")]
18 symbol: Option<String>,
19 #[serde(skip_serializing_if = "Option::is_none")]
20 sort_by: Option<String>,
21 #[serde(skip_serializing_if = "Option::is_none")]
22 sort_order: Option<String>,
23}
24
25impl GetGridOrdersOptions {
26 #[inline]
28 pub fn new() -> Self {
29 Default::default()
30 }
31
32 #[inline]
34 #[must_use]
35 pub fn page(self, page: i32) -> Self {
36 Self {
37 page: Some(page),
38 ..self
39 }
40 }
41
42 #[inline]
44 #[must_use]
45 pub fn limit(self, limit: i32) -> Self {
46 Self {
47 limit: Some(limit),
48 ..self
49 }
50 }
51
52 #[inline]
54 #[must_use]
55 pub fn market(self, market: Market) -> Self {
56 Self {
57 market: Some(market),
58 ..self
59 }
60 }
61
62 #[inline]
64 #[must_use]
65 pub fn status(self, status: impl Into<String>) -> Self {
66 Self {
67 status: Some(status.into()),
68 ..self
69 }
70 }
71
72 #[inline]
74 #[must_use]
75 pub fn symbol(self, symbol: impl Into<String>) -> Self {
76 Self {
77 symbol: Some(symbol.into()),
78 ..self
79 }
80 }
81
82 #[inline]
84 #[must_use]
85 pub fn sort_by(self, sort_by: impl Into<String>) -> Self {
86 Self {
87 sort_by: Some(sort_by.into()),
88 ..self
89 }
90 }
91
92 #[inline]
94 #[must_use]
95 pub fn sort_order(self, sort_order: impl Into<String>) -> Self {
96 Self {
97 sort_order: Some(sort_order.into()),
98 ..self
99 }
100 }
101}