WithdrawalClient

Struct WithdrawalClient 

Source
pub struct WithdrawalClient { /* private fields */ }
Expand description

Client for dealing with withdrawals and sub accounts.

Implementations§

Source§

impl WithdrawalClient

Source

pub fn connect<A, S, U>(api_key: A, secret_key: S, url: U) -> Result<Self>
where A: Into<String>, S: Into<String>, U: Into<String>,

Creates new client instance.

§Example
use tokio_binance::{WithdrawalClient, BINANCE_US_URL};
 
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = WithdrawalClient::connect("<api-key>", "<secret-key>", BINANCE_US_URL)?;
    Ok(())
}
Source

pub fn withdraw<'a>( &self, asset: &'a str, address: &'a str, amount: f64, ) -> ParamBuilder<'a, '_, WithdrawParams>

Submit a withdraw request.

§Example
use serde_json::Value;
 
let response = client
    .withdraw("BNB", "<public-address>", 5.00)
    //optional: Secondary address identifier for coins like XRP,XMR etc.
    .with_address_tag("<tag>")
    // optional: Description of the address.
    .with_name("<description>")
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_deposit_history(&self) -> ParamBuilder<'_, '_, DepositHistoryParams>

Fetch deposit history.

§Example
use chrono::{Utc, Duration};
use serde_json::Value;
 
let end = Utc::now();
let start = end - Duration::hours(23);
 
let response = client
    .get_deposit_history()
    // optional: filter by asset; gets all assets by default.
    .with_asset("BNB")
    // optional: 0(0:pending,6: credited but cannot withdraw, 1:success)
    .with_status(1)
    // optional: get deposits from; gets the most recent deposits by default.
    .with_start_time(start)
    // optional: get deposits until; default is now.
    .with_end_time(end)
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_withdraw_history( &self, ) -> ParamBuilder<'_, '_, WithdrawHistoryParams>

Fetch withdraw history.

§Example
use chrono::{Utc, Duration};
use serde_json::Value;
 
let end = Utc::now();
let start = end - Duration::hours(23);
 
let response = client
    .get_withdraw_history()
    // optional: filter by asset; gets all assets by default.
    .with_asset("BNB")
    // optional: 0(0:Email Sent,1:Cancelled 2:Awaiting Approval 3:Rejected 4:Processing 5:Failure 6Completed)
    .with_status(6)
    // optional: get deposits from; gets the most recent deposits by default.
    .with_start_time(start)
    // optional: get deposits until; default is now.
    .with_end_time(end)
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_deposit_address<'a>( &self, asset: &'a str, ) -> ParamBuilder<'a, '_, DepositAddressParams>

Fetch deposit address.

§Example
use serde_json::Value;
 
let response = client
    .get_deposit_address("BNB")
    // optional: Boolean.
    .with_status(true)
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_account_status(&self) -> ParamBuilder<'_, '_, AccountStatusParams>

Fetch account status detail.

§Example
use serde_json::Value;
 
let response = client
    .get_account_status()
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_system_status(&self) -> ParamBuilder<'_, '_, SystemStatusParams>

Fetch system status.

§Example
use serde_json::Value;
 
let response = client
    .get_system_status()
    .json::<Value>()
    .await?;
Source

pub fn get_api_status(&self) -> ParamBuilder<'_, '_, ApiStatusParams>

Fetch account api trading status detail.

§Example
use serde_json::Value;
 
let response = client
    .get_api_status()
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_dustlog(&self) -> ParamBuilder<'_, '_, DustlogParams>

Fetch small amounts of assets exchanged BNB records.

§Example
use serde_json::Value;
 
let response = client
    .get_dustlog()
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_trade_fee(&self) -> ParamBuilder<'_, '_, TradeFeeParams>

Fetch trade fee.

§Example
use serde_json::Value;
 
let response = client
    .get_trade_fee()
    // optional: filter by symbol; gets all symbols by default.
    .with_symbol("BNBUSDT")
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_asset_detail(&self) -> ParamBuilder<'_, '_, AssetDetailParams>

Fetch asset detail.

§Example
use serde_json::Value;
 
let response = client
    .get_asset_detail()
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_sub_accounts(&self) -> ParamBuilder<'_, '_, SubAccountParams>

Fetch sub account list.

§Example
use serde_json::Value;
 
let response = client
    .get_sub_accounts()
    // optional: Sub-account email.
    .with_email("<email>")
    // optional: Sub-account status: enabled or disabled.
    .with_status("enabled")
    // optional: default value: 1.
    .with_page(2)
    // optional: limit the amount of sub accounts; default 500.
    .with_limit(100)
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_transfer_history<'a>( &self, email: &'a str, ) -> ParamBuilder<'a, '_, SubAccountTranferParams>

Fetch transfer history list

§Example
use chrono::{Utc, Duration};
use serde_json::Value;
 
let end = Utc::now();
let start = end - Duration::days(99);
 
let response = client
    .get_transfer_history("<email>")
    // optional: get history from; default return the history with in 100 days
    .with_start_time(start)
    // optional: get history until; default is now.
    .with_end_time(end)
    // optional: default value: 1.
    .with_page(2)
    // optional: limit the amount of sub accounts; default 500.
    .with_limit(100)
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn tranfer_sub_account<'a>( &self, from_email: &'a str, to_email: &'a str, asset: &'a str, amount: f64, ) -> ParamBuilder<'a, '_, TransferSubAccountParams>

Execute sub-account transfer.

§Example
use serde_json::Value;
 
let response = client
    .tranfer_sub_account("<from_email>", "<to_email>", "BNB", 5.00)
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_sub_account_assets<'a>( &self, email: &'a str, ) -> ParamBuilder<'a, '_, SubAccountAssetParams>

Fetch sub-account assets.

§Example
use serde_json::Value;
 
let response = client
    .get_sub_account_assets("<email>")
    // optional: filter by symbol; gets all symbols by default.
    .with_symbol("BNBUSDT")
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn dust_transfer<'a>( &self, asset: &'a str, ) -> ParamBuilder<'a, '_, DustTransferParams>

Convert dust assets to BNB.

§Example
use serde_json::Value;
 
let response = client
    // restricted to one asset at a time.
    .dust_transfer("ETH")
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;
Source

pub fn get_asset_dividends(&self) -> ParamBuilder<'_, '_, AssetDividendParams>

Query asset dividend record.

§Example
use chrono::{Utc, Duration};
use serde_json::Value;
 
let end = Utc::now();
let start = end - Duration::days(99);
 
let response = client
    .get_asset_dividends()
    // optional: filter by asset; gets all assets by default.
    .with_asset("BNB")
    // optional: get records from; gets recent records by default.
    .with_start_time(start)
    // optional: get records until; default is now.
    .with_end_time(end)
    // optional: processing time for request; default is 5000, can't be above 60000.
    .with_recv_window(8000)
    //
    .json::<Value>()
    .await?;

Trait Implementations§

Source§

impl Clone for WithdrawalClient

Source§

fn clone(&self) -> WithdrawalClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,