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

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

There is a newer version: 3.2.0
Show newest version
package com.binance.connector.client.impl.spot;

import java.util.LinkedHashMap;

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;

/**
 * 

Futures Endpoints

* All endpoints under the * Futures Endpoint * section of the API documentation will be implemented in this class. *
* Response will be returned in String format. */ public class Futures { private final String baseUrl; private final RequestHandler requestHandler; private final boolean showLimitUsage; public Futures(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 Futures(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 FUTURES_TRANSFER = "/sapi/v1/futures/transfer"; /** * Execute transfer between spot account and futures account. *

* POST /sapi/v1/futures/transfer *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* asset -- mandatory/string -- The asset being transferred, e.g. USDT
* amount -- mandatory/decimal -- The amount to be transferred
* type -- mandatory/int -- 1: transfer from spot account to USDT-M futures account. * 2: transfer from USDT-M futures account to spot account. * 3: transfer from spot account to COIN-M futures account. * 4: transfer from COIN-M futures account to spot account.
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-user_data */ public String futuresTransfer(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); ParameterChecker.checkParameter(parameters, "type", Integer.class); return requestHandler.sendSignedRequest(baseUrl, FUTURES_TRANSFER, parameters, HttpMethod.POST, showLimitUsage); } /** * GET /sapi/v1/futures/transfer *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* asset -- mandatory/string -- The asset being transferred, e.g. USDT
* startTime -- mandatory/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-future-account-transaction-history-list-user_data */ public String futuresTransferHistory(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); ParameterChecker.checkParameter(parameters, "startTime", Long.class); return requestHandler.sendSignedRequest(baseUrl, FUTURES_TRANSFER, parameters, HttpMethod.GET, showLimitUsage); } private final String BORROW_HISTORY = "/sapi/v1/futures/loan/borrow/history"; /** * GET /sapi/v1/futures/loan/borrow/history *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* coin -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/long -- default 500, max 1000
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-borrow-history-user_data */ public String borrowHistory(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, BORROW_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String REPAY_HISTORY = "/sapi/v1/futures/loan/repay/history"; /** * GET /sapi/v1/futures/loan/repay/history *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* coin -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/long -- default 500, max 1000
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-repayment-history-user_data */ public String repayHistory(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, REPAY_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String WALLET = "/sapi/v2/futures/loan/wallet"; /** * GET /sapi/v2/futures/loan/wallet *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-wallet-user_data */ public String loanWallet(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, WALLET, parameters, HttpMethod.GET, showLimitUsage); } private final String ADJUST_COLLATERAL_HISTORY = "/sapi/v1/futures/loan/adjustCollateral/history"; /** * GET /sapi/v1/futures/loan/adjustCollateral/history *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* loanCoin -- optional/string
* collateralCoin -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/long -- default 500, max 1000
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-history-user_data */ public String adjustCollateralHistory(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, ADJUST_COLLATERAL_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String LIQUIDATION_HISTORY = "/sapi/v1/futures/loan/liquidationHistory"; /** * GET /sapi/v1/futures/loan/liquidationHistory *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* loanCoin -- optional/string
* collateralCoin -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/long -- default 500, max 1000
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-liquidation-history-user_data */ public String liquidationHistory(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, LIQUIDATION_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String INTEREST_HISTORY = "/sapi/v1/futures/loan/interestHistory"; /** * GET /sapi/v1/futures/loan/interestHistory *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* collateralCoin -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* limit -- optional/long -- default 500, max 1000
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-interest-history-user_data */ public String interestHistory(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, INTEREST_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy