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

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

/**
 * 

Staking Endpoints

* All endpoints under the * Staking Endpoint * section of the API documentation will be implemented in this class. *
* Response will be returned in String format. */ public class Staking { private final String baseUrl; private final RequestHandler requestHandler; private final boolean showLimitUsage; public Staking(String baseUrl, String apiKey, String secretKey, boolean showLimitUsage) { this.baseUrl = baseUrl; this.requestHandler = new RequestHandler(apiKey, new HmacSignatureGenerator(secretKey)); this.showLimitUsage = showLimitUsage; } public Staking(String baseUrl, String apiKey, SignatureGenerator signatureGenerator, boolean showLimitUsage) { this.baseUrl = baseUrl; this.requestHandler = new RequestHandler(apiKey, signatureGenerator); this.showLimitUsage = showLimitUsage; } private final String PRODUCT_LIST = "/sapi/v1/staking/productList"; /** * Get available Staking product list *

* GET /sapi/v1/staking/productList *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* product -- mandatory/enum -- "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
* asset -- optional/string
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default: 50, Max: 100
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-list-user_data */ public String productList(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "product", String.class); return requestHandler.sendSignedRequest(baseUrl, PRODUCT_LIST, parameters, HttpMethod.GET, showLimitUsage); } private final String PURCHASE = "/sapi/v1/staking/purchase"; /** * POST /sapi/v1/staking/purchase *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* product -- mandatory/enum -- "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
* productId -- mandatory/STRING
* amount -- mandatory/decimal
* renewable -- optional/STRING -- true or false, default false. Active if product is "STAKING" or "L_DEFI"
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#purchase-staking-product-user_data */ public String purchase(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "product", String.class); ParameterChecker.checkParameter(parameters, "productId", String.class); ParameterChecker.checkParameter(parameters, "amount", Double.class); return requestHandler.sendSignedRequest(baseUrl, PURCHASE, parameters, HttpMethod.POST, showLimitUsage); } private final String REDEEM = "/sapi/v1/staking/redeem"; /** * Redeem Staking product. Locked staking and Locked DeFI staking belong to early redemption, redeeming in advance will result in loss of interest that you have earned. *

* POST /sapi/v1/staking/redeem *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* product -- mandatory/enum -- "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
* positionId -- optional/STRING -- "1234", Mandatory if product is "STAKING" or "L_DEFI"
* productId -- mandatory/STRING
* amount -- optional/decimal -- Mandatory if product is "F_DEFI"
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#redeem-staking-product-user_data */ public String redeem(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "product", String.class); ParameterChecker.checkParameter(parameters, "productId", String.class); return requestHandler.sendSignedRequest(baseUrl, REDEEM, parameters, HttpMethod.POST, showLimitUsage); } private final String POSITION = "/sapi/v1/staking/position"; /** * GET /sapi/v1/staking/position *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* product -- mandatory/enum -- "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
* productId -- mandatory/STRING
* asset -- optional/string
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default: 50, Max: 100
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-position-user_data */ public String getPosition(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "product", String.class); return requestHandler.sendSignedRequest(baseUrl, POSITION, parameters, HttpMethod.GET, showLimitUsage); } private final String STAKING_RECORD = "/sapi/v1/staking/stakingRecord"; /** * GET /sapi/v1/staking/stakingRecord *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* product -- mandatory/enum -- "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
* txnType -- mandatory/enum -- "SUBSCRIPTION", "REDEMPTION", "INTEREST"
* asset -- optional/string
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default: 50, Max: 100
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-staking-history-user_data */ public String stakingRecord(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "product", String.class); ParameterChecker.checkParameter(parameters, "txnType", String.class); return requestHandler.sendSignedRequest(baseUrl, STAKING_RECORD, parameters, HttpMethod.GET, showLimitUsage); } private final String AUTO_STAKING = "/sapi/v1/staking/setAutoStaking"; /** * Set auto staking on Locked Staking or Locked DeFi Staking *

* POST /sapi/v1/staking/setAutoStaking *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* product -- mandatory/enum -- "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
* positionId -- mandatory/STRING
* renewable -- mandatory/STRING
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#set-auto-staking-user_data */ public String setAutoStaking(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "product", String.class); ParameterChecker.checkParameter(parameters, "positionId", String.class); ParameterChecker.checkParameter(parameters, "renewable", String.class); return requestHandler.sendSignedRequest(baseUrl, AUTO_STAKING, parameters, HttpMethod.POST, showLimitUsage); } private final String LEFT_QUOTA = "/sapi/v1/staking/personalLeftQuota"; /** * GET /sapi/v1/staking/personalLeftQuota *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* product -- mandatory/enum -- "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
* productId -- mandatory/string
* recvWindow -- optional/long
* @return String * @see * https://binance-docs.github.io/apidocs/spot/en/#get-personal-left-quota-of-staking-product-user_data */ public String personalLeftQuota(LinkedHashMap parameters) { ParameterChecker.checkParameter(parameters, "product", String.class); ParameterChecker.checkParameter(parameters, "productId", String.class); return requestHandler.sendSignedRequest(baseUrl, LEFT_QUOTA, parameters, HttpMethod.GET, showLimitUsage); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy