gateio_rs/api/spot/
get_open_orders.rs1use crate::http::{Credentials, Method, request::Request};
2
3pub struct GetOpenOrders {
5 pub page: Option<i32>,
7 pub limit: Option<i32>,
9 pub account: Option<String>,
11 pub credentials: Option<Credentials>,
13}
14
15impl GetOpenOrders {
16 pub fn new() -> Self {
18 Self {
19 page: None,
20 limit: None,
21 account: None,
22 credentials: None,
23 }
24 }
25
26 pub fn page(mut self, page: i32) -> Self {
28 self.page = Some(page);
29 self
30 }
31
32 pub fn limit(mut self, limit: i32) -> Self {
34 self.limit = Some(limit);
35 self
36 }
37
38 pub fn account(mut self, account: &str) -> Self {
40 self.account = Some(account.into());
41 self
42 }
43
44 pub fn credentials(mut self, creds: Credentials) -> Self {
46 self.credentials = Some(creds);
47 self
48 }
49}
50
51impl From<GetOpenOrders> for Request {
52 fn from(request: GetOpenOrders) -> Request {
53 let mut params = Vec::new();
54
55 if let Some(page) = request.page {
56 params.push(("page".into(), page.to_string()));
57 }
58
59 if let Some(limit) = request.limit {
60 params.push(("limit".into(), limit.to_string()));
61 }
62
63 if let Some(account) = request.account {
64 params.push(("account".into(), account));
65 }
66
67 Request {
68 method: Method::Get,
69 path: "/api/v4/spot/open_orders".into(),
70 params,
71 payload: "".to_string(),
72 x_gate_exp_time: None,
73 credentials: request.credentials,
74 sign: true,
75 }
76 }
77}