com.binance.connector.client.impl.spot.Blvt 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;
/**
* BLVT Endpoints
* All endpoints under the
* BLVT Endpoint
* section of the API documentation will be implemented in this class.
*
* Response will be returned in String format.
*/
public class Blvt {
private final String baseUrl;
private final RequestHandler requestHandler;
private final boolean showLimitUsage;
public Blvt(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 Blvt(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 BLVT_INFO = "/sapi/v1/blvt/tokenInfo";
/**
* GET /sapi/v1/blvt/tokenInfo
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* tokenName -- optional/string -- BTCDOWN, BTCUP
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#get-blvt-info-market_data
*/
public String blvtInfo(Map parameters) {
return requestHandler.sendApiRequest(baseUrl, BLVT_INFO, parameters, HttpMethod.GET, showLimitUsage);
}
private final String SUBSCRIBE = "/sapi/v1/blvt/subscribe";
/**
* POST /sapi/v1/blvt/subscribe
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* tokenName -- mandatory/string -- BTCDOWN, BTCUP
* cost -- mandatory/decimal -- spot balance
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#subscribe-blvt-user_data
*/
public String subscribe(Map parameters) {
ParameterChecker.checkParameter(parameters, "tokenName", String.class);
ParameterChecker.checkRequiredParameter(parameters, "cost");
return requestHandler.sendSignedRequest(baseUrl, SUBSCRIBE, parameters, HttpMethod.POST, showLimitUsage);
}
private final String SUBSCRIPTION_RECORD = "/sapi/v1/blvt/subscribe/record";
/**
* GET /sapi/v1/blvt/subscribe/record
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* tokenName -- optional/string -- BTCDOWN, BTCUP
* id -- optional/long
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/int -- default 1000, max 1000
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#query-subscription-record-user_data
*/
public String subscriptionRecord(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, SUBSCRIPTION_RECORD, parameters, HttpMethod.GET, showLimitUsage);
}
private final String REDEEM = "/sapi/v1/blvt/redeem";
/**
* POST /sapi/v1/blvt/redeem
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* tokenName -- mandatory/string -- BTCDOWN, BTCUP
* amount -- mandatory/decimal -- spot balance
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#redeem-blvt-user_data
*/
public String redeem(Map parameters) {
ParameterChecker.checkParameter(parameters, "tokenName", String.class);
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, REDEEM, parameters, HttpMethod.POST, showLimitUsage);
}
private final String REDEEM_RECORD = "/sapi/v1/blvt/redeem/record";
/**
* GET /sapi/v1/blvt/redeem/record
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* tokenName -- optional/string -- BTCDOWN, BTCUP
* id -- optional/long
* startTime -- optional/long
* endTime -- optional/long
* limit -- optional/int -- default 1000, max 1000
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#query-redemption-record-user_data
*/
public String redeemRecord(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, REDEEM_RECORD, parameters, HttpMethod.GET, showLimitUsage);
}
private final String USER_LIMIT = "/sapi/v1/blvt/userLimit";
/**
* GET /sapi/v1/blvt/userLimit
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* tokenName -- optional/string -- BTCDOWN, BTCUP
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#get-blvt-user-limit-info-user_data
*/
public String userLimit(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, USER_LIMIT, parameters, HttpMethod.GET, showLimitUsage);
}
}