Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
* 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) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, new HmacSignatureGenerator(secretKey));
this.showLimitUsage = showLimitUsage;
}
public Wallet(String baseUrl, String apiKey, SignatureGenerator signatureGenerator, boolean showLimitUsage) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, signatureGenerator);
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 LinkedHashedMap 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(LinkedHashMap parameters) {
return requestHandler.sendSignedRequest(baseUrl, COIN_INFO, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ACC_SNAP = "/sapi/v1/accountSnapshot";
/**
* GET /sapi/v1/accountSnapshot
*
* @param
* parameters LinkedHashedMap 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(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "type", String.class);
return requestHandler.sendSignedRequest(baseUrl, ACC_SNAP, parameters, HttpMethod.GET, showLimitUsage);
}
private final String DISABLE_FAST = "/sapi/v1/account/disableFastWithdrawSwitch";
/**
* POST /sapi/v1/account/disableFastWithdrawSwitch
*
* @param
* parameters LinkedHashedMap 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(LinkedHashMap parameters) {
return requestHandler.sendSignedRequest(baseUrl, DISABLE_FAST, parameters, HttpMethod.POST, showLimitUsage);
}
private final String ENABLE_FAST = "/sapi/v1/account/enableFastWithdrawSwitch";
/**
* POST /sapi/v1/account/enableFastWithdrawSwitch
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* POST /sapi/v1/capital/withdraw/apply
*
* @param
* parameters LinkedHashedMap 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(LinkedHashMap 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_HIST = "/sapi/v1/capital/deposit/hisrec";
/**
* Fetch deposit history.
*
* GET /sapi/v1/capital/deposit/hisrec
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* GET /sapi/v1/capital/withdraw/history
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* GET /sapi/v1/capital/withdraw/history
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* GET /sapi/v1/account/status
*
* @param
* parameters LinkedHashedMap 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(LinkedHashMap parameters) {
return requestHandler.sendSignedRequest(baseUrl, ACC_STATUS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String API_TRADE_STATUS = "/sapi/v1/account/apiTradingStatus";
/**
* Fetch account api trading status detail.
*
* GET /sapi/v1/account/apiTradingStatus
*
* @param
* parameters LinkedHashedMap 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(LinkedHashMap parameters) {
return requestHandler.sendSignedRequest(baseUrl, API_TRADE_STATUS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String DUST_LOG = "/sapi/v1/asset/dribblet";
/**
* Fetch account api trading status detail.
*
* GET /sapi/v1/account/apiTradingStatus
*
* @param
* parameters LinkedHashedMap 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(LinkedHashMap parameters) {
return requestHandler.sendSignedRequest(baseUrl, DUST_LOG, parameters, HttpMethod.GET, showLimitUsage);
}
private final String BNB_CONVERTABLE_ASSETS = "/sapi/v1/asset/dust-btc";
/**
* POST /sapi/v1/asset/dust-btc
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* POST /sapi/v1/asset/dust
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* GET /sapi/v1/asset/assetDividend
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* GET /sapi/v1/asset/assetDetail
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* GET /sapi/v1/asset/tradeFee
*
* @param
* parameters LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* type -- mandatory/enum
* asset -- mandatory/string
* amount -- mandatory/string
* 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap parameters) {
return requestHandler.sendSignedRequest(baseUrl, USER_ASSET, parameters, HttpMethod.POST, showLimitUsage);
}
}