com.binance.connector.client.impl.spot.Convert 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.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;
/**
* Convert Endpoints
* All endpoints under the
* Convert Endpoint
* section of the API documentation will be implemented in this class.
*
* Response will be returned in String format.
*/
public class Convert {
private final String baseUrl;
private final RequestHandler requestHandler;
private final boolean showLimitUsage;
public Convert(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 Convert(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 TRADE_FLOW = "/sapi/v1/convert/tradeFlow";
/**
* GET /sapi/v1/convert/tradeFlow
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* startTime -- mandatory/long
* endTime -- mandatory/long
* limit -- optional/int -- Default 100, Max 1000
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#get-convert-trade-history-user_data
*/
public String tradeFlow(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "startTime", Long.class);
ParameterChecker.checkParameter(parameters, "endTime", Long.class);
return requestHandler.sendSignedRequest(baseUrl, TRADE_FLOW, parameters, HttpMethod.GET, showLimitUsage);
}
}