com.binance.connector.client.impl.spot.VIPLoans Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of binance-connector-java Show documentation
Show all versions of binance-connector-java Show documentation
lightweight connector to API
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;
/**
* VIPLoans Endpoints
* All endpoints under the
* VIP Loans Endpoints
* section of the API documentation will be implemented in this class.
*
* Response will be returned in String format.
*/
public class VIPLoans {
private final String baseUrl;
private final RequestHandler requestHandler;
private final boolean showLimitUsage;
public VIPLoans(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 VIPLoans(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 ONGOING_ORDERS = "/sapi/v1/loan/vip/ongoing/orders";
/**
* VIP loan is available for VIP users only.
*
*
* GET /sapi/v1/loan/vip/ongoing/orders
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* orderId -- optional/long -- Order ID
* collateralAccountId -- optional/long
* loanCoin -- optional/string -- Coin loaned
* collateralCoin -- optional/string -- Coin used as collateral
* current -- optional/long -- Current querying page. Start from 1, Default:1, Max:1000
* limit -- optional/long -- Default 10; max 100.
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://developers.binance.com/docs/vip_loan/user-information/Get-VIP-Loan-Ongoing-Orders
*/
public String ongoingOrders(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ONGOING_ORDERS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String REPAY = "/sapi/v1/loan/vip/repay";
/**
* VIP loan is available for VIP users only.
*
*
* POST /sapi/v1/loan/vip/repay
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* orderId -- mandatory/long -- Order ID
* amount -- mandatory/decimal
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://developers.binance.com/docs/vip_loan/trade/VIP-Loan-Repay
*/
public String repay(Map parameters) {
ParameterChecker.checkParameter(parameters, "orderId", Long.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, REPAY, parameters, HttpMethod.POST, showLimitUsage);
}
private final String REPAYMENT_HISTORY = "/sapi/v1/loan/vip/repay/history";
/**
* VIP loan is available for VIP users only.
*
*
* GET /sapi/v1/loan/vip/repay/history
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* orderId -- optional/long -- Order ID
* loanCoin -- optional/string -- Coin loaned
* startTime -- optional/long -- UTC timestamp in ms
* endTime -- optional/long -- UTC timestamp in ms
* current -- optional/long -- Current querying page. Start from 1, Default:1, Max:1000
* limit -- optional/long -- Default 10; max 100.
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://developers.binance.com/docs/vip_loan/user-information/Get-VIP-Loan-Repayment-History
*/
public String repaymentHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, REPAYMENT_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String RENEW = "/sapi/v1/loan/vip/renew";
/**
* VIP loan is available for VIP users only.
*
*
* POST /sapi/v1/loan/vip/renew
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* orderId -- mandatory/long -- Order ID
* loanTerm -- optional/int -- 30/60 days
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://developers.binance.com/docs/vip_loan/trade/VIP-Loan-Renew
*/
public String renew(Map parameters) {
ParameterChecker.checkParameter(parameters, "orderId", Long.class);
return requestHandler.sendSignedRequest(baseUrl, RENEW, parameters, HttpMethod.POST, showLimitUsage);
}
private final String COLLATERAL_ACCOUNT = "/sapi/v1/loan/vip/collateral/account";
/**
* VIP loan is available for VIP users only.
*
*
* GET /sapi/v1/loan/vip/collateral/account
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* orderId -- optional/long -- Order ID
* collateralAccountId -- optional/long
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://developers.binance.com/docs/vip_loan/user-information/Check-Locked-Value-of-VIP-Collateral-Account
*/
public String collateralAccount(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, COLLATERAL_ACCOUNT, parameters, HttpMethod.GET, showLimitUsage);
}
private final String BORROW = "/sapi/v1/loan/vip/borrow";
/**
* VIP loan is available for VIP users only.
*
*
* POST /sapi/v1/loan/vip/borrow
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* loanAccountId -- mandatory/long
* loanCoin -- mandatory/string -- Coin loaned
* loanAmount -- mandatory/decimal
* collateralAccountId -- mandatory/string -- Multiple split by ','
* collateralCoin -- mandatory/string -- Multiple split by ','
* isFlexibleRate -- mandatory/boolean -- TRUE : flexible rate; FALSE: fixed rate. Default: TRUE.
* loanTerm -- optional/integer -- Mandatory for fixed rate. Optional for fixed interest rate. Eg: 30/60 days
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://developers.binance.com/docs/vip_loan/trade/VIP-Loan-Borrow
*/
public String borrow(Map parameters) {
ParameterChecker.checkParameter(parameters, "loanAccountId", Long.class);
ParameterChecker.checkParameter(parameters, "loanCoin", String.class);
ParameterChecker.checkRequiredParameter(parameters, "loanAmount");
ParameterChecker.checkParameter(parameters, "collateralAccountId", String.class);
ParameterChecker.checkParameter(parameters, "collateralCoin", String.class);
ParameterChecker.checkParameter(parameters, "isFlexibleRate", Boolean.class);
return requestHandler.sendSignedRequest(baseUrl, BORROW, parameters, HttpMethod.POST, showLimitUsage);
}
private final String LOANABLE_ASSETS = "/sapi/v1/loan/vip/loanable/data";
/**
* Get interest rate and borrow limit of loanable assets. The borrow limit is shown in USD value.
*
*
* GET /sapi/v1/loan/vip/loanable/data
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* loanCoin -- optional/string -- Coin loaned
* vipLevel -- optional/integer -- Defaults to user's vip level
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://developers.binance.com/docs/vip_loan/market-data/Get-Loanable-Assets-Data
*/
public String loanableAssets(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, LOANABLE_ASSETS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String COLLATERAL_ASSET_DATA = "/sapi/v1/loan/vip/collateral/data";
/**
* Get Collateral Asset Data
*
*
* GET /sapi/v1/loan/vip/collateral/data
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* collateralCoin -- optional/string
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://developers.binance.com/docs/vip_loan/market-data/Get-Collateral-Asset-Data
*/
public String collateralAsset(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, COLLATERAL_ASSET_DATA, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ORDER_STATUS = "/sapi/v1/loan/vip/request/data";
/**
* Get order status
*
*
* GET /sapi/v1/loan/vip/request/data
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* current -- optional/long -- Current querying page. Start from 1. Default:1
* limit -- optional/long -- Default 10; max 100.
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://developers.binance.com/docs/vip_loan/user-information/Query-Application-Status
*/
public String orderStatus(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ORDER_STATUS, parameters, HttpMethod.GET, showLimitUsage);
}
private final String BORROW_INTEREST_RATE = "/sapi/v1/loan/vip/request/interestRate";
/**
* Get Borrow Interest Rate
*
*
* GET /sapi/v1/loan/vip/request/interestRate
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* loanCoin -- mandatory/string -- Max 10 assets, Multiple split by ","
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String
* @see
* https://developers.binance.com/docs/vip_loan/market-data/Get-Borrow-Interest-Rate
*/
public String borrowInterestRate(Map parameters) {
ParameterChecker.checkParameter(parameters, "loanCoin", String.class);
return requestHandler.sendSignedRequest(baseUrl, BORROW_INTEREST_RATE, parameters, HttpMethod.GET, showLimitUsage);
}
}