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 com.binance.connector.client.enums.HttpMethod;
import com.binance.connector.client.utils.ParameterChecker;
import com.binance.connector.client.utils.RequestHandler;
import java.util.LinkedHashMap;
/**
* 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) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, secretKey);
this.showLimitUsage = showLimitUsage;
}
private final String CREATE_SUB = "/sapi/v1/sub-account/virtualSubAccount";
/**
* POST /sapi/v1/sub-account/virtualSubAccount
*
* @param
* parameters LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#create-a-virtual-sub-account-for-master-account
*/
public String createVirtualSubAccount(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#query-sub-account-list-for-master-account
*/
public String subAccountList(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#query-sub-account-spot-asset-transfer-history-for-master-account
*/
public String spotTransferHistory(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#query-sub-account-futures-asset-transfer-history-for-master-account
*/
public String getFuturesInternalTransfer(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#sub-account-futures-asset-transfer-for-master-account
*/
public String futuresInternalTransfer(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#sub-account-futures-asset-transfer-for-master-account
*/
public String assets(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#query-sub-account-spot-assets-summary-for-master-account
*/
public String spotAccountSummary(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#get-sub-account-deposit-address-for-master-account
*/
public String depositAddress(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#get-sub-account-deposit-history-for-master-account
*/
public String depositHistory(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#get-sub-account-39-s-status-on-margin-futures-for-master-account
*/
public String accountStatus(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#enable-margin-for-sub-account-for-master-account
*/
public String enableMargin(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#get-detail-on-sub-account-39-s-margin-account-for-master-account
*/
public String marginAccount(LinkedHashMap 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 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-summary-of-sub-account-39-s-margin-account-for-master-account
*/
public String marginAccountSummary(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#enable-futures-for-sub-account-for-master-account
*/
public String enableFutures(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#get-detail-on-sub-account-39-s-futures-account-for-master-account
*/
public String futuresAccount(LinkedHashMap 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 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-summary-of-sub-account-39-s-futures-account-for-master-account
*/
public String futuresAccountSummary(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#get-futures-position-risk-of-sub-account-for-master-account
*/
public String futuresPositionRisk(LinkedHashMap 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 LinkedHashedMap 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/deciaml -- 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://binance-docs.github.io/apidocs/spot/en/#futures-transfer-for-sub-account-for-master-account
*/
public String futuresTransfer(LinkedHashMap 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 LinkedHashedMap 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/deciaml -- 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://binance-docs.github.io/apidocs/spot/en/#margin-transfer-for-sub-account-for-master-account
*/
public String marginTransfer(LinkedHashMap 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 LinkedHashedMap 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/deciaml -- The amount to be transferred
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#transfer-to-sub-account-of-same-master-for-sub-account
*/
public String subAccountToSubAccount(LinkedHashMap 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 LinkedHashedMap 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/deciaml -- The amount to be transferred
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#transfer-to-master-for-sub-account
*/
public String subAccountToMaster(LinkedHashMap 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 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 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://binance-docs.github.io/apidocs/spot/en/#sub-account-transfer-history-for-sub-account
*/
public String transferHistory(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#universal-transfer-for-master-account
*/
public String universalTransfer(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#query-universal-transfer-history-for-master-account
*/
public String queryUniversalTransfer(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#get-detail-on-sub-account-39-s-futures-account-v2-for-master-account
*/
public String futuresAccountV2(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#get-summary-of-sub-account-39-s-futures-account-v2-for-master-account
*/
public String futuresAccountSummaryV2(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#get-futures-position-risk-of-sub-account-v2-for-master-account
*/
public String futuresPositionRiskV2(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#enable-leverage-token-for-sub-account-for-master-account
*/
public String enableLeverageToken(LinkedHashMap 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";
/**
* POST /sapi/v1/sub-account/subAccountApi/ipRestriction
*
* @param
* parameters LinkedHashedMap 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
* ipRestrict -- mandatory/boolean -- true or false
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#enable-or-disable-ip-restriction-for-a-sub-account-api-key-for-master-account
*/
public String enableIpRestriction(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "subAccountApiKey", String.class);
ParameterChecker.checkParameter(parameters, "ipRestrict", Boolean.class);
return requestHandler.sendSignedRequest(baseUrl, IP_RESTRICTION, parameters, HttpMethod.POST, showLimitUsage);
}
/**
* GET /sapi/v1/sub-account/subAccountApi/ipRestriction
*
* @param
* parameters LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#get-ip-restriction-for-a-sub-account-api-key-for-master-account
*/
public String getIpRestriction(LinkedHashMap 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";
/**
* You need to make sure you have used this endpointPOST /sapi/v1/sub-account/subAccountApi/ipRestrictionenabled IP restriction,
* then you can add IP list by POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList.
*
* POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList
*
* @param
* parameters LinkedHashedMap 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 -- mandatory/string -- Can be added in batches, separated by commas
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#add-ip-list-for-a-sub-account-api-key-for-master-account
*/
public String addIpList(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "subAccountApiKey", String.class);
ParameterChecker.checkParameter(parameters, "ipAddress", String.class);
return requestHandler.sendSignedRequest(baseUrl, IP_LIST, parameters, HttpMethod.POST, showLimitUsage);
}
/**
* DELETE /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList
*
* @param
* parameters LinkedHashedMap 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 -- mandatory/string -- Can be added in batches, separated by commas
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#delete-ip-list-for-a-sub-account-api-key-for-master-account
*/
public String deleteIpList(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "email", String.class);
ParameterChecker.checkParameter(parameters, "subAccountApiKey", String.class);
ParameterChecker.checkParameter(parameters, "ipAddress", 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#deposit-assets-into-the-managed-sub-account-for-investor-master-account
*/
public String managedSubDeposit(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#query-managed-sub-account-asset-details-for-investor-master-account
*/
public String managedSubDetails(LinkedHashMap 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 LinkedHashedMap 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://binance-docs.github.io/apidocs/spot/en/#withdrawl-assets-from-the-managed-sub-account-for-investor-master-account
*/
public String managedSubWithdraw(LinkedHashMap 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);
}
}