All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.binance.connector.client.impl.spot.Margin Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
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;

/**
 * 

Margin Endpoints

* All endpoints under the * Margin Account/Trade Endpoint * section of the API documentation will be implemented in this class. *
* Response will be returned in String format. */ public class Margin { private final String baseUrl; private final RequestHandler requestHandler; private final boolean showLimitUsage; public Margin(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 Margin(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 ALL_ASSETS = "/sapi/v1/margin/allAssets"; /** * GET /sapi/v1/margin/allAssets *
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-all-margin-assets-market_data */ public String allAssets() { return requestHandler.sendApiRequest(baseUrl, ALL_ASSETS, null, HttpMethod.GET, showLimitUsage); } private final String ALL_PAIRS = "/sapi/v1/margin/allPairs"; /** * GET /sapi/v1/margin/allPairs *
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-all-cross-margin-pairs-market_data */ public String allPairs() { return requestHandler.sendApiRequest(baseUrl, ALL_PAIRS, null, HttpMethod.GET, showLimitUsage); } private final String PRICE_INDEX = "/sapi/v1/margin/priceIndex"; /** * GET /sapi/v1/margin/priceIndex *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string * @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-priceindex-market_data */ public String priceIndex(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendApiRequest(baseUrl, PRICE_INDEX, parameters, HttpMethod.GET, showLimitUsage); } private final String ORDER = "/sapi/v1/margin/order"; /** * Post a new order for margin account. *

* POST /sapi/v1/margin/order *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE",default "FALSE"
* side -- mandatory/enum
* type -- mandatory/enum
* quantity -- optional/decimal
* quoteOrderQty -- optional/decimal
* price -- optional/decimal
* stopPrice -- optional/decimal -- Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
* newClientOrderId -- optional/string -- A unique id among open orders. Automatically generated if not sent.
* icebergQty -- optional/decimal -- Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
* newOrderRespType -- optional/enum -- Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK.
* sideEffectType -- optional/enum -- NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY, AUTO_BORROW_REPAY; default NO_SIDE_EFFECT.
* timeInForce -- optional/enum -- GTC,IOC,FOK
* selfTradePreventionMode -- optional/enum -- The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
* autoRepayAtCancel -- optional/boolean -- Only for when it's a MARGIN_BUY or AUTO_BORROW_REPAY. Default: true (debt generated by the order needs to be repaid after cancellation.)
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#margin-account-new-order-trade */ public String newOrder(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); ParameterChecker.checkParameter(parameters, "side", String.class); ParameterChecker.checkParameter(parameters, "type", String.class); return requestHandler.sendSignedRequest(baseUrl, ORDER, parameters, HttpMethod.POST, showLimitUsage); } /** * Cancel an active order for margin account. *

* DELETE /sapi/v1/margin/order *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE",default "FALSE"
* orderId -- optional/long
* origClientOrderId -- optional/string
* newClientOrderId -- optional/string -- Used to uniquely identify this cancel. Automatically generated by default.
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-order-trade */ public String cancelOrder(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, ORDER, parameters, HttpMethod.DELETE, showLimitUsage); } private final String OPEN_ORDERS = "/sapi/v1/margin/openOrders"; /** * Cancels all active orders on a symbol for margin account. * This includes OCO orders. *

* DELETE /sapi/v1/margin/openOrders *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE, default "FALSE"
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-all-open-orders-on-a-symbol-trade */ public String cancelOpenOrders(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, OPEN_ORDERS, parameters, HttpMethod.DELETE, showLimitUsage); } private final String TRANSFER_HISTORY = "/sapi/v1/margin/transfer"; /** * GET /sapi/v1/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 *

* asset -- optional/string
* type -- optional/string -- Transfer Type: ROLL_IN, ROLL_OUT
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default:10 Max:100
* archived -- optional/string -- Default: false. Set to true for archived data from 6 months ago
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-cross-margin-transfer-history-user_data */ public String transferHistory(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, TRANSFER_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String REPAY_RECORD = "/sapi/v1/margin/repay"; /** * GET /sapi/v1/margin/repay *
* @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
* isolatedSymbol -- optional/string
* txId -- optional/long -- the tranId in POST /sapi/v1/margin/loan
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default:10 Max:100
* archived -- optional/string -- Default: false. Set to true for archived data from 6 months ago
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-repay-record-user_data */ public String repayRecord(Map parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); return requestHandler.sendSignedRequest(baseUrl, REPAY_RECORD, parameters, HttpMethod.GET, showLimitUsage); } private final String INTEREST_HISTORY = "/sapi/v1/margin/interestHistory"; /** * GET /sapi/v1/margin/interestHistory *
* @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
* isolatedSymbol -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default:10 Max:100
* archived -- optional/string -- Default: false. Set to true for archived data from 6 months ago
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data */ public String interestHistory(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, INTEREST_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String FORCE_LIQUIDATION_RECORD = "/sapi/v1/margin/forceLiquidationRec"; /** * GET /sapi/v1/margin/forceLiquidationRec *
* @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
* isolatedSymbol -- optional/string
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- 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/#get-force-liquidation-record-user_data */ public String forceLiquidationRec(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, FORCE_LIQUIDATION_RECORD, parameters, HttpMethod.GET, showLimitUsage); } private final String ACCOUNT = "/sapi/v1/margin/account"; /** * GET /sapi/v1/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 *

* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-account-details-user_data */ public String account(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, ACCOUNT, parameters, HttpMethod.GET, showLimitUsage); } /** * GET /sapi/v1/margin/order *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE",default "FALSE"
* orderId -- optional/long
* origClientOrderId -- optional/string
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-order-user_data */ public String getOrder(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, ORDER, parameters, HttpMethod.GET, showLimitUsage); } /** * GET /sapi/v1/margin/openOrders *
* @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
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE",default "FALSE"
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-orders-user_data */ public String getOpenOrders(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, OPEN_ORDERS, parameters, HttpMethod.GET, showLimitUsage); } private final String ALL_ORDERS = "/sapi/v1/margin/allOrders"; /** * GET /sapi/v1/margin/allOrders *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE",default "FALSE"
* orderId -- optional/long
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/int -- Default 500; max 500.
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data */ public String getAllOrders(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, ALL_ORDERS, parameters, HttpMethod.GET, showLimitUsage); } private final String OCO_ORDER = "/sapi/v1/margin/order/oco"; /** * Send in a new OCO for a margin account. *

* POST /sapi/v1/margin/order/oco *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE",default "FALSE"
* listClientOrderId -- optional/string -- A unique Id for the entire orderList
* side -- mandatory/enum
* quantity -- mandatory/decimal
* limitClientOrderId -- optional/string -- A unique Id for the limit order
* price -- mandatory/decimal
* limitIcebergQty -- optional/decimal
* stopClientOrderId -- optional/string -- A unique Id for the stop loss/stop loss limit leg
* stopPrice -- optional/decimal -- Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
* stopLimitPrice -- optional/decimal -- If provided, stopLimitTimeInForce is required.
* stopIcebergQty -- optional/enum -- NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.
* stopLimitTimeInForce -- optional/enum -- GTC,IOC,FOK
* newOrderRespType -- optional/enum -- Set the response JSON.
* sideEffectType -- optional/enum -- NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY, AUTO_BORROW_REPAY; default NO_SIDE_EFFECT.
* selfTradePreventionMode -- optional/enum -- The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
* autoRepayAtCancel -- optional/boolean -- Only for when it's a MARGIN_BUY or AUTO_BORROW_REPAY. Default: true (debt generated by the order needs to be repaid after cancellation.)
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#margin-account-new-oco-trade */ public String ocoOrder(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); ParameterChecker.checkParameter(parameters, "side", String.class); ParameterChecker.checkRequiredParameter(parameters, "quantity"); ParameterChecker.checkRequiredParameter(parameters, "price"); ParameterChecker.checkRequiredParameter(parameters, "stopPrice"); return requestHandler.sendSignedRequest(baseUrl, OCO_ORDER, parameters, HttpMethod.POST, showLimitUsage); } private final String ORDER_LIST = "/sapi/v1/margin/orderList"; /** * Cancel an entire Order List for a margin account. *

* DELETE /sapi/v1/margin/orderList *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE", default "FALSE"
* orderListId -- optional/long -- Either orderListId or listClientOrderId must be provided
* listClientOrderId -- optional/string -- Either orderListId or listClientOrderId must be provided
* newClientOrderId -- optional/string -- Used to uniquely identify this cancel. Automatically generated by default
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-oco-trade */ public String cancelOcoOrder(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, ORDER_LIST, parameters, HttpMethod.DELETE, showLimitUsage); } /** * Retrieves a specific OCO based on provided optional parameters. *

* GET /sapi/v1/margin/orderList *
* @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 -- mandatory for isolated margin, not supported for cross margin
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE",default "FALSE"
* orderListId -- optional/long -- Either orderListId or listClientOrderId must be provided
* listClientOrderId -- optional/string -- Either orderListId or listClientOrderId must be provided
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-oco-user_data */ public String getOcoOrder(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, ORDER_LIST, parameters, HttpMethod.GET, showLimitUsage); } private final String GET_ALL_OCO = "/sapi/v1/margin/allOrderList"; /** * Retrieves all OCO for a specific margin account based on provided optional parameters. *

* GET /sapi/v1/margin/allOrderList *
* @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 -- mandatory for isolated margin, not supported for cross margin
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE",default "FALSE"
* fromId -- optional/long -- If supplied, neither startTime or endTime can be provided
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/int -- Default Value: 500; Max Value: 1000
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-oco-user_data */ public String getAllOcoOrders(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, GET_ALL_OCO, parameters, HttpMethod.GET, showLimitUsage); } private final String GET_OPEN_OCO = "/sapi/v1/margin/openOrderList"; /** * GET /sapi/v1/margin/openOrderList *
* @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 -- mandatory for isolated margin, not supported for cross margin
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE", default "FALSE"
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-oco-user_data */ public String getOcoOpenOrders(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, GET_OPEN_OCO, parameters, HttpMethod.GET, showLimitUsage); } private final String MY_TRADES = "/sapi/v1/margin/myTrades"; /** * GET /sapi/v1/margin/myTrades *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string -- mandatory for isolated margin, not supported for cross margin
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE,default "FALSE"
* startTime -- optional/long
* endTime -- optional/long
* fromId -- optional/long -- TradeId to fetch from. Default gets most recent trades.
* limit -- optional/int -- Default Value: 500; Max Value: 1000
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-trade-list-user_data */ public String trades(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, MY_TRADES, parameters, HttpMethod.GET, showLimitUsage); } private final String MAX_BORROW = "/sapi/v1/margin/maxBorrowable"; /** * GET /sapi/v1/margin/maxBorrowable *
* @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
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE,default "FALSE"
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-max-borrow-user_data */ public String maxBorrow(Map parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); return requestHandler.sendSignedRequest(baseUrl, MAX_BORROW, parameters, HttpMethod.GET, showLimitUsage); } private final String MAX_TRANSFERABLE = "/sapi/v1/margin/maxTransferable"; /** * GET /sapi/v1/margin/maxTransferable *
* @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
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE,default "FALSE"
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-max-transfer-out-amount-user_data */ public String maxTransferable(Map parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); return requestHandler.sendSignedRequest(baseUrl, MAX_TRANSFERABLE, parameters, HttpMethod.GET, showLimitUsage); } private final String ISOLATED_ACCOUNT = "/sapi/v1/margin/isolated/account"; /** * GET /sapi/v1/margin/isolated/account *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbols -- optional/string -- Max 5 symbols can be sent; separated by ",". e.g. "BTCUSDT,BNBUSDT,ADAUSDT"
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-account-info-user_data */ public String isolatedAccount(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, ISOLATED_ACCOUNT, parameters, HttpMethod.GET, showLimitUsage); } /** * DELETE /sapi/v1/margin/isolated/account *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#disable-isolated-margin-account-trade */ public String disableIsolatedAccount(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, ISOLATED_ACCOUNT, parameters, HttpMethod.DELETE, showLimitUsage); } /** * Enable isolated margin account for a specific symbol. *

* POST /sapi/v1/margin/isolated/account *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#enable-isolated-margin-account-trade */ public String enableIsolatedAccount(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, ISOLATED_ACCOUNT, parameters, HttpMethod.POST, showLimitUsage); } private final String ISOLATED_ACCOUNT_LIMIT = "/sapi/v1/margin/isolated/accountLimit"; /** * Query enabled isolated margin account limit. *

* GET /sapi/v1/margin/isolated/accountLimit *
* @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-enabled-isolated-margin-account-limit-user_data */ public String getIsolatedAccountLimit(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, ISOLATED_ACCOUNT_LIMIT, parameters, HttpMethod.GET, showLimitUsage); } private final String ALL_ISOLATED_SYMBOL = "/sapi/v1/margin/isolated/allPairs"; /** * GET /sapi/v1/margin/isolated/allPairs *
* @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/#get-all-isolated-margin-symbol-user_data */ public String getAllIsolatedSymbols(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, ALL_ISOLATED_SYMBOL, parameters, HttpMethod.GET, showLimitUsage); } private final String BNB_BURN = "/sapi/v1/bnbBurn"; /** * POST /sapi/v1/bnbBurn *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* spotBNBBurn -- optional/string -- "true" or "false"; Determines whether to use BNB to pay for trading fees on SPOT
* interestBNBBurn -- optional/string -- "true" or "false"; Determines whether to use BNB to pay for margin loan's interest
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#toggle-bnb-burn-on-spot-trade-and-margin-interest-user_data */ public String bnbBurn(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, BNB_BURN, parameters, HttpMethod.POST, showLimitUsage); } /** * GET /sapi/v1/bnbBurn *
* @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/#get-bnb-burn-status-user_data */ public String getBnbBurn(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, BNB_BURN, parameters, HttpMethod.GET, showLimitUsage); } private final String INTEREST_RATE_HIST = "/sapi/v1/margin/interestRateHistory"; /** * GET /sapi/v1/margin/interestRateHistory *
* @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 -- asset,such as BTC
* vipLevel -- optional/int -- Default: user's vip level
* startTime -- optional/long -- Default: 7 days ago
* endTime -- optional/long -- Default: present. Maximum range: 3 months.
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data */ public String interestRateHistory(Map parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); return requestHandler.sendSignedRequest(baseUrl, INTEREST_RATE_HIST, parameters, HttpMethod.GET, showLimitUsage); } private final String CROSS_MARGIN_DATA = "/sapi/v1/margin/crossMarginData"; /** * Get cross margin fee data collection with any vip level or user's current specific data as https://www.binance.com/en/margin-fee. *

* GET /sapi/v1/margin/crossMarginData *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* vipLevel -- optional/int -- User's current specific margin data will be returned if vipLevel is omitted
* coin -- optional/string
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-fee-data-user_data */ public String crossMarginData(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, CROSS_MARGIN_DATA, parameters, HttpMethod.GET, showLimitUsage); } private final String CROSS_MARGIN_COLLATERAL_RATIO = "/sapi/v1/margin/crossMarginCollateralRatio"; /** * Get cross margin collateral ratio * *

* GET /sapi/v1/margin/crossMarginCollateralRatio *
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#cross-margin-collateral-ratio-market_data */ public String crossMarginCollateralRatio() { return requestHandler.sendApiRequest(baseUrl, CROSS_MARGIN_COLLATERAL_RATIO, null, HttpMethod.GET, showLimitUsage); } private final String ADJUST_CROSS_MARGIN_MAX_LEVERAGE = "/sapi/v1/margin/max-leverage"; /** * Adjust cross margin max leverage * *

* POST /sapi/v1/margin/max-leverage *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* maxLeverage -- mandatory/integer -- Can only adjust to 3, 5 or 10. Example: maxLeverage=10 for Cross Margin Pro, maxLeverage = 5 or 3 for Cross Margin Classic
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-margin-max-leverage-user_data */ public String adjustCrossMarginMaxLeverage(Map parameters) { ParameterChecker.checkParameter(parameters, "maxLeverage", Integer.class); return requestHandler.sendSignedRequest(baseUrl, ADJUST_CROSS_MARGIN_MAX_LEVERAGE, parameters, HttpMethod.POST, showLimitUsage); } private final String ISOLATED_MARGIN_DATA = "/sapi/v1/margin/isolatedMarginData"; /** * Get isolated margin fee data collection with any vip level or user's current specific data as https://www.binance.com/en/margin-fee. *

* GET /sapi/v1/margin/isolatedMarginData *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* vipLevel -- optional/int -- User's current specific margin data will be returned if vipLevel is omitted
* symbol -- optional/string
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data */ public String isolatedMarginData(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, ISOLATED_MARGIN_DATA, parameters, HttpMethod.GET, showLimitUsage); } private final String ISOLATED_MARGIN_TIER = "/sapi/v1/margin/isolatedMarginTier"; /** * Get isolated margin tier data collection with any tier as https://www.binance.com/en/margin-data. *

* GET /sapi/v1/margin/isolatedMarginTier *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- mandatory/string
* tier -- optional/string -- All margin tier data will be returned if tier is omitted
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-tier-data-user_data */ public String isolatedMarginTier(Map parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, ISOLATED_MARGIN_TIER, parameters, HttpMethod.GET, showLimitUsage); } private final String ORDER_RATE_LIMIT = "/sapi/v1/margin/rateLimit/order"; /** * Displays the user's current margin order count usage for all intervals. *

* GET /sapi/v1/margin/rateLimit/order *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE", default "FALSE"
* symbol -- optional/string -- isolated symbol, mandatory for isolated margin
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-current-margin-order-count-usage-trade */ public String orderRateLimit(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, ORDER_RATE_LIMIT, parameters, HttpMethod.GET, showLimitUsage); } private final String AVAILABLE_INVENTORY = "/sapi/v1/margin/available-inventory"; /** * Get the available margin inventory *

* GET /sapi/v1/margin/available-inventory *
* @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 -- MARGIN, ISOLATED
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-available-inventory-user_data */ public String availableInventory(Map parameters) { ParameterChecker.checkParameter(parameters, "type", String.class); return requestHandler.sendSignedRequest(baseUrl, AVAILABLE_INVENTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String CAPITAL_FLOW = "/sapi/v1/margin/capital-flow"; /** * Get cross or isolated margin capital flow * *

* GET /sapi/v1/margin/capital-flow *
* @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
* symbol -- optional/string -- Required when querying isolated margin data
* type -- optional/string -- MARGIN, ISOLATED
* startTime -- optional/long -- Only supports querying the data of the last 90 days
* endTime -- optional/long -- UTC timestamp in ms
* fromId -- optional/long -- If fromId is set, the data with "id" above "fromId" will be returned. Otherwise the latest data will be returned
* limit -- optional/long -- The number of data items returned each time is limited. Default 500; Max 1000.
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-cross-or-isolated-margin-capital-flow-user_data */ public String capitalFlow(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, CAPITAL_FLOW, parameters, HttpMethod.GET, showLimitUsage); } private final String DELIST_SCHEDULE = "/sapi/v1/margin/delist-schedule"; /** * Get tokens or symbols delist schedule for cross margin and isolated margin * *

* GET /sapi/v1/margin/delist-schedule *
* @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/#get-tokens-or-symbols-delist-schedule-for-cross-margin-and-isolated-margin-market_data */ public String delistSchedule(Map parameters) { return requestHandler.sendApiRequest(baseUrl, DELIST_SCHEDULE, parameters, HttpMethod.GET, showLimitUsage); } private final String NEXT_HOURLY_INTEREST_RATE = "/sapi/v1/margin/next-hourly-interest-rate"; /** * Get the next hourly interest estimation * *

* GET /sapi/v1/margin/next-hourly-interest-rate *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* assets -- mandatory/string -- List of assets, separated by commas, up to 20
* isIsolated -- mandatory/boolean -- Whether it's for isolated margin or not: "TRUE", "FALSE"
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-a-future-hourly-interest-rate-user_data */ public String nextHourlyInterestRate(Map parameters) { ParameterChecker.checkParameter(parameters, "assets", String.class); ParameterChecker.checkParameter(parameters, "isIsolated", Boolean.class); return requestHandler.sendSignedRequest(baseUrl, NEXT_HOURLY_INTEREST_RATE, parameters, HttpMethod.GET, showLimitUsage); } private final String SMALL_LIABILITY_ASSETS = "/sapi/v1/margin/exchange-small-liability"; /** * Query the assets suitable for small liability exchanges. * *

* GET /sapi/v1/margin/exchange-small-liability *
* @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/#get-small-liability-exchange-coin-list-user_data */ public String smallLiabilityAssets(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, SMALL_LIABILITY_ASSETS, parameters, HttpMethod.GET, showLimitUsage); } private final String EXCHANGE_SMALL_LIABILITY = "/sapi/v1/margin/exchange-small-liability"; /** * Convert cross margin assets with low liability value * *

* POST /sapi/v1/margin/exchange-small-liability *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* assetNames - mandatory/array -- List of asset names. Example: assetNames = BTC,ETH
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#small-liability-exchange-margin */ public String exchangeSmallLiability(Map parameters) { ParameterChecker.checkRequiredParameter(parameters, "assetNames"); return requestHandler.sendSignedRequest(baseUrl, EXCHANGE_SMALL_LIABILITY, parameters, HttpMethod.POST, showLimitUsage); } private final String SMALL_LIABILITY_EXCHANGE_HISTORY = "/sapi/v1/margin/exchange-small-liability-history"; /** * Get the conversion history of low liabilities * *

* GET /sapi/v1/margin/exchange-small-liability-history *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* current -- mandatory/int -- Current querying page. Start from 1. Default:1
* size --mandatory/int -- Default:10 Max:100
* startTime -- optional/long -- Default: 30 days from current timestamp
* endTime -- optional/long -- Default: present timestamp
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-small-liability-exchange-history-user_data */ public String smallLiabilityExchangeHistory(Map parameters) { ParameterChecker.checkRequiredParameter(parameters, "current"); ParameterChecker.checkRequiredParameter(parameters, "size"); return requestHandler.sendSignedRequest(baseUrl, SMALL_LIABILITY_EXCHANGE_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String LEVERAGE_BRACKET = "/sapi/v1/margin/leverageBracket"; /** * Get the liability assets leverage bracket in Cross Margin Pro Mode * *

* GET /sapi/v1/margin/leverageBracket *
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-liability-coin-leverage-bracket-in-cross-margin-pro-mode-market_data */ public String leverageBracket() { return requestHandler.sendApiRequest(baseUrl, LEVERAGE_BRACKET, null, HttpMethod.GET, showLimitUsage); } private final String TRADE_COEFF = "/sapi/v1/margin/tradeCoeff"; /** * Get personal margin level information * *

* GET /sapi/v1/margin/tradeCoeff *
* @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/#get-summary-of-margin-account-user_data */ public String tradeCoeff(Map parameters) { return requestHandler.sendApiRequest(baseUrl, TRADE_COEFF, parameters, HttpMethod.GET, showLimitUsage); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy