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 BORROW_REPAY = "/sapi/v1/margin/borrow-repay"; /** * POST /sapi/v1/margin/borrow-repay *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the param *

* asset -- mandatory/string
* isIsolated -- mandatory/string - TRUE for Isolated Margin, FALSE for Cross Margin, Default FALSE
* symbol -- mandatory/string - Only for Isolated margin
* amount -- mandatory/string
* type -- mandatory/string - BORROW or REPAY
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/margin_trading/borrow-and-repay/Margin-Account-Borrow-Repay */ public String borrowRepay(Map parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); ParameterChecker.checkParameter(parameters, "isIsolated", String.class); ParameterChecker.checkParameter(parameters, "symbol", String.class); ParameterChecker.checkParameter(parameters, "amount", String.class); ParameterChecker.checkParameter(parameters, "type", String.class); return requestHandler.sendSignedRequest(baseUrl, BORROW_REPAY, parameters, HttpMethod.POST, showLimitUsage); } /** * GET /sapi/v1/margin/borrow-repay *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the param *

* type -- mandatory/string - BORROW or REPAY
* asset -- optional/string
* isolatedSymbol -- optional/string - Symbol in Isolated Margin
* txId -- optional/long - tranId in POST /sapi/v1/margin/loan
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long - Current 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://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Borrow-Repay */ public String getBorrowRepay(Map parameters) { ParameterChecker.checkParameter(parameters, "type", String.class); return requestHandler.sendSignedRequest(baseUrl, BORROW_REPAY, parameters, HttpMethod.GET, showLimitUsage); } private final String ALL_ASSETS = "/sapi/v1/margin/allAssets"; /** * GET /sapi/v1/margin/allAssets *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the param *

* asset -- optional/string
* @return String * @see * https://developers.binance.com/docs/margin_trading/market-data/Get-All-Margin-Assets */ public String allAssets(Map parameters) { return requestHandler.sendApiRequest(baseUrl, ALL_ASSETS, parameters, HttpMethod.GET, showLimitUsage); } private final String ALL_PAIRS = "/sapi/v1/margin/allPairs"; /** * GET /sapi/v1/margin/allPairs *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the param *

* symbol -- optional/string
* @return String * @see * https://developers.binance.com/docs/margin_trading/market-data/Get-All-Cross-Margin-Pairs */ public String allPairs(Map parameters) { return requestHandler.sendApiRequest(baseUrl, ALL_PAIRS, parameters, 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://developers.binance.com/docs/margin_trading/market-data/Query-Margin-PriceIndex */ 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://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-Order */ 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://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-Order */ 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://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-All-Open-Orders */ 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
* isolatedSymbol -- optional/string -- Symbol in Isolated Margin
* 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://developers.binance.com/docs/margin_trading/transfer/Get-Cross-Margin-Transfer-History */ public String transferHistory(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, TRANSFER_HISTORY, 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://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-Interest-History */ 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://developers.binance.com/docs/margin_trading/trade/Get-Force-Liquidation-Record */ 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://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Account-Details */ 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://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Order */ 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://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-Orders */ 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://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-Orders */ 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://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-OCO */ 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://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-OCO */ 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://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-OCO */ 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://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-OCO */ 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://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-OCO */ 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://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Trade-List */ 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://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Max-Borrow */ 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://developers.binance.com/docs/margin_trading/transfer/Query-Max-Transfer-Out-Amount */ 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://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Account-Info */ 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://developers.binance.com/docs/margin_trading/account/Disable-Isolated-Margin-Account */ 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://developers.binance.com/docs/margin_trading/account/Enable-Isolated-Margin-Account */ 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://developers.binance.com/docs/margin_trading/account/Query-Enabled-Isolated-Margin-Account-Limit */ 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 *

* symbol -- optional/string
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/margin_trading/market-data/Get-All-Isolated-Margin-Symbol */ 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://developers.binance.com/docs/margin_trading/account/Toggle-BNB-Burn-On-Spot-Trade-And-Margin-Interest */ 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://developers.binance.com/docs/margin_trading/account/Get-BNB-Burn-Status */ 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://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History */ 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://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Fee-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://developers.binance.com/docs/margin_trading/market-data/Cross-margin-collateral-ratio */ 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://developers.binance.com/docs/margin_trading/account/Adjust-Cross-Margin-Max-Leverage */ 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://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Fee-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://developers.binance.com/docs/margin_trading/market-data/Query-Isolated-Margin-Tier-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://developers.binance.com/docs/margin_trading/trade/Query-Current-Margin-Order-Count-Usage */ 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://developers.binance.com/docs/margin_trading/market-data/Query-margin-avaliable-inventory */ 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://developers.binance.com/docs/margin_trading/account/Query-Cross-Isolated-Margin-Capital-Flow */ 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://developers.binance.com/docs/margin_trading/market-data/Get-Delist-Schedule */ 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://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-a-future-hourly-interest-rate */ 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://developers.binance.com/docs/margin_trading/trade/Get-Small-Liability-Exchange-Coin-List */ 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://developers.binance.com/docs/margin_trading/trade/Small-Liability-Exchange */ 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://developers.binance.com/docs/margin_trading/trade/Get-Small-Liability-Exchange-History */ 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://developers.binance.com/docs/margin_trading/market-data/Query-Liability-Coin-Leverage-Bracket-in-Cross-Margin-Pro-Mode */ 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://developers.binance.com/docs/margin_trading/account/Get-Summary-Of-Margin-Account */ public String tradeCoeff(Map parameters) { return requestHandler.sendApiRequest(baseUrl, TRADE_COEFF, parameters, HttpMethod.GET, showLimitUsage); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy