gateio_rs/api/spot/
cancel_all_open_orders.rs1use crate::http::{Credentials, Method, request::Request};
2
3pub struct CancelAllOpenOrders {
5 pub currency_pair: Option<String>,
7 pub credentials: Option<Credentials>,
9}
10
11impl CancelAllOpenOrders {
12 pub fn new() -> Self {
14 Self {
15 currency_pair: None,
16 credentials: None,
17 }
18 }
19
20 pub fn currency_pair(mut self, currency_pair: &str) -> Self {
22 self.currency_pair = Some(currency_pair.to_string());
23 self
24 }
25
26 pub fn credentials(mut self, creds: Credentials) -> Self {
28 self.credentials = Some(creds);
29 self
30 }
31}
32
33impl From<CancelAllOpenOrders> for Request {
34 fn from(request: CancelAllOpenOrders) -> Request {
35 let mut params = Vec::new();
36
37 if let Some(currency_pair) = &request.currency_pair {
38 params.push(("currency_pair".to_string(), currency_pair.clone()));
39 }
40
41 Request {
42 method: Method::Delete,
43 path: "/api/v4/spot/orders".into(),
44 params,
45 payload: "".to_string(),
46 x_gate_exp_time: None,
47 credentials: request.credentials,
48 sign: true,
49 }
50 }
51}