Skip to main content

amend_order/
amend_order.rs

1use 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");
8    let api_secret = std::env::var("GATE_API_SECRET").expect("GATE_API_SECRET not set");
9    let credentials = Credentials::new(api_key, api_secret);
10
11    let client = GateHttpClient::default().credentials(credentials.clone());
12
13    // You need to replace with an actual order ID from your account
14    let req = spot::amend_order("882949262345", "DUREV_USDT")
15        // .amount("0.01")
16        .price("0.0041");
17    // .account("spot");
18
19    let resp = client.send(req)?;
20    let body = resp.into_body_str()?;
21    let resp_obj: Value = serde_json::from_str(&body).unwrap();
22    println!("{:?}", resp_obj);
23
24    Ok(())
25}