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

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

The newest version!
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;

/**
 * 

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 Map 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(Map parameters) { ParameterChecker.checkParameter(parameters, "startTime", Long.class); ParameterChecker.checkParameter(parameters, "endTime", Long.class); return requestHandler.sendSignedRequest(baseUrl, TRADE_FLOW, parameters, HttpMethod.GET, showLimitUsage); } private final String EXCHANGE_INFO = "/sapi/v1/convert/exchangeInfo"; /** * GET /sapi/v1/convert/exchangeInfo *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* fromAsset -- optional/string
* toAsset -- optional/string
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#list-all-convert-pairs */ public String exchangeInfo(Map parameters) { return requestHandler.sendPublicRequest(baseUrl, EXCHANGE_INFO, parameters, HttpMethod.GET, showLimitUsage); } private final String ASSET_QUANTITY_PRECISION = "/sapi/v1/convert/assetInfo"; /** * GET /sapi/v1/convert/assetInfo *
* @param * parameters Map 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/#query-order-quantity-precision-per-asset-user_data */ public String assetQuantityPrecision(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, ASSET_QUANTITY_PRECISION, parameters, HttpMethod.GET, showLimitUsage); } private final String QUOTE_INQUIRY = "/sapi/v1/convert/getQuote"; /** * POST /sapi/v1/convert/getQuote *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* fromAsset -- mandatory/string
* toAsset -- mandatory/string
* fromAmount -- optional/double -- Send either fromAmount or toAmount
* toAmount -- optional/double -- Send either fromAmount or toAmount
* walletType -- optional/string -- SPOT or FUNDING. Default is SPOT
* validTime -- optional/string -- 10s, 30s, 1m, 2m, default 10s
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#send-quote-request-user_data */ public String quoteInquiry(Map parameters) { ParameterChecker.checkParameter(parameters, "fromAsset", String.class); ParameterChecker.checkParameter(parameters, "toAsset", String.class); return requestHandler.sendSignedRequest(baseUrl, QUOTE_INQUIRY, parameters, HttpMethod.POST, showLimitUsage); } private final String ACCEPT_QUOTE = "/sapi/v1/convert/acceptQuote"; /** * POST /sapi/v1/convert/acceptQuote *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* quoteId -- mandatory/string
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#accept-quote-trade */ public String acceptQuote(Map parameters) { ParameterChecker.checkParameter(parameters, "quoteId", String.class); return requestHandler.sendSignedRequest(baseUrl, ACCEPT_QUOTE, parameters, HttpMethod.POST, showLimitUsage); } private final String ORDER_STATUS = "/sapi/v1/convert/orderStatus"; /** * GET /sapi/v1/convert/orderStatus *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* quoteId -- optional/string
* quoteId -- optional/string
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#order-status-user_data */ public String orderStatus(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, ORDER_STATUS, parameters, HttpMethod.GET, showLimitUsage); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy