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

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

package com.binance.connector.client.impl.spot;

import com.binance.connector.client.enums.HttpMethod;
import com.binance.connector.client.utils.HmacSignatureGenerator;
import com.binance.connector.client.utils.ParameterChecker;
import com.binance.connector.client.utils.RequestHandler;
import com.binance.connector.client.utils.SignatureGenerator;
import java.util.LinkedHashMap;

/**
 * 

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) { this.baseUrl = baseUrl; this.requestHandler = new RequestHandler(apiKey, new HmacSignatureGenerator(secretKey)); this.showLimitUsage = showLimitUsage; } public Margin(String baseUrl, String apiKey, SignatureGenerator signatureGenerator, boolean showLimitUsage) { this.baseUrl = baseUrl; this.requestHandler = new RequestHandler(apiKey, signatureGenerator); this.showLimitUsage = showLimitUsage; } private final String CROSS_MARGIN_TRANSFER = "/sapi/v1/margin/transfer"; /** * Execute transfer between spot account and cross margin account. *

* POST /sapi/v1/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 *

* asset -- mandatory/string -- The asset being transferred, e.g., BTC
* amount -- mandatory/decimal -- The amount to be transferred
* type -- mandatory/int -- 1: transfer from main account to cross margin account 2: transfer from cross margin account to main account
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#cross-margin-account-transfer-margin */ public String crossMarginTransfer(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); ParameterChecker.checkParameter(parameters, "type", Integer.class); return requestHandler.sendSignedRequest(baseUrl, CROSS_MARGIN_TRANSFER, parameters, HttpMethod.POST, showLimitUsage); } private final String BORROW = "/sapi/v1/margin/loan"; /** * Apply for a loan. *

* POST /sapi/v1/margin/loan *
* @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
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE",default "FALSE"
* symbol -- optional/string -- isolated symbol
* amount -- mandatory/decimal
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin */ public String borrow(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); return requestHandler.sendSignedRequest(baseUrl, BORROW, parameters, HttpMethod.POST, showLimitUsage); } private final String REPAY = "/sapi/v1/margin/repay"; /** * Repay loan for margin account. *

* POST /sapi/v1/margin/repay *
* @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
* isIsolated -- optional/string -- for isolated margin or not, "TRUE", "FALSE",default "FALSE"
* symbol -- optional/string -- isolated symbol
* amount -- mandatory/decimal
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin */ public String repay(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); return requestHandler.sendSignedRequest(baseUrl, REPAY, parameters, HttpMethod.POST, showLimitUsage); } private final String ASSET = "/sapi/v1/margin/asset"; /** * GET /sapi/v1/margin/asset *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* asset -- mandatory/string * @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#query-margin-asset-market_data */ public String asset(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); return requestHandler.sendWithApiKeyRequest(baseUrl, ASSET, parameters, HttpMethod.GET, showLimitUsage); } private final String PAIR = "/sapi/v1/margin/pair"; /** * GET /sapi/v1/margin/pair *
* @param * parameters LinkedHashedMap 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-cross-margin-pair-market_data */ public String pair(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendWithApiKeyRequest(baseUrl, PAIR, parameters, HttpMethod.GET, 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.sendWithApiKeyRequest(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.sendWithApiKeyRequest(baseUrl, ALL_PAIRS, null, HttpMethod.GET, showLimitUsage); } private final String PRICE_INDEX = "/sapi/v1/margin/priceIndex"; /** * GET /sapi/v1/margin/priceIndex *
* @param * parameters LinkedHashedMap 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(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendWithApiKeyRequest(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 LinkedHashedMap 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; default NO_SIDE_EFFECT.
* timeInForce -- optional/enum -- GTC,IOC,FOK
* 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, TRANSFER_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String LOAN_RECORD = "/sapi/v1/margin/loan"; /** * GET /sapi/v1/margin/loan *
* @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
* 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-loan-record-user_data */ public String loanRecord(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); return requestHandler.sendSignedRequest(baseUrl, LOAN_RECORD, parameters, HttpMethod.GET, showLimitUsage); } private final String REPAY_RECORD = "/sapi/v1/margin/repay"; /** * GET /sapi/v1/margin/repay *
* @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
* 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* startTime -- optional/long
* endTime -- optional/long
* 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, ACCOUNT, parameters, HttpMethod.GET, showLimitUsage); } /** * GET /sapi/v1/margin/order *
* @param * parameters LinkedHashedMap 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(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, ORDER, parameters, HttpMethod.GET, showLimitUsage); } /** * GET /sapi/v1/margin/openOrders *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* symbol -- optional/string
* 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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; default NO_SIDE_EFFECT.
* 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); return requestHandler.sendSignedRequest(baseUrl, MAX_TRANSFERABLE, parameters, HttpMethod.GET, showLimitUsage); } private final String ISOLATED_TRANSFER = "/sapi/v1/margin/isolated/transfer"; /** * POST /sapi/v1/margin/isolated/transfer *
* @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 -- asset,such as BTC
* symbol -- mandatory/string
* transFrom -- mandatory/string -- "SPOT", "ISOLATED_MARGIN"
* transTo -- mandatory/string -- "SPOT", "ISOLATED_MARGIN"
* amount -- mandatory/decimal
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin */ public String isolatedTransfer(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); ParameterChecker.checkParameter(parameters, "symbol", String.class); ParameterChecker.checkParameter(parameters, "transFrom", String.class); ParameterChecker.checkParameter(parameters, "transTo", String.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); return requestHandler.sendSignedRequest(baseUrl, ISOLATED_TRANSFER, parameters, HttpMethod.POST, showLimitUsage); } /** * GET /sapi/v1/margin/isolated/transfer *
* @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 -- asset,such as BTC
* symbol -- mandatory/string
* transFrom -- optional/string -- "SPOT", "ISOLATED_MARGIN"
* transTo -- optional/string -- "SPOT", "ISOLATED_MARGIN"
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Current page, default 1
* size -- optional/decimal
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-isolated-margin-transfer-history-user_data */ public String getIsolatedTransfer(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, ISOLATED_TRANSFER, parameters, HttpMethod.GET, showLimitUsage); } private final String ISOLATED_ACCOUNT = "/sapi/v1/margin/isolated/account"; /** * GET /sapi/v1/margin/isolated/account *
* @param * parameters LinkedHashedMap 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(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, ISOLATED_ACCOUNT, parameters, HttpMethod.GET, showLimitUsage); } /** * DELETE /sapi/v1/margin/isolated/account *
* @param * parameters LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, ISOLATED_ACCOUNT_LIMIT, parameters, HttpMethod.GET, showLimitUsage); } private final String ISOLATED_SYMBOL = "/sapi/v1/margin/isolated/pair"; /** * GET /sapi/v1/margin/isolated/pair *
* @param * parameters LinkedHashedMap 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/#query-isolated-margin-symbol-user_data */ public String getIsolatedSymbol(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "symbol", String.class); return requestHandler.sendSignedRequest(baseUrl, ISOLATED_SYMBOL, parameters, HttpMethod.GET, showLimitUsage); } private final String ALL_ISOLATED_SYMBOL = "/sapi/v1/margin/isolated/allPairs"; /** * GET /sapi/v1/margin/isolated/allPairs *
* @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 -- 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, BNB_BURN, parameters, HttpMethod.POST, showLimitUsage); } /** * GET /sapi/v1/bnbBurn *
* @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 -- 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, CROSS_MARGIN_DATA, parameters, HttpMethod.GET, 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap 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 LinkedHashedMap 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(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, ORDER_RATE_LIMIT, parameters, HttpMethod.GET, showLimitUsage); } private final String DRIBBLET = "/sapi/v1/margin/dribblet"; /** * Query the historical information of user's margin account small-value asset conversion BNB. *

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

* startTime -- optional/long
* endTime -- optional/long --
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#margin-dustlog-user_data */ public String dribblet(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, DRIBBLET, parameters, HttpMethod.GET, showLimitUsage); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy