Skip to main content

Wallet

Struct Wallet 

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

Wallet API client.

Provides access to Binance Wallet SAPI endpoints for asset management, deposits, withdrawals, and account status.

§Example

let client = Binance::new("api_key", "secret_key")?;

// Check system status
let status = client.wallet().system_status().await?;
if status.is_normal() {
    println!("System is operational");
}

// Get all coin information
let coins = client.wallet().all_coins().await?;
for coin in coins {
    println!("{}: free={}", coin.coin, coin.free);
}

Implementations§

Source§

impl Wallet

Source

pub async fn system_status(&self) -> Result<SystemStatus>

Fetch system status.

Returns whether the Binance system is operational or under maintenance.

§Example
let status = client.wallet().system_status().await?;
if status.is_normal() {
    println!("System is operational");
} else {
    println!("System maintenance: {}", status.msg);
}
Source

pub async fn all_coins(&self) -> Result<Vec<CoinInfo>>

Get information of all coins (available for deposit and withdraw).

Returns detailed information about all supported coins including deposit/withdraw status, fees, and network information.

§Example
let coins = client.wallet().all_coins().await?;
for coin in coins {
    println!("{} ({}): deposit={}, withdraw={}",
        coin.coin, coin.name,
        coin.deposit_all_enable, coin.withdraw_all_enable);
}
Source

pub async fn account_snapshot( &self, snapshot_type: AccountSnapshotType, start_time: Option<u64>, end_time: Option<u64>, limit: Option<u32>, ) -> Result<AccountSnapshot>

Get daily account snapshot.

Returns account balance snapshots for the specified time period. The query time period must be less than 30 days. Only supports querying within the last month.

§Arguments
  • snapshot_type - Type of account (Spot, Margin, or Futures)
  • start_time - Start timestamp (optional)
  • end_time - End timestamp (optional)
  • limit - Number of records (default 7, max 30)
§Example
use binance_api_client::AccountSnapshotType;

let snapshot = client.wallet()
    .account_snapshot(AccountSnapshotType::Spot, None, None, Some(5))
    .await?;
Source

pub async fn deposit_address( &self, coin: &str, network: Option<&str>, ) -> Result<DepositAddress>

Get deposit address for a coin.

§Arguments
  • coin - Coin symbol (e.g., “BTC”)
  • network - Network to use (optional, uses default if not specified)
§Example
let address = client.wallet().deposit_address("BTC", None).await?;
println!("Deposit to: {}", address.address);
Source

pub async fn deposit_history( &self, coin: Option<&str>, status: Option<u32>, start_time: Option<u64>, end_time: Option<u64>, offset: Option<u32>, limit: Option<u32>, ) -> Result<Vec<DepositRecord>>

Get deposit history.

§Arguments
  • coin - Filter by coin (optional)
  • status - Filter by status: 0=pending, 6=credited, 1=success (optional)
  • start_time - Start timestamp (optional)
  • end_time - End timestamp (optional)
  • offset - Pagination offset (optional)
  • limit - Number of records (default 1000, max 1000)
§Example
let deposits = client.wallet()
    .deposit_history(Some("BTC"), None, None, None, None, Some(10))
    .await?;
for deposit in deposits {
    println!("{}: {} {}", deposit.tx_id, deposit.amount, deposit.coin);
}
Source

pub async fn withdraw( &self, coin: &str, address: &str, amount: &str, network: Option<&str>, address_tag: Option<&str>, withdraw_order_id: Option<&str>, ) -> Result<WithdrawResponse>

Submit a withdrawal request.

§Arguments
  • coin - Coin symbol
  • address - Withdrawal address
  • amount - Amount to withdraw
  • network - Network to use (optional)
  • address_tag - Secondary address identifier (memo/tag, optional)
  • withdraw_order_id - Client ID for the withdrawal (optional)
§Example
let response = client.wallet()
    .withdraw("USDT", "0x1234...", "100.0", Some("ETH"), None, None)
    .await?;
println!("Withdrawal ID: {}", response.id);
Source

pub async fn withdraw_history( &self, coin: Option<&str>, withdraw_order_id: Option<&str>, status: Option<u32>, start_time: Option<u64>, end_time: Option<u64>, offset: Option<u32>, limit: Option<u32>, ) -> Result<Vec<WithdrawRecord>>

Get withdrawal history.

§Arguments
  • coin - Filter by coin (optional)
  • withdraw_order_id - Filter by client withdrawal ID (optional)
  • status - Filter by status (optional)
  • start_time - Start timestamp (optional)
  • end_time - End timestamp (optional)
  • offset - Pagination offset (optional)
  • limit - Number of records (default 1000, max 1000)
§Example
let withdrawals = client.wallet()
    .withdraw_history(None, None, None, None, None, None, Some(10))
    .await?;
Source

pub async fn asset_detail( &self, asset: Option<&str>, ) -> Result<HashMap<String, AssetDetail>>

Get asset detail (deposit/withdraw fees and status).

§Arguments
  • asset - Asset symbol (optional, returns all if not specified)
§Example
let details = client.wallet().asset_detail(Some("BTC")).await?;
Source

pub async fn trade_fee(&self, symbol: Option<&str>) -> Result<Vec<TradeFee>>

Get trade fee for symbols.

§Arguments
  • symbol - Trading pair symbol (optional, returns all if not specified)
§Example
let fees = client.wallet().trade_fee(Some("BTCUSDT")).await?;
for fee in fees {
    println!("{}: maker={}, taker={}",
        fee.symbol, fee.maker_commission, fee.taker_commission);
}
Source

pub async fn universal_transfer( &self, transfer_type: UniversalTransferType, asset: &str, amount: &str, from_symbol: Option<&str>, to_symbol: Option<&str>, ) -> Result<TransferResponse>

Execute a universal transfer between accounts.

§Arguments
  • transfer_type - Type of transfer
  • asset - Asset to transfer
  • amount - Amount to transfer
  • from_symbol - Required for isolated margin transfers
  • to_symbol - Required for isolated margin transfers
§Example
use binance_api_client::UniversalTransferType;

let response = client.wallet()
    .universal_transfer(
        UniversalTransferType::MainFunding,
        "USDT",
        "100.0",
        None,
        None,
    )
    .await?;
println!("Transfer ID: {}", response.tran_id);
Source

pub async fn transfer_history( &self, transfer_type: UniversalTransferType, start_time: Option<u64>, end_time: Option<u64>, current: Option<u32>, size: Option<u32>, ) -> Result<TransferHistory>

Get universal transfer history.

§Arguments
  • transfer_type - Type of transfer to query
  • start_time - Start timestamp (optional)
  • end_time - End timestamp (optional)
  • current - Page number (default 1)
  • size - Page size (default 10, max 100)
§Example
use binance_api_client::UniversalTransferType;

let history = client.wallet()
    .transfer_history(UniversalTransferType::MainFunding, None, None, None, Some(10))
    .await?;
Source

pub async fn funding_wallet( &self, asset: Option<&str>, need_btc_valuation: Option<bool>, ) -> Result<Vec<FundingAsset>>

Get funding wallet balance.

§Arguments
  • asset - Asset to query (optional, returns all if not specified)
  • need_btc_valuation - Whether to include BTC valuation (optional)
§Example
let assets = client.wallet().funding_wallet(None, Some(true)).await?;
for asset in assets {
    println!("{}: {}", asset.asset, asset.free);
}
Source

pub async fn wallet_balance(&self) -> Result<Vec<WalletBalance>>

Get wallet balance for all asset wallets.

§Example
let balances = client.wallet().wallet_balance().await?;
for balance in balances {
    if balance.balance > 0.0 {
        println!("{}: {}", balance.wallet_name, balance.balance);
    }
}
Source

pub async fn account_status(&self) -> Result<AccountStatus>

Get account status.

§Example
let status = client.wallet().account_status().await?;
println!("Account status: {}", status.data);
Source

pub async fn api_trading_status(&self) -> Result<ApiTradingStatus>

Get API trading status.

§Example
let status = client.wallet().api_trading_status().await?;
if status.data.is_locked {
    println!("Trading is locked!");
}
Source

pub async fn api_key_permissions(&self) -> Result<ApiKeyPermissions>

Get API key permissions.

§Example
let permissions = client.wallet().api_key_permissions().await?;
println!("Can trade: {}", permissions.enable_spot_and_margin_trading);
println!("Can withdraw: {}", permissions.enable_withdrawals);

Trait Implementations§

Source§

impl Clone for Wallet

Source§

fn clone(&self) -> Wallet

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§

§

impl Freeze for Wallet

§

impl !RefUnwindSafe for Wallet

§

impl Send for Wallet

§

impl Sync for Wallet

§

impl Unpin for Wallet

§

impl !UnwindSafe for Wallet

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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