Skip to main content

GetFee

Struct GetFee 

Source
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

Source

pub fn new() -> Self

Creates a new GetFee request

Source

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}
Source

pub fn credentials(self, creds: Credentials) -> Self

Sets the API credentials for authentication

Trait Implementations§

Source§

impl From<GetFee> for Request

Source§

fn from(request: GetFee) -> Request

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.