Skip to main content
Version: 1.x

Wallet

 Maven Central Sonatype Nexus  License: MIT

Description

Binance4j-wallet is a Java connector for the wallet endpoints of the Binance REST API.

Installation

pom.xml
<dependency>
<groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<version>{{version}}</version>
</dependency>

Dependencies

Get system status

     
WalletClient client = new WalletClient(key, secret);

try{
SystemStatus response = client.getSystemStatus().execute();
}catch(ApiException e){
//...
}

Get all coins info

     
WalletClient client = new WalletClient(key, secret);

try{
List<CoinInformation> response = client.getAllCoinsInfo().execute();
}catch(ApiException e){
//...
}

Get Account snapshot

      
WalletClient client = new WalletClient(key, secret);

try{
SpotAccountSnapshotResponse response = client.getSpotAccountSnapshot().execute();
}catch(ApiException e){
//...
}

Enable fast withdraw switch

    

Enables fast withdraw switch under your account.

You need to enable trade option for the api key which requests this endpoint.

When Fast Withdraw Switch is on, transferring funds to a Binance account will be done instantly.

There is no on-chain transaction, no transaction ID and no withdrawal fee.

WalletClient client = new WalletClient(key, secret);

try{
client.enableFastWithdrawSwitch().execute();
}catch(ApiException e){
//...
}

Disable fast withdraw switch

    

Disables fast withdraw switch under your account.

You need to enable trade option for the api key which requests this endpoint.

WalletClient client = new WalletClient(key, secret);

try{
client.disableFastWithdrawSwitch().execute();
}catch(ApiException e){
//...
}

Withdraw

     

If network not send, return with default network of the coin.

You can get network and isDefault in networkList of a coin in the response of getAllCoinsInfo

WalletClient client = new WalletClient(key, secret);

WithdrawRequest request = new WithdrawRequest(new BigDecimal(1), "BTC", "0x00000000000000");

try{
WithdrawResult response = client.withdraw(request).execute();
}catch(ApiException e){
//...
}

Get deposit history

     

Fetches the deposit history of one or multiple coins.

WalletClient client = new WalletClient(key, secret);

try{
List<DepositHistory> response = client.getDepositHistory().execute();
}catch(ApiException e){
//...
}
note

Please notice the default startTime and endTime to make sure that time interval is within 0-90 days.

If both startTime and endTime are sent, time between startTime and endTime must be less than 90 days.

Get withdraw history

     

Fetches the withdraw history of one or multiple coins.

WalletClient client = new WalletClient(key, secret);

try{
List<WithdrawHistory> response = client.getWithdrawHistory().execute();
}catch(ApiException e){
//...
}
note

Network may not be in the response for old withdraw.

Please notice the default startTime and endTime to make sure that time interval is within 0-90 days.

If both startTime and endTime are sent, time between startTime and endTime must be less than 90 days.

If withdrawOrderId is sent, time between startTime and endTime must be less than 7 days.

If withdrawOrderId is sent, startTime and endTime are not sent, will return last 7 days records by default.

Get deposit address

     
WalletClient client = new WalletClient(key, secret);

WithdrawRequesDepositAddressRequest request = new WithdrawRequesDepositAddressRequest("BNB");

try{
DepositAddress response = client.getDepositAddress(request).execute();
}catch(ApiException e){
//...
}
note

You can get network and isDefault in networkList in the response of getAllCoinsInfo

If network is not sent, return with default network of the coin.

Get account status

     
WalletClient client = new WalletClient(key, secret);

try{
AccountStatus response = client.getAccountstatus().execute();
}catch(ApiException e){
//...
}

Get API trading status

     
WalletClient client = new WalletClient(key, secret);

try{
ApiTradingStatus response = client.getApiTradingStatus().execute();
}catch(ApiException e){
//...
}

Get dust log

     
WalletClient client = new WalletClient(key, secret);

try{
DustLog response = client.getDustLog().execute();
}catch(ApiException e){
//...
}

Do a dust transfer

     
WalletClient client = new WalletClient(key, secret);

DustTransferRequest request = new DustTransferRequest(List.of("BTC","SHIB","DOGE"));

try{
DustTransferResponse response = client.dustTransfer(request).execute();
}catch(ApiException e){
//...
}

Get asset dividend record

     
WalletClient client = new WalletClient(key, secret);

try{
AssetDividendRecord response = client.getAssetDividendRecord().execute();
}catch(ApiException e){
//...
}

Get asset detail

     

Get the details of all assets supported by Binance

WalletClient client = new WalletClient(key, secret);

try{
Map<String, AssetDetail> response = client.getAssetDetail().execute();
}catch(ApiException e){
//...
}

Get trade fee

     
WalletClient client = new WalletClient(key, secret);

try{
List<TradeFee> response = client.getTradeFee().execute();
}catch(ApiException e){
//...
}

Make a universal transfer

     
WalletClient client = new WalletClient(key, secret);

WalletTransferRequest request = new WalletTransferRequest(new BigDecimal("100"), "BNB", WalletTransferType.MAIN_MARGIN);

try{
WalletTransferResponse response = client.transfer(request).execute();
}catch(ApiException e){
//...
}

Get transfer history

     
WalletClient client = new WalletClient(key, secret);

WalletTransferHistoryRequest request = new WalletTransferHistoryRequest(WalletTransferType.MAIN_MARGIN);

try{
WalletTransferHistory response = client.getTransferHistory(request).execute();
}catch(ApiException e){
//...
}

Get funding asset

     

Fetches the funding wallet asset balance

Currently supports querying the following business assets:Binance Pay, Binance Card, Binance Gift Card, Stock Token

WalletClient client = new WalletClient(key, secret);

try{
List<FundingAsset> response = client.getFundingWallet().execute();
}catch(ApiException e){
//...
}

Get API permissions

     
WalletClient client = new WalletClient(key, secret);

try{
ApiPermissions response = client.getApiPermissions().execute();
}catch(ApiException e){
//...
}