pub struct GetFee {
pub currency_pair: Option<String>,
pub credentials: Option<Credentials>,
}Expand description
Request for retrieving trading fees for spot trading
Fields§
§currency_pair: Option<String>Optional currency pair to get specific trading fees for
credentials: Option<Credentials>API credentials for authentication
Implementations§
Source§impl GetFee
impl GetFee
Sourcepub fn currency_pair(self, currency_pair: &str) -> Self
pub fn currency_pair(self, currency_pair: &str) -> Self
Sets the currency pair to get specific fees for
Examples found in repository?
examples/sync/get_fee.rs (line 23)
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 // Test without currency_pair parameter (get all fees)
14 let req = spot::get_fee();
15
16 println!("Fetching trading fee rates...");
17 let resp = client.send(req)?;
18 let body = resp.into_body_str()?;
19 let resp_obj: Value = serde_json::from_str(&body).unwrap();
20 println!("All trading fee rates: {:?}", resp_obj);
21
22 // Test with specific currency_pair parameter
23 let req = spot::get_fee().currency_pair("BTC_USDT");
24
25 println!("\nFetching trading fee rates for BTC_USDT...");
26 let resp = client.send(req)?;
27 let body = resp.into_body_str()?;
28 let resp_obj: Value = serde_json::from_str(&body).unwrap();
29 println!("BTC_USDT trading fee rates: {:?}", resp_obj);
30
31 Ok(())
32}Sourcepub fn credentials(self, creds: Credentials) -> Self
pub fn credentials(self, creds: Credentials) -> Self
Sets the API credentials for authentication
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GetFee
impl RefUnwindSafe for GetFee
impl Send for GetFee
impl Sync for GetFee
impl Unpin for GetFee
impl UnsafeUnpin for GetFee
impl UnwindSafe for GetFee
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more