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
impl Wallet
Sourcepub async fn system_status(&self) -> Result<SystemStatus>
pub async fn system_status(&self) -> Result<SystemStatus>
Sourcepub async fn all_coins(&self) -> Result<Vec<CoinInfo>>
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);
}Sourcepub async fn account_snapshot(
&self,
snapshot_type: AccountSnapshotType,
start_time: Option<u64>,
end_time: Option<u64>,
limit: Option<u32>,
) -> Result<AccountSnapshot>
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?;Sourcepub async fn deposit_address(
&self,
coin: &str,
network: Option<&str>,
) -> Result<DepositAddress>
pub async fn deposit_address( &self, coin: &str, network: Option<&str>, ) -> Result<DepositAddress>
Sourcepub 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>>
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);
}Sourcepub async fn withdraw(
&self,
coin: &str,
address: &str,
amount: &str,
network: Option<&str>,
address_tag: Option<&str>,
withdraw_order_id: Option<&str>,
) -> Result<WithdrawResponse>
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 symboladdress- Withdrawal addressamount- Amount to withdrawnetwork- 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);Sourcepub 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>>
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?;Sourcepub async fn asset_detail(
&self,
asset: Option<&str>,
) -> Result<HashMap<String, AssetDetail>>
pub async fn asset_detail( &self, asset: Option<&str>, ) -> Result<HashMap<String, AssetDetail>>
Sourcepub async fn universal_transfer(
&self,
transfer_type: UniversalTransferType,
asset: &str,
amount: &str,
from_symbol: Option<&str>,
to_symbol: Option<&str>,
) -> Result<TransferResponse>
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 transferasset- Asset to transferamount- Amount to transferfrom_symbol- Required for isolated margin transfersto_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);Sourcepub async fn transfer_history(
&self,
transfer_type: UniversalTransferType,
start_time: Option<u64>,
end_time: Option<u64>,
current: Option<u32>,
size: Option<u32>,
) -> Result<TransferHistory>
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 querystart_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?;Sourcepub async fn funding_wallet(
&self,
asset: Option<&str>,
need_btc_valuation: Option<bool>,
) -> Result<Vec<FundingAsset>>
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);
}Sourcepub async fn wallet_balance(&self) -> Result<Vec<WalletBalance>>
pub async fn wallet_balance(&self) -> Result<Vec<WalletBalance>>
Sourcepub async fn account_status(&self) -> Result<AccountStatus>
pub async fn account_status(&self) -> Result<AccountStatus>
Sourcepub async fn api_trading_status(&self) -> Result<ApiTradingStatus>
pub async fn api_trading_status(&self) -> Result<ApiTradingStatus>
Sourcepub async fn api_key_permissions(&self) -> Result<ApiKeyPermissions>
pub async fn api_key_permissions(&self) -> Result<ApiKeyPermissions>
Trait Implementations§
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> 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