com.binance.connector.client.impl.spot.SubAccount 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.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;
/**
* Sub-Account Endpoints
* All endpoints under the
* Sub-Account Endpoint
* section of the API documentation will be implemented in this class.
*
* Response will be returned in String format.
*/
public class SubAccount {
private final String baseUrl;
private final RequestHandler requestHandler;
private final boolean showLimitUsage;
public SubAccount(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 SubAccount(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 CREATE_SUB = "/sapi/v1/sub-account/virtualSubAccount";
/**
* POST /sapi/v1/sub-account/virtualSubAccount
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* subAccountString -- mandatory/string -- Please input a string. We will create a virtual email using that string for you to register
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/account-management/Create-a-Virtual-Sub-account
*/
public String createVirtualSubAccount(Map parameters) {
ParameterChecker.checkParameter(parameters, "subAccountString", String.class);
return requestHandler.sendSignedRequest(baseUrl, CREATE_SUB, parameters, HttpMethod.POST, showLimitUsage);
}
private final String QUERY_SUB_LIST = "/sapi/v1/sub-account/list";
/**
* GET /sapi/v1/sub-account/list
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* email -- optional/string
* isFreeze -- optional/string -- true or false
* page -- optional/int -- Default value: 1
* limit -- optional/int -- Default value: 1, Max value: 200
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/account-management/Query-Sub-account-List
*/
public String subAccountList(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, QUERY_SUB_LIST, parameters, HttpMethod.GET, showLimitUsage);
}
private final String QUERY_SPOT_TRANSFER_HIST = "/sapi/v1/sub-account/sub/transfer/history";
/**
* GET /sapi/v1/sub-account/sub/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
*
* fromEmail -- optional/string
* toEmail -- optional/string -- true or false
* startTime -- optional/long
* endTime -- optional/long
* page -- optional/int -- Default value: 1
* limit -- optional/int -- Default value: 1, Max value: 200
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Spot-Asset-Transfer-History
*/
public String spotTransferHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, QUERY_SPOT_TRANSFER_HIST, parameters, HttpMethod.GET, showLimitUsage);
}
private final String FUTURES_TRANSFER = "/sapi/v1/sub-account/futures/internalTransfer";
/**
* GET /sapi/v1/sub-account/futures/internalTransfer
*
* @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
* futuresType -- mandatory/long -- 1:USDT-margined Futures,2: Coin-margined Futures
* startTime -- optional/long
* endTime -- optional/long
* page -- optional/int -- Default value: 1
* limit -- optional/int -- Default value: 1, Max value: 200
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Futures-Asset-Transfer-History
*/
public String getFuturesInternalTransfer(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "futuresType", Integer.class);
return requestHandler.sendSignedRequest(baseUrl, FUTURES_TRANSFER, parameters, HttpMethod.GET, showLimitUsage);
}
/**
* POST /sapi/v1/sub-account/futures/internalTransfer
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* fromEmail -- mandatory/string -- Sender email
* toEmail -- mandatory/string -- Recipient email
* futuresType -- mandatory/long -- 1:USDT-margined Futures,2: Coin-margined Futures
* asset -- mandatory/string
* amount -- mandatory/decimal
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Sub-account-Futures-Asset-Transfer
*/
public String futuresInternalTransfer(Map parameters) {
ParameterChecker.checkParameter(parameters, "fromEmail", String.class);
ParameterChecker.checkParameter(parameters, "toEmail", String.class);
ParameterChecker.checkParameter(parameters, "futuresType", Integer.class);
ParameterChecker.checkParameter(parameters, "asset", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, FUTURES_TRANSFER, parameters, HttpMethod.POST, showLimitUsage);
}
private final String SUB_ACC_ASSETS = "/sapi/v3/sub-account/assets";
/**
* Fetch sub-account assets.
*
* GET /sapi/v3/sub-account/assets
*
* @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 -- Sub account email
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Assets-V3
*/
public String assets(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_ACC_ASSETS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SPOT_ASSET_SUMMARY = "/sapi/v1/sub-account/spotSummary";
/**
* Get BTC valued asset summary of subaccounts.
*
* GET /sapi/v1/sub-account/spotSummary
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* email -- optional/string -- Sub account email
* page -- optional/long -- default 1
* size -- optional/long -- default 10, max 20
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Spot-Assets-Summary
*/
public String spotAccountSummary(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, SPOT_ASSET_SUMMARY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_DEPOSIT_ADDRESS = "/sapi/v1/capital/deposit/subAddress";
/**
* Fetch sub-account deposit address.
*
* GET /sapi/v1/capital/deposit/subAddress
*
* @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 -- Sub account email
* coin -- mandatory/string
* network -- optional/string
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Get-Sub-account-Deposit-Address
*/
public String depositAddress(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "coin", String.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_DEPOSIT_ADDRESS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_DEPOSIT_HISTORY = "/sapi/v1/capital/deposit/subHisrec";
/**
* Fetch sub-account deposit history.
*
* GET /sapi/v1/capital/deposit/subHisrec
*
* @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 -- Sub account email
* coin -- optional/string
* status -- optional/int -- 0(0:pending,6: credited but cannot withdraw, 1:success)
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/int
* offset -- optional/int -- default:0
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Get-Sub-account-Deposit-History
*/
public String depositHistory(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_DEPOSIT_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_ACC_STATUS = "/sapi/v1/sub-account/status";
/**
* GET /sapi/v1/sub-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
*
* email -- optional/string -- Sub account email
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/account-management/Get-Sub-accounts-Status-on-Margin-Or-Futures
*/
public String accountStatus(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, SUB_ACC_STATUS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ENABLE_MARGIN = "/sapi/v1/sub-account/margin/enable";
/**
* POST /sapi/v1/sub-account/margin/enable
*
* @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 -- Sub account email
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/account-management/Enable-Margin-for-Sub-account
*/
public String enableMargin(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
return requestHandler.sendSignedRequest(baseUrl, ENABLE_MARGIN, parameters, HttpMethod.POST, showLimitUsage);
}
private final String SUB_ACC_MARGIN = "/sapi/v1/sub-account/margin/account";
/**
* GET /sapi/v1/sub-account/margin/account
*
* @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 -- Sub account email
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Get-Detail-on-Sub-accounts-Margin-Account
*/
public String marginAccount(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_ACC_MARGIN, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_ACC_MARGIN_SUMMARY = "/sapi/v1/sub-account/margin/accountSummary";
/**
* GET /sapi/v1/sub-account/margin/accountSummary
*
* @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://developers.binance.com/docs/sub_account/asset-management/Get-Summary-of-Sub-accounts-Margin-Account
*/
public String marginAccountSummary(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, SUB_ACC_MARGIN_SUMMARY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ENABLE_FUTURES = "/sapi/v1/sub-account/futures/enable";
/**
* POST /sapi/v1/sub-account/futures/enable
*
* @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 -- Sub-account email
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/account-management/Enable-Futures-for-Sub-account
*/
public String enableFutures(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
return requestHandler.sendSignedRequest(baseUrl, ENABLE_FUTURES, parameters, HttpMethod.POST, showLimitUsage);
}
private final String SUB_ACC_FUTURES = "/sapi/v1/sub-account/futures/account";
/**
* GET /sapi/v1/sub-account/futures/account
*
* @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 -- Sub-account email
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Get-Detail-on-Sub-accounts-Futures-Account
*/
public String futuresAccount(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_ACC_FUTURES, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_ACC_FUTURES_SUMMARY = "/sapi/v1/sub-account/futures/accountSummary";
/**
* GET /sapi/v1/sub-account/futures/accountSummary
*
* @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://developers.binance.com/docs/sub_account/asset-management/Get-Summary-of-Sub-accounts-Futures-Account
*/
public String futuresAccountSummary(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, SUB_ACC_FUTURES_SUMMARY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_ACC_POSITION_RISK = "/sapi/v1/sub-account/futures/positionRisk";
/**
* GET /sapi/v1/sub-account/futures/positionRisk
*
* @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 -- Sub-Account email
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/account-management/Get-Futures-Position-Risk-of-Sub-account
*/
public String futuresPositionRisk(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_ACC_POSITION_RISK, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_ACC_FUTURES_TRANSFER = "/sapi/v1/sub-account/futures/transfer";
/**
* POST /sapi/v1/sub-account/futures/transfer
*
* @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 -- Sub-Account email
* asset -- mandatory/string -- The asset being transferred, e.g., USDT
* amount -- mandatory/decimal -- The amount to be transferred
* type -- mandatory/int -- 1: transfer from subaccount's spot account to its USDT-margined futures account
* 2: transfer from subaccount's USDT-margined futures account to its spot account
* 3: transfer from subaccount's spot account to its COIN-margined futures account
* 4:transfer from subaccount's COIN-margined futures account to its spot account
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Futures-Transfer-for-Sub-account
*/
public String futuresTransfer(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "asset", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
ParameterChecker.checkParameter(parameters, "type", Integer.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_ACC_FUTURES_TRANSFER, parameters, HttpMethod.POST, showLimitUsage);
}
private final String SUB_ACC_MARGIN_TRANSFER = "/sapi/v1/sub-account/margin/transfer";
/**
* POST /sapi/v1/sub-account/margin/transfer
*
* @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 -- Sub-Account email
* asset -- mandatory/string -- The asset being transferred, e.g., USDT
* amount -- mandatory/decimal -- The amount to be transferred
* type -- mandatory/int -- 1: transfer from subaccount's spot account to margin account
* 2: transfer from subaccount's margin account to its spot account
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Margin-Transfer-for-Sub-account
*/
public String marginTransfer(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "asset", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
ParameterChecker.checkParameter(parameters, "type", Integer.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_ACC_MARGIN_TRANSFER, parameters, HttpMethod.POST, showLimitUsage);
}
private final String SUB_TO_SUB = "/sapi/v1/sub-account/transfer/subToSub";
/**
* POST /sapi/v1/sub-account/transfer/subToSub
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* toEmail -- mandatory/string -- Sub-Account email
* asset -- mandatory/string -- The asset being transferred, e.g., USDT
* amount -- mandatory/decimal -- The amount to be transferred
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Transfer-to-Sub-account-of-Same-Master
*/
public String subAccountToSubAccount(Map parameters) {
ParameterChecker.checkParameter(parameters, "toEmail", String.class);
ParameterChecker.checkParameter(parameters, "asset", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, SUB_TO_SUB, parameters, HttpMethod.POST, showLimitUsage);
}
private final String SUB_TO_MASTER = "/sapi/v1/sub-account/transfer/subToMaster";
/**
* POST /sapi/v1/sub-account/transfer/subToMaster
*
* @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/string -- The asset being transferred, e.g., USDT
* amount -- mandatory/decimal -- The amount to be transferred
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Transfer-to-Master
*/
public String subAccountToMaster(Map parameters) {
ParameterChecker.checkParameter(parameters, "asset", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, SUB_TO_MASTER, parameters, HttpMethod.POST, showLimitUsage);
}
private final String SUB_TRANSFER_HIST = "/sapi/v1/sub-account/transfer/subUserHistory";
/**
* GET /sapi/v1/sub-account/transfer/subUserHistory
*
* @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 not sent, result of all assets will be returned
* type -- optional/int -- 1: transfer in, 2: transfer out
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/int -- Default 500
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Sub-account-Transfer-History
*/
public String transferHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, SUB_TRANSFER_HIST, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_UNIVERSAL_TRANSFER = "/sapi/v1/sub-account/universalTransfer";
/**
* POST /sapi/v1/sub-account/universalTransfer
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* fromEmail -- optional/string
* toEmail -- optional/string
* fromAccountType -- mandatory/string -- "SPOT","USDT_FUTURE","COIN_FUTURE"
* toAccountType -- mandatory/string -- "SPOT","USDT_FUTURE","COIN_FUTURE"
* clientTranId -- optional/string -- Must be unique
* asset -- mandatory/string
* amount -- mandatory/decimal
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Universal-Transfer
*/
public String universalTransfer(Map parameters) {
ParameterChecker.checkParameter(parameters, "fromAccountType", String.class);
ParameterChecker.checkParameter(parameters, "toAccountType", String.class);
ParameterChecker.checkParameter(parameters, "asset", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, SUB_UNIVERSAL_TRANSFER, parameters, HttpMethod.POST, showLimitUsage);
}
/**
* GET /sapi/v1/sub-account/universalTransfer
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* fromEmail -- optional/string
* toEmail -- optional/string
* clientTranId -- optional/string -- Must be unique
* startTime -- optional/long
* endTime -- optional/long
* page -- optional/int -- Default 1
* limit -- optional/int -- Default 500, Max 500
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Query-Universal-Transfer-History
*/
public String queryUniversalTransfer(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, SUB_UNIVERSAL_TRANSFER, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_FUTURES_ACCOUNT_V2 = "/sapi/v2/sub-account/futures/account";
/**
* GET /sapi/v2/sub-account/futures/account
*
* @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 -- Sub-account email
* futuresType -- mandatory/int -- 1:USDT Margined Futures, 2:COIN Margined Futures
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Get-Detail-on-Sub-accounts-Futures-Account-V2
*/
public String futuresAccountV2(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "futuresType", Integer.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_FUTURES_ACCOUNT_V2, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_FUTURES_ACCOUNT_SUMMARY_V2 = "/sapi/v2/sub-account/futures/accountSummary";
/**
* GET /sapi/v2/sub-account/futures/accountSummary
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* futuresType -- mandatory/int -- 1:USDT Margined Futures, 2:COIN Margined Futures
* page -- optional/int -- default:1
* limit -- optional/int -- default:10, max:20
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/asset-management/Get-Summary-of-Sub-accounts-Futures-Account-V2
*/
public String futuresAccountSummaryV2(Map parameters) {
ParameterChecker.checkParameter(parameters, "futuresType", Integer.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_FUTURES_ACCOUNT_SUMMARY_V2, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUB_FUTURES_POSITION_RISK_V2 = "/sapi/v2/sub-account/futures/positionRisk";
/**
* GET /sapi/v2/sub-account/futures/positionRisk
*
* @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 -- Sub-account email
* futuresType -- mandatory/int -- 1:USDT Margined Futures, 2:COIN Margined Futures
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/account-management/Get-Futures-Position-Risk-of-Sub-account-V2
*/
public String futuresPositionRiskV2(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "futuresType", Integer.class);
return requestHandler.sendSignedRequest(baseUrl, SUB_FUTURES_POSITION_RISK_V2, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ENABLE_LEVERAGE = "/sapi/v1/sub-account/blvt/enable";
/**
* GET /sapi/v2/sub-account/futures/positionRisk
*
* @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 -- Sub-account email
* enableBlvt -- mandatory/boolean -- Only true for now
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/account-management/Enable-Leverage-Token-for-Sub-account
*/
public String enableLeverageToken(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "enableBlvt", Boolean.class);
return requestHandler.sendSignedRequest(baseUrl, ENABLE_LEVERAGE, parameters, HttpMethod.POST, showLimitUsage);
}
private final String IP_RESTRICTION = "/sapi/v1/sub-account/subAccountApi/ipRestriction";
/**
* GET /sapi/v1/sub-account/subAccountApi/ipRestriction
*
* @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 -- Sub-account email
* subAccountApiKey -- mandatory/string
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/api-management/Get-IP-Restriction-for-a-Sub-account-API-Key
*/
public String getIpRestriction(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "subAccountApiKey", String.class);
return requestHandler.sendSignedRequest(baseUrl, IP_RESTRICTION, parameters, HttpMethod.GET, showLimitUsage);
}
private final String IP_LIST = "/sapi/v1/sub-account/subAccountApi/ipRestriction/ipList";
/**
* DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList
*
* @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 -- Sub-account email
* subAccountApiKey -- mandatory/string
* ipAddress -- optional/string -- Can be added in batches, separated by commas
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/api-management/Delete-IP-List-For-a-Sub-account-API-Key
*/
public String deleteIpList(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "subAccountApiKey", String.class);
return requestHandler.sendSignedRequest(baseUrl, IP_LIST, parameters, HttpMethod.DELETE, showLimitUsage);
}
private final String MANAGED_SUB_DEPOSIT = "/sapi/v1/managed-subaccount/deposit";
/**
* POST /sapi/v1/managed-subaccount/deposit
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* toEmail -- mandatory/string
* asset -- mandatory/string
* amount -- mandatory/decimal
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/managed-sub-account/Deposit-Assets-Into-The-Managed-Sub-account
*/
public String managedSubDeposit(Map parameters) {
ParameterChecker.checkParameter(parameters, "toEmail", String.class);
ParameterChecker.checkParameter(parameters, "asset", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, MANAGED_SUB_DEPOSIT, parameters, HttpMethod.POST, showLimitUsage);
}
private final String MANAGED_SUB_DETAILS = "/sapi/v1/managed-subaccount/asset";
/**
* GET /sapi/v1/managed-subaccount/asset
*
* @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
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/managed-sub-account/Query-Managed-Sub-account-Asset-Details
*/
public String managedSubDetails(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
return requestHandler.sendSignedRequest(baseUrl, MANAGED_SUB_DETAILS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String MANAGED_SUB_WITHDRAW = "/sapi/v1/managed-subaccount/withdraw";
/**
* POST /sapi/v1/managed-subaccount/withdraw
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* fromEmail -- mandatory/string
* asset -- mandatory/string
* amount -- mandatory/decimal
* transferDate -- optional/decimal -- Withdrawals is automatically occur on the transfer date(UTC0).
* If a date is not selected, the withdrawal occurs right now
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/managed-sub-account/Withdrawl-Assets-From-The-Managed-Sub-account
*/
public String managedSubWithdraw(Map parameters) {
ParameterChecker.checkParameter(parameters, "fromEmail", String.class);
ParameterChecker.checkParameter(parameters, "asset", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, MANAGED_SUB_WITHDRAW, parameters, HttpMethod.POST, showLimitUsage);
}
private final String MANAGED_SUB_SNAPSHOT = "/sapi/v1/managed-subaccount/accountSnapshot";
/**
* GET /sapi/v1/managed-subaccount/accountSnapshot
*
* @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
* type -- mandatory/string -- "SPOT", "MARGIN"(Cross), "FUTURES"(UM)
* startTime -- optional/long
* endTime -- optional/long
* limit -- int/long
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/managed-sub-account/Query-Managed-Sub-account-Snapshot
*/
public String managedSubAccountSnapshot(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "type", String.class);
return requestHandler.sendSignedRequest(baseUrl, MANAGED_SUB_SNAPSHOT, parameters, HttpMethod.GET, showLimitUsage);
}
private final String IP_RESTRICTION_V2 = "/sapi/v2/sub-account/subAccountApi/ipRestriction";
/**
* POST /sapi/v2/sub-account/subAccountApi/ipRestriction
*
* @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 -- Sub-account email
* subAccountApiKey -- mandatory/string
* status -- mandatory/string -- IP Restriction status. 1 = IP Unrestricted. 2 = Restrict access to trusted IPs only.
* ipAddress -- optional/string -- Insert static IP in batch, separated by commas.
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/sub_account/api-management/Add-IP-Restriction-for-Sub-Account-API-key
*/
public String updateIpRestriction(Map parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "subAccountApiKey", String.class);
ParameterChecker.checkParameter(parameters, "status", String.class);
return requestHandler.sendSignedRequest(baseUrl, IP_RESTRICTION_V2, parameters, HttpMethod.POST, showLimitUsage);
}
}