com.binance.connector.client.impl.spot.Wallet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of binance-connector-java Show documentation
Show all versions of binance-connector-java Show documentation
lightweight connector to API
package com.binance.connector.client.impl.spot;
import java.util.ArrayList;
import java.util.Map;
import com.binance.connector.client.enums.HttpMethod;
import com.binance.connector.client.utils.ParameterChecker;
import com.binance.connector.client.utils.ProxyAuth;
import com.binance.connector.client.utils.RequestHandler;
import com.binance.connector.client.utils.signaturegenerator.HmacSignatureGenerator;
import com.binance.connector.client.utils.signaturegenerator.SignatureGenerator;
/**
* Wallet Endpoints
* All endpoints under the
* Wallet Endpoint
* section of the API documentation will be implemented in this class.
*
* Response will be returned in String format.
*/
public class Wallet {
private final String baseUrl;
private final RequestHandler requestHandler;
private final boolean showLimitUsage;
public Wallet(String baseUrl, String apiKey, String secretKey, boolean showLimitUsage, ProxyAuth proxy) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, new HmacSignatureGenerator(secretKey), proxy);
this.showLimitUsage = showLimitUsage;
}
public Wallet(String baseUrl, String apiKey, SignatureGenerator signatureGenerator, boolean showLimitUsage, ProxyAuth proxy) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, signatureGenerator, proxy);
this.showLimitUsage = showLimitUsage;
}
private final String SYSTEM_STATUS = "/sapi/v1/system/status";
/**
* Fetch system status.
*
* GET /sapi/v1/system/status
*
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#system-status-system
*/
public String systemStatus() {
return requestHandler.sendPublicRequest(baseUrl, SYSTEM_STATUS, null, HttpMethod.GET, showLimitUsage);
}
private final String COIN_INFO = "/sapi/v1/capital/config/getall";
/**
* Get information of coins (available for deposit and withdraw) for user.
*
* GET /sapi/v1/capital/config/getall
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
*/
public String coinInfo(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, COIN_INFO, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ACCOUNT_SNAPSHOT = "/sapi/v1/accountSnapshot";
/**
* - The query time period must be less than 30 days
* - Support query within the last one month only
* - If startTime and endTime are both not sent, records from the last 7 days are returned by default
*
* GET /sapi/v1/accountSnapshot
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* type -- mandatory/string -- "SPOT", "MARGIN", "FUTURES"
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/int -- min 5, max 30, default 5
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#daily-account-snapshot-user_data
*/
public String accountSnapshot(Map parameters) {
ParameterChecker.checkParameter(parameters, "type", String.class);
return requestHandler.sendSignedRequest(baseUrl, ACCOUNT_SNAPSHOT, parameters, HttpMethod.GET, showLimitUsage);
}
private final String DISABLE_FAST_WITHDRAW = "/sapi/v1/account/disableFastWithdrawSwitch";
/**
* - This request will disable fastwithdraw switch under your account.
* - You need to enable "trade" option for the api key which requests this endpoint.
*
* POST /sapi/v1/account/disableFastWithdrawSwitch
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#disable-fast-withdraw-switch-user_data
*/
public String disableFastWithdraw(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, DISABLE_FAST_WITHDRAW, parameters, HttpMethod.POST, showLimitUsage);
}
private final String ENABLE_FAST_WITHDRAW = "/sapi/v1/account/enableFastWithdrawSwitch";
/**
* - This request will enable fastwithdraw 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.
*
* POST /sapi/v1/account/enableFastWithdrawSwitch
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#enable-fast-withdraw-switch-user_data
*/
public String enableFastWithdraw(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ENABLE_FAST_WITHDRAW, parameters, HttpMethod.POST, showLimitUsage);
}
private final String WITHDRAW = "/sapi/v1/capital/withdraw/apply";
/**
* Submit a withdraw request.
*
* - 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 `Get /sapi/v1/capital/config/getall (HMAC SHA256)`.
*
* POST /sapi/v1/capital/withdraw/apply
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* coin -- mandatory/string
* withdrawOrderId -- optional/string -- Client ID for withdraw
* network -- optional/string
* address -- mandatory/string
* addressTag -- optional/string -- Secondary address identifier for coins like XRP,XMR etc.
* amount -- mandatory/decimal
* transactionFeeFlag -- optional/boolean -- When making internal transfer, true for returning the fee to the destination account;
* false for returning the fee back to the departure account. Default false.
* name -- optional/string -- Description of the address. Space in name should be encoded into %20.
* walletType -- optional/int -- The wallet type for withdraw, 0-spot wallet , 1-funding wallet.Default spot wallet
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#withdraw-user_data
*/
public String withdraw(Map parameters) {
ParameterChecker.checkParameter(parameters, "coin", String.class);
ParameterChecker.checkParameter(parameters, "address", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, WITHDRAW, parameters, HttpMethod.POST, showLimitUsage);
}
private final String DEPOSIT_HISTORY = "/sapi/v1/capital/deposit/hisrec";
/**
* Fetch deposit history.
*
* - 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 /sapi/v1/capital/deposit/hisrec
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* coin -- optional/string
* status -- optional/int -- 0(0:pending,6: credited but cannot withdraw, 1:success)
* startTime -- optional/long -- Default: 90 days from current timestamp
* endTime -- optional/long -- Default: present timestamp
* offset -- optional/int -- Default:0
* limit -- optional/int -- Default:1000, Max:1000
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#deposit-history-supporting-network-user_data
*/
public String depositHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, DEPOSIT_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String WITHDRAW_HISTORY = "/sapi/v1/capital/withdraw/history";
/**
* Fetch withdraw history.
*
* This endpoint specifically uses per second UID rate limit, user's total second level IP rate limit is 180000/second. Response from the endpoint contains header key X-SAPI-USED-UID-WEIGHT-1S, which defines weight used by the current IP.
*
* - `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 /sapi/v1/capital/withdraw/history
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* coin -- optional/string
* withdrawOrderId -- optional/string
* status -- optional/int -- 0(0:Email Sent,1:Cancelled 2:Awaiting Approval 3:Rejected 4:Processing 5:Failure 6:Completed)
* startTime -- optional/long -- Default: 90 days from current timestamp
* endTime -- optional/long -- Default: present timestamp
* offset -- optional/int
* limit -- optional/int -- Default:1000, Max:1000
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
*/
public String withdrawHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, WITHDRAW_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String DEPOSIT_ADDRESS = "/sapi/v1/capital/deposit/address";
/**
* Fetch deposit address with network.
*
* - If network is not send, return with default network of the coin.
* - You can get network and isDefault in networkList in the response of Get /sapi/v1/capital/config/getall.
*
* GET /sapi/v1/capital/deposit/address
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* coin -- mandatory/string
* network -- optional/string
* amount -- optional/decimal -- mandatory if using LIGHTNING network
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#deposit-address-supporting-network-user_data
*/
public String depositAddress(Map parameters) {
ParameterChecker.checkParameter(parameters, "coin", String.class);
return requestHandler.sendSignedRequest(baseUrl, DEPOSIT_ADDRESS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String DEPOSIT_ADDRESSES = "/sapi/v1/capital/deposit/address/list";
/**
* Fetch deposit address list with network.
*
* - If network is not send, return with default network of the coin.
* - You can get network and isDefault in networkList in the response of Get /sapi/v1/capital/config/getall.
*
* GET /sapi/v1/capital/deposit/address/list
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* coin -- mandatory/string
* network -- optional/string
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#fetch-deposit-address-list-with-network-user_data
*/
public String depositAddresses(Map parameters) {
ParameterChecker.checkParameter(parameters, "coin", String.class);
return requestHandler.sendSignedRequest(baseUrl, DEPOSIT_ADDRESSES, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ACCOUNT_STATUS = "/sapi/v1/account/status";
/**
* Fetch account status detail.
*
* GET /sapi/v1/account/status
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#account-status-user_data
*/
public String accountStatus(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ACCOUNT_STATUS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String API_TRADE_STATUS = "/sapi/v1/account/apiTradingStatus";
/**
* Fetch account API trading status with details.
*
* GET /sapi/v1/account/apiTradingStatus
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#account-api-trading-status-user_data
*/
public String apiTradingStatus(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, API_TRADE_STATUS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String DUST_LOG = "/sapi/v1/asset/dribblet";
/**
* GET /sapi/v1/asset/dribblet
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* startTime -- optional/long
* endTime -- optional/long
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#dustlog-user_data
*/
public String dustLog(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, DUST_LOG, parameters, HttpMethod.GET, showLimitUsage);
}
private final String BNB_CONVERTIBLE_ASSETS = "/sapi/v1/asset/dust-btc";
/**
* POST /sapi/v1/asset/dust-btc
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#get-assets-that-can-be-converted-into-bnb-user_data
*/
public String bnbConvertableAssets(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, BNB_CONVERTIBLE_ASSETS, parameters, HttpMethod.POST, showLimitUsage);
}
private final String DUST_TRANSFER = "/sapi/v1/asset/dust";
/**
* Convert dust assets to BNB.
*
* POST /sapi/v1/asset/dust
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* asset -- mandatory/array -- The asset being converted. For example: asset=BTC&asset=USDT
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#dust-transfer-user_data
*/
public String dustTransfer(Map parameters) {
ParameterChecker.checkParameter(parameters, "asset", ArrayList.class);
return requestHandler.sendSignedRequest(baseUrl, DUST_TRANSFER, parameters, HttpMethod.POST, showLimitUsage);
}
private final String ASSET_DIVIDEND = "/sapi/v1/asset/assetDividend";
/**
* Query asset dividend record.
*
* GET /sapi/v1/asset/assetDividend
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* asset -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/int -- Default 20, max 500
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#asset-dividend-record-user_data
*/
public String assetDividend(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ASSET_DIVIDEND, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ASSET_DETAIL = "/sapi/v1/asset/assetDetail";
/**
* Fetch details of assets supported on Binance.
*
* - Please get network and other deposit or withdraw details from `GET /sapi/v1/capital/config/getall`.
*
* GET /sapi/v1/asset/assetDetail
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* asset -- optional/string
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#asset-detail-user_data
*/
public String assetDetail(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ASSET_DETAIL, parameters, HttpMethod.GET, showLimitUsage);
}
private final String TRADE_FEE = "/sapi/v1/asset/tradeFee";
/**
* Fetch trade fee.
*
* GET /sapi/v1/asset/tradeFee
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* symbol -- optional/string
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
*/
public String tradeFee(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, TRADE_FEE, parameters, HttpMethod.GET, showLimitUsage);
}
private final String UNIVERSAL_TRANSFER = "/sapi/v1/asset/transfer";
/**
* You need to enable Permits Universal Transfer option for the api key which requests this endpoint.
*
* POST /sapi/v1/asset/transfer
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* type -- mandatory/enum -- Universal transfer type
* asset -- mandatory/string
* amount -- mandatory/decimal
* fromSymbol -- optional/string
* toSymbol -- optional/string
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
*/
public String universalTransfer(Map parameters) {
ParameterChecker.checkParameter(parameters, "type", String.class);
ParameterChecker.checkParameter(parameters, "asset", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, UNIVERSAL_TRANSFER, parameters, HttpMethod.POST, showLimitUsage);
}
/**
* GET /sapi/v1/asset/transfer
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* type -- mandatory/enum
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/int -- Default 1
* size -- optional/int -- Default 10, Max 100
* fromSymbol -- optional/string
* toSymbol -- optional/string
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history-user_data
*/
public String queryUniversalTransfer(Map parameters) {
ParameterChecker.checkParameter(parameters, "type", String.class);
return requestHandler.sendSignedRequest(baseUrl, UNIVERSAL_TRANSFER, parameters, HttpMethod.GET, showLimitUsage);
}
private final String FUNDING_WALLET = "/sapi/v1/asset/get-funding-asset";
/**
* POST /sapi/v1/asset/get-funding-asset
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* asset -- optional/string
* needBtcValuation -- optional/string -- true or false
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#funding-wallet-user_data
*/
public String fundingWallet(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, FUNDING_WALLET, parameters, HttpMethod.POST, showLimitUsage);
}
private final String API_PERMISSION = "/sapi/v1/account/apiRestrictions";
/**
* GET /sapi/v1/account/apiRestrictions
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#get-api-key-permission-user_data
*/
public String apiPermission(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, API_PERMISSION, parameters, HttpMethod.GET, showLimitUsage);
}
private final String USER_ASSET = "/sapi/v3/asset/getUserAsset";
/**
* Get user assets, just for positive data.
*
* POST /sapi/v3/asset/getUserAsset
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* asset -- optional/string -- If asset is blank, then query all positive assets user have.
* needBtcValuation -- optional/boolean -- Whether need btc valuation or not.
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#user-asset-user_data
*/
public String getUserAsset(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, USER_ASSET, parameters, HttpMethod.POST, showLimitUsage);
}
private final String BUSD_CONVERT = "/sapi/v1/asset/convert-transfer";
/**
* Convert transfer, convert between BUSD and stablecoins.
*
* - If the clientId has been used before, will not do the convert transfer, the original transfer will be returned.
*
* POST /sapi/v1/asset/convert-transfer
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* clientTranId -- mandatory/string -- The unique user-defined transaction id, min length 20
* asset -- mandatory/string -- The current asset
* amount -- mandatory/BigDecimal -- The amount must be positive number
* targetAsset -- mandatory/string -- Target asset you want to convert
* accountType -- optional/string -- Only MAIN and CARD, default MAIN
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#busd-convert-trade
*/
public String busdConvert(Map parameters) {
ParameterChecker.checkParameter(parameters, "clientTranId", String.class);
ParameterChecker.checkParameter(parameters, "asset", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
ParameterChecker.checkParameter(parameters, "targetAsset", String.class);
return requestHandler.sendSignedRequest(baseUrl, BUSD_CONVERT, parameters, HttpMethod.POST, showLimitUsage);
}
private final String BUSD_CONVERT_HISTORY = "/sapi/v1/asset/convert-transfer/queryByPage";
/**
*
* GET /sapi/v1/asset/convert-transfer/queryByPage
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
*
* startTime -- mandatory/long -- inclusive, unit: ms
* endTime -- mandatory/long -- exclusive, unit: ms
* tranId -- optional/long -- The transaction id
* clientTranId -- optional/string -- The unique user-defined transaction id
* asset -- optional/string -- If not sent or null, deducted asset and target asset are returned.
* accountType -- optional/string -- MAIN: main account. CARD: funding account. If not sent or null, spot and card wallet will be queried.
* current -- optional/integer -- current page, default 1, the min value is 1
* size -- optional/integer -- page size, default 10, the max value is 100
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#busd-convert-history-user_data
*/
public String busdConvertHistory(Map parameters) {
ParameterChecker.checkParameter(parameters, "startTime", Long.class);
ParameterChecker.checkParameter(parameters, "endTime", Long.class);
return requestHandler.sendSignedRequest(baseUrl, BUSD_CONVERT_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String CLOUD_MINING_HISTORY = "/sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage";
/**
* The query of Cloud-Mining payment and refund history
*
* GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
*
* startTime -- mandatory/long -- inclusive, unit: ms
* endTime -- mandatory/long -- exclusive, unit: ms
* tranId -- optional/long -- The transaction id
* clientTranId -- optional/string -- The unique flag
* asset -- optional/string -- If not sent, we will query all assets.
* current -- optional/integer -- current page, default 1, the min value is 1
* size -- optional/integer -- page size, default 10, the max value is 100
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#get-cloud-mining-payment-and-refund-history-user_data
*/
public String cloudMiningHistory(Map parameters) {
ParameterChecker.checkParameter(parameters, "startTime", Long.class);
ParameterChecker.checkParameter(parameters, "endTime", Long.class);
return requestHandler.sendSignedRequest(baseUrl, CLOUD_MINING_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String BUSD_AUTO_CONVERT = "/sapi/v1/capital/contract/convertible-coins";
/**
* Get the stable coins set for auto-conversion to BUSD at deposit/withdrawal moments.
*
*
* GET /sapi/v1/capital/contract/convertible-coins
*
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#query-auto-converting-stable-coins-user_data
*/
public String getBusdAutoConvertions() {
return requestHandler.sendSignedRequest(baseUrl, BUSD_AUTO_CONVERT, null, HttpMethod.GET, showLimitUsage);
}
/**
* Switch on/off the BUSD auto-conversion from/to a specific stable coin.
*
*
* POST /sapi/v1/capital/contract/convertible-coins
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* coin -- mandatory/string -- Must be USDC, USDP or TUSD
* enable -- mandatory/boolean -- true: turn on the auto-conversion. false: turn off the auto-conversion
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#switch-on-off-busd-and-stable-coins-conversion-user_data
*/
public String switchBusdAutoConversion(Map parameters) {
ParameterChecker.checkParameter(parameters, "coin", String.class);
ParameterChecker.checkParameter(parameters, "enable", Boolean.class);
return requestHandler.sendSignedRequest(baseUrl, BUSD_AUTO_CONVERT, parameters, HttpMethod.POST, showLimitUsage);
}
private final String APPLY_ONE_CLICK_ARRIVAL_DEPOSIT = "/sapi/v1/capital/deposit/credit-apply";
/**
* Apply deposit credit for expired address (One click arrival)
*
*
* POST /sapi/v1/capital/deposit/credit-apply
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* depositId -- optional/long -- Deposit record ID, priority use
* txId -- optional/string -- Deposit txId, used when depositId is not specified
* subAccountId -- optional/long
* subUserId -- optional/long
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#one-click-arrival-deposit-apply-for-expired-address-deposit-user_data
*/
public String applyOneClickArrivalDeposit(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, APPLY_ONE_CLICK_ARRIVAL_DEPOSIT, parameters, HttpMethod.POST, showLimitUsage);
}
private final String WALLET_BALANCE = "/sapi/v1/asset/wallet/balance";
/**
* Query User Wallet Balance
*
*
* GET /sapi/v1/asset/wallet/balance
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#query-user-wallet-balance-user_data
*/
public String walletBalance(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, WALLET_BALANCE, parameters, HttpMethod.GET, showLimitUsage);
}
private final String QUERY_USER_DELEGATION_HISTORY = "/sapi/v1/asset/custody/transfer-history";
/**
* Query User Delegation History
*
* You need to open Enable Spot and Margin Trading permission for the API Key which requests this endpoint
*
*
* GET /sapi/v1/asset/custody/transfer-history
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* email -- mandatory/string
* startTime -- mandatory/long
* endTime -- mandatory/long
* type -- optional/enum -- "Delegate" or "Undelegate"
* asset -- optional/string
* current -- optional/integer -- Current querying page. Start from 1. Default:1
* size -- optional/integer -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#query-user-delegation-history-for-master-account-user_data
*/
public String delegationHistory(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "startTime", Long.class);
ParameterChecker.checkParameter(parameters, "endTime", Long.class);
return requestHandler.sendSignedRequest(baseUrl, QUERY_USER_DELEGATION_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
}