amend_batch_orders/
amend_batch_orders.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 let api_key = std::env::var("GATE_API_KEY").expect("GATE_API_KEY not set");
9 let api_secret = std::env::var("GATE_API_SECRET").expect("GATE_API_SECRET not set");
10 let credentials = Credentials::new(api_key, api_secret);
11
12 let client = GateHttpClient::default().credentials(credentials.clone());
13
14 let amendments = vec![
16 spot::OrderAmendment::new("order_id_1", "BTC_USDT")
17 .price("45000")
18 .amount("0.01"),
19 spot::OrderAmendment::new("order_id_2", "ETH_USDT")
20 .price("3000")
21 .amend_text("Updated price"),
22 ];
23
24 let req = spot::amend_batch_orders(amendments);
26
27 let resp = client.send(req)?;
28 let body = resp.into_body_str()?;
29 let resp_obj: Value = serde_json::from_str(&body).unwrap();
30 println!("{:?}", resp_obj);
31
32 Ok(())
33}