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

com.binance.connector.client.impl.spot.CryptoLoans 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;

/**
 * 

Crypto Loans Endpoints

* All endpoints under the * Crypto Loans Endpoint * section of the API documentation will be implemented in this class. *
* Response will be returned in String format. */ public class CryptoLoans { private final String baseUrl; private final RequestHandler requestHandler; private final boolean showLimitUsage; public CryptoLoans(String baseUrl, String apiKey, String secretKey, boolean showLimitUsage) { this.baseUrl = baseUrl; this.requestHandler = new RequestHandler(apiKey, new HmacSignatureGenerator(secretKey)); this.showLimitUsage = showLimitUsage; } public CryptoLoans(String baseUrl, String apiKey, SignatureGenerator signatureGenerator, boolean showLimitUsage) { this.baseUrl = baseUrl; this.requestHandler = new RequestHandler(apiKey, signatureGenerator); this.showLimitUsage = showLimitUsage; } private final String LOAN_INCOME = "/sapi/v1/loan/income"; /** * GET /sapi/v1/loan/income *
* @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
* type -- optional/string -- All types will be returned by default. Enum:borrowIn ,collateralSpent, repayAmount, collateralReturn(Collateral return after repayment), addCollateral, removeCollateral, collateralReturnAfterLiquidation
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/int -- default 20, max 100
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-crypto-loans-income-history-user_data */ public String loanIncome(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "asset", String.class); return requestHandler.sendSignedRequest(baseUrl, LOAN_INCOME, parameters, HttpMethod.GET, showLimitUsage); } private final String LOAN_BORROW = "/sapi/v1/loan/borrow"; /** * POST /sapi/v1/loan/borrow *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* loanCoin -- mandatory/string
* collateralCoin -- mandatory/string
* loanTerm -- mandatory/int -- 7/14/30/90/180 days
* loanAmount -- optional/decimal -- Mandatory when collateralAmount is empty
* collateralAmount -- optional/decimal -- Mandatory when loanAmount is empty
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#borrow-crypto-loan-borrow-trade */ public String loanBorrow(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "loanCoin", String.class); ParameterChecker.checkParameter(parameters, "collateralCoin", String.class); ParameterChecker.checkParameter(parameters, "loanTerm", Integer.class); return requestHandler.sendSignedRequest(baseUrl, LOAN_BORROW, parameters, HttpMethod.POST, showLimitUsage); } private final String LOAN_BORROW_HISTORY = "/sapi/v1/loan/borrow/history"; /** * GET /sapi/v1/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 *

* orderId -- optional/long -- orderId in POST /sapi/v1/loan/borrow
* loanCoin -- optional/string
* collateralCoin -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Current querying page. Start from 1; default: 1; max: 1000
* limit -- optional/long -- Default: 10; max: 100
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#borrow-get-loan-borrow-history-user_data */ public String loanBorrowHistory(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, LOAN_BORROW_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String LOAN_ONGOING_ORDERS = "/sapi/v1/loan/ongoing/orders"; /** * GET /sapi/v1/loan/ongoing/orders *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* orderId -- optional/long -- orderId in POST /sapi/v1/loan/borrow
* loanCoin -- optional/string
* collateralCoin -- optional/string
* current -- optional/long -- Current querying page. Start from 1; default: 1; max: 1000
* limit -- optional/long -- Default: 10; max: 100
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#borrow-get-loan-ongoing-orders-user_data */ public String loanOngoingOrders(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, LOAN_ONGOING_ORDERS, parameters, HttpMethod.GET, showLimitUsage); } private final String LOAN_REPAY = "/sapi/v1/loan/repay"; /** * POST /sapi/v1/loan/repay *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* orderId -- mandatory/long
* amount -- mandatory/decimal
* type -- optional/int -- Default: 1. 1 for "repay with borrowed coin"; 2 for "repay with collateral"
* collateralReturn -- optional/boolean -- Default: TRUE. TRUE: Return extra collateral to spot account; FALSE: Keep extra collateral in the order
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#repay-crypto-loan-repay-trade */ public String loanRepay(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "orderId", Long.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); return requestHandler.sendSignedRequest(baseUrl, LOAN_REPAY, parameters, HttpMethod.POST, showLimitUsage); } private final String LOAN_REPAY_HISTORY = "/sapi/v1/loan/repay/history"; /** * GET /sapi/v1/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 *

* orderId -- optional/long
* loanCoin -- optional/string
* collateralCoin -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Current querying page. Start from 1; default: 1; max: 1000
* limit -- optional/long -- Default: 10; max: 100
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#repay-get-loan-repayment-history-user_data */ public String loanRepayHistory(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, LOAN_REPAY_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String LOAN_ADJUST_LTV = "/sapi/v1/loan/adjust/ltv"; /** * POST /sapi/v1/loan/adjust/ltv *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* orderId -- mandatory/long
* amount -- mandatory/decimal
* direction -- optional/enum -- "ADDITIONAL", "REDUCED"
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#adjust-ltv-crypto-loan-adjust-ltv-trade */ public String loanAdjustLTV(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "orderId", Long.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); return requestHandler.sendSignedRequest(baseUrl, LOAN_ADJUST_LTV, parameters, HttpMethod.POST, showLimitUsage); } private final String LOAN_ADJUST_LTV_HISTORY = "/sapi/v1/loan/ltv/adjustment/history"; /** * GET /sapi/v1/loan/ltv/adjustment/history *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* orderId -- optional/long
* loanCoin -- optional/string
* collateralCoin -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Current querying page. Start from 1; default: 1; max: 1000
* limit -- optional/long -- Default: 10; max: 100
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#adjust-ltv-crypto-loan-adjust-ltv-trade */ public String loanAdjustLTVHistory(LinkedHashMap parameters) { return requestHandler.sendSignedRequest(baseUrl, LOAN_ADJUST_LTV_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy