countdown_cancel_all/
countdown_cancel_all.rs1use gateio_rs::{api::spot, http::Credentials, ureq::GateHttpClient};
2use serde_json::Value;
3
4fn main() -> Result<(), Box<gateio_rs::ureq::Error>> {
5 dotenv::dotenv().ok();
6
7 println!("⚠️ WARNING: This will set a countdown timer to cancel ALL orders!");
9 println!("Proceeding in 3 seconds... Press Ctrl+C to abort");
10 std::thread::sleep(std::time::Duration::from_secs(3));
11
12 let api_key = std::env::var("GATE_API_KEY").expect("GATE_API_KEY not set");
13 let api_secret = std::env::var("GATE_API_SECRET").expect("GATE_API_SECRET not set");
14 let credentials = Credentials::new(api_key, api_secret);
15
16 let client = GateHttpClient::default().credentials(credentials.clone());
17
18 let timeout_seconds = 60;
20 let req = spot::countdown_cancel_all(timeout_seconds).credentials(credentials);
21 let resp = client.send(req)?;
24 let body = resp.into_body_str()?;
25 let resp_obj: Value = serde_json::from_str(&body).unwrap();
26 println!("Countdown timer set: {:?}", resp_obj);
27
28 Ok(())
29}