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

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

There is a newer version: 3.2.0
Show 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;

/**
 * 

Simple Earn Endpoints

* All endpoints under the * Simple Earn Endpoints * section of the API documentation will be implemented in this class. *
* Response will be returned in String format. */ public class SimpleEarn { private final String baseUrl; private final RequestHandler requestHandler; private final boolean showLimitUsage; public SimpleEarn(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 SimpleEarn(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 FLEXIBLE_PRODUCT_LIST = "/sapi/v1/simple-earn/flexible/list"; /** * Get available Simple Earn flexible product list *

* GET /sapi/v1/simple-earn/flexible/list *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* asset -- optional/string
* current -- optional/long -- Current querying page. Start from 1. Default:1
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/account/Get-Simple-Earn-Flexible-Product-List */ public String flexibleProductList(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, FLEXIBLE_PRODUCT_LIST, parameters, HttpMethod.GET, showLimitUsage); } private final String LOCKED_PRODUCT_LIST = "/sapi/v1/simple-earn/locked/list"; /** * GET /sapi/v1/simple-earn/locked/list *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* asset -- optional/string
* current -- optional/long -- Current querying page. Start from 1. Default:1
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/account/Get-Simple-Earn-Locked-Product-List */ public String lockedProductList(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, LOCKED_PRODUCT_LIST, parameters, HttpMethod.GET, showLimitUsage); } private final String SUBSCRIBE_FLEXIBLE_PRODUCT = "/sapi/v1/simple-earn/flexible/subscribe"; /** * POST /sapi/v1/simple-earn/flexible/subscribe *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* productId -- mandatory/string
* amount -- mandatory/decimal
* autoSubscribe -- optional/boolean -- true or false, default true.
* sourceAccount -- optional/enum -- SPOT,FUND,ALL, default SPOT
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/earn/Subscribe-Flexible-Product */ public String subscribeFlexibleProduct(Map parameters) { ParameterChecker.checkParameter(parameters, "productId", String.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); return requestHandler.sendSignedRequest(baseUrl, SUBSCRIBE_FLEXIBLE_PRODUCT, parameters, HttpMethod.POST, showLimitUsage); } private final String SUBSCRIBE_LOCKED_PRODUCT = "/sapi/v1/simple-earn/locked/subscribe"; /** * POST /sapi/v1/simple-earn/locked/subscribe *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* projectId -- mandatory/string
* amount -- mandatory/decimal
* autoSubscribe -- optional/boolean -- true or false, default true.
* sourceAccount -- optional/enum -- SPOT,FUND,ALL, default SPOT
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/earn/Subscribe-Locked-Product */ public String subscribeLockedProduct(Map parameters) { ParameterChecker.checkParameter(parameters, "projectId", String.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); return requestHandler.sendSignedRequest(baseUrl, SUBSCRIBE_LOCKED_PRODUCT, parameters, HttpMethod.POST, showLimitUsage); } private final String REDEEM_FLEXIBLE_PRODUCT = "/sapi/v1/simple-earn/flexible/redeem"; /** * POST /sapi/v1/simple-earn/flexible/redeem *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* productId -- mandatory/string
* redeemAll -- optional/boolean -- true or false, default to false
* amount -- optional/decimal -- if redeemAll is false, amount is mandatory
* destAccount -- optional/enum -- SPOT,FUND,ALL, default SPOT
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/earn/Redeem-Flexible-Product */ public String redeemFlexibleProduct(Map parameters) { ParameterChecker.checkParameter(parameters, "productId", String.class); return requestHandler.sendSignedRequest(baseUrl, REDEEM_FLEXIBLE_PRODUCT, parameters, HttpMethod.POST, showLimitUsage); } private final String REDEEM_LOCKED_PRODUCT = "/sapi/v1/simple-earn/locked/redeem"; /** * POST /sapi/v1/simple-earn/locked/redeem *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* positionId -- mandatory/string -- 1234
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/earn/Redeem-Locked-Product */ public String redeemLockedProduct(Map parameters) { ParameterChecker.checkParameter(parameters, "positionId", String.class); return requestHandler.sendSignedRequest(baseUrl, REDEEM_LOCKED_PRODUCT, parameters, HttpMethod.POST, showLimitUsage); } private final String FLEXIBLE_PRODUCT_POSITION = "/sapi/v1/simple-earn/flexible/position"; /** * GET /sapi/v1/simple-earn/flexible/position *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* asset -- optional/string
* productId -- optional/string
* current -- optional/long -- Current querying page. Start from 1. Default:1
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/account/Get-Flexible-Product-Position */ public String flexibleProductPosition(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, FLEXIBLE_PRODUCT_POSITION, parameters, HttpMethod.GET, showLimitUsage); } private final String LOCKED_PRODUCT_POSITION = "/sapi/v1/simple-earn/locked/position"; /** * GET /sapi/v1/simple-earn/locked/position *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* asset -- optional/string
* positionId -- optional/string
* projectId -- optional/string
* current -- optional/long -- Current querying page. Start from 1. Default:1
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/account/Get-Locked-Product-Position */ public String lockedProductPosition(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, LOCKED_PRODUCT_POSITION, parameters, HttpMethod.GET, showLimitUsage); } private final String SIMPLE_ACCOUNT = "/sapi/v1/simple-earn/account"; /** * GET /sapi/v1/simple-earn/account *
* @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 -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/account/Simple-Account */ public String simpleAccount(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, SIMPLE_ACCOUNT, parameters, HttpMethod.GET, showLimitUsage); } private final String FLEXIBLE_SUBSCRIPTION_RECORD = "/sapi/v1/simple-earn/flexible/history/subscriptionRecord"; /** * GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* productId -- optional/string
* purchaseId -- optional/string
* asset -- optional/string
* 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
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Subscription-Record */ public String flexibleSubscriptionRecord(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, FLEXIBLE_SUBSCRIPTION_RECORD, parameters, HttpMethod.GET, showLimitUsage); } private final String LOCKED_SUBSCRIPTION_RECORD = "/sapi/v1/simple-earn/locked/history/subscriptionRecord"; /** * GET /sapi/v1/simple-earn/locked/history/subscriptionRecord *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* purchaseId -- optional/string
* asset -- optional/string
* 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
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/history/Get-Locked-Subscription-Record */ public String lockedSubscriptionRecord(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, LOCKED_SUBSCRIPTION_RECORD, parameters, HttpMethod.GET, showLimitUsage); } private final String FLEXIBLE_REDEMPTION_RECORD = "/sapi/v1/simple-earn/flexible/history/redemptionRecord"; /** * GET /sapi/v1/simple-earn/flexible/history/redemptionRecord *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* productId -- optional/string
* redeemId -- optional/string
* asset -- optional/string
* 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
* size -- optional/long -- Default:10 Max:100
* @return String * @see * https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Redemption-Record */ public String flexibleRedemptionRecord(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, FLEXIBLE_REDEMPTION_RECORD, parameters, HttpMethod.GET, showLimitUsage); } private final String LOCKED_REDEMPTION_RECORD = "/sapi/v1/simple-earn/locked/history/redemptionRecord"; /** * GET /sapi/v1/simple-earn/locked/history/redemptionRecord *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* positionId -- optional/string
* redeemId -- optional/string
* asset -- optional/string
* 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
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/history/Get-Locked-Redemption-Record */ public String lockedRedemptionRecord(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, LOCKED_REDEMPTION_RECORD, parameters, HttpMethod.GET, showLimitUsage); } private final String FLEXIBLE_REWARDS_HISTORY = "/sapi/v1/simple-earn/flexible/history/rewardsRecord"; /** * GET /sapi/v1/simple-earn/flexible/history/rewardsRecord *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* productId -- optional/string
* asset -- optional/string
* startTime -- optional/long -- UTC timestamp in ms
* endTime -- optional/long -- UTC timestamp in ms
* type -- mandatory/enum -- "BONUS", "REALTIME", "REWARDS"
* current -- optional/long -- Start from 1. Default:1
* size -- optional/long -- Default:10 Max:100
* @return String * @see * https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Rewards-History */ public String flexibleRewardsHistory(Map parameters) { ParameterChecker.checkParameter(parameters, "type", String.class); return requestHandler.sendSignedRequest(baseUrl, FLEXIBLE_REWARDS_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String LOCKED_REWARDS_HISTORY = "/sapi/v1/simple-earn/locked/history/rewardsRecord"; /** * GET /sapi/v1/simple-earn/locked/history/rewardsRecord *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* positionId -- optional/string
* asset -- optional/string
* startTime -- optional/long -- UTC timestamp in ms
* endTime -- optional/long -- UTC timestamp in ms
* current -- optional/long -- Currently querying the page. Start from 1. Default:1
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/history/Get-Locked-Rewards-History */ public String lockedRewardsHistory(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, LOCKED_REWARDS_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String SET_FLEXIBLE_AUTO_SUBSCRIBE = "/sapi/v1/simple-earn/flexible/setAutoSubscribe"; /** * POST /sapi/v1/simple-earn/flexible/setAutoSubscribe *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* productId -- mandatory/string
* autoSubscribe -- mandatory/boolean -- true or false
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/earn/Set-Flexible-Auto-Subscribe */ public String setFlexibleAutoSubscribe(Map parameters) { ParameterChecker.checkParameter(parameters, "productId", String.class); ParameterChecker.checkParameter(parameters, "autoSubscribe", Boolean.class); return requestHandler.sendSignedRequest(baseUrl, SET_FLEXIBLE_AUTO_SUBSCRIBE, parameters, HttpMethod.POST, showLimitUsage); } private final String SET_LOCKED_AUTO_SUBSCRIBE = "/sapi/v1/simple-earn/locked/setAutoSubscribe"; /** * POST /sapi/v1/simple-earn/locked/setAutoSubscribe *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* positionId -- mandatory/string
* autoSubscribe -- mandatory/boolean -- true or false
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/earn/Set-Locked-Auto-Subscribe */ public String setLockedAutoSubscribe(Map parameters) { ParameterChecker.checkParameter(parameters, "positionId", String.class); ParameterChecker.checkParameter(parameters, "autoSubscribe", Boolean.class); return requestHandler.sendSignedRequest(baseUrl, SET_LOCKED_AUTO_SUBSCRIBE, parameters, HttpMethod.POST, showLimitUsage); } private final String FLEXIBLE_PERSONAL_LEFT_QUOTA = "/sapi/v1/simple-earn/flexible/personalLeftQuota"; /** * GET /sapi/v1/simple-earn/flexible/personalLeftQuota *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* productId -- mandatory/string
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/account/Get-Flexible-Personal-Left-Quota */ public String flexiblePersonalLeftQuota(Map parameters) { ParameterChecker.checkParameter(parameters, "productId", String.class); return requestHandler.sendSignedRequest(baseUrl, FLEXIBLE_PERSONAL_LEFT_QUOTA, parameters, HttpMethod.GET, showLimitUsage); } private final String LOCKED_PERSONAL_LEFT_QUOTA = "/sapi/v1/simple-earn/locked/personalLeftQuota"; /** * GET /sapi/v1/simple-earn/locked/personalLeftQuota *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* projectId -- mandatory/string
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/account/Get-Locked-Personal-Left-Quota */ public String lockedPersonalLeftQuota(Map parameters) { ParameterChecker.checkParameter(parameters, "projectId", String.class); return requestHandler.sendSignedRequest(baseUrl, LOCKED_PERSONAL_LEFT_QUOTA, parameters, HttpMethod.GET, showLimitUsage); } private final String FLEXIBLE_SUBSCRIPTION_PREVIEW = "/sapi/v1/simple-earn/flexible/subscriptionPreview"; /** * GET /sapi/v1/simple-earn/flexible/subscriptionPreview *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* productId -- mandatory/string
* amount -- mandatory/decimal
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/earn/Get-Flexible-Subscription-Preview */ public String flexibleSubscriptionPreview(Map parameters) { ParameterChecker.checkParameter(parameters, "productId", String.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); return requestHandler.sendSignedRequest(baseUrl, FLEXIBLE_SUBSCRIPTION_PREVIEW, parameters, HttpMethod.GET, showLimitUsage); } private final String LOCKED_SUBSCRIPTION_PREVIEW = "/sapi/v1/simple-earn/locked/subscriptionPreview"; /** * GET /sapi/v1/simple-earn/locked/subscriptionPreview *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* projectId -- mandatory/string
* amount -- mandatory/decimal
* autoSubscribe -- optional/boolean -- true or false, default true.
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/earn/Get-Locked-Subscription-Preview */ public String lockedSubscriptionPreview(Map parameters) { ParameterChecker.checkParameter(parameters, "projectId", String.class); ParameterChecker.checkRequiredParameter(parameters, "amount"); return requestHandler.sendSignedRequest(baseUrl, LOCKED_SUBSCRIPTION_PREVIEW, parameters, HttpMethod.GET, showLimitUsage); } private final String RATE_HISTORY = "/sapi/v1/simple-earn/flexible/history/rateHistory"; /** * GET /sapi/v1/simple-earn/flexible/history/rateHistory *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* productId -- mandatory/string
* 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
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/history/Get-Rate-History */ public String rateHistory(Map parameters) { ParameterChecker.checkParameter(parameters, "productId", String.class); return requestHandler.sendSignedRequest(baseUrl, RATE_HISTORY, parameters, HttpMethod.GET, showLimitUsage); } private final String COLLATERAL_RECORD = "/sapi/v1/simple-earn/flexible/history/collateralRecord"; /** * GET /sapi/v1/simple-earn/flexible/history/collateralRecord *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* productId -- optional/string
* 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
* size -- optional/long -- Default:10 Max:100
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/simple_earn/history/Get-Collateral-Record */ public String collateralRecord(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, COLLATERAL_RECORD, parameters, HttpMethod.GET, showLimitUsage); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy