Struct tokio_binance::WithdrawalClient[][src]

pub struct WithdrawalClient { /* fields omitted */ }

Client for dealing with withdrawals and sub accounts.

Implementations

impl WithdrawalClient[src]

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>, 
[src]

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(())
}

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

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?;

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

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?;

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

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?;

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

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?;

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

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?;

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

Fetch system status.

Example

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

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

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?;

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

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?;

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

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?;

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

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?;

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

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?;

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

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?;

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

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?;

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

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?;

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

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?;

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

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

impl Clone for WithdrawalClient[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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