![JAR search and dependency download from the Maven repository](/logo.png)
com.binance.connector.client.impl.spot.Savings Maven / Gradle / Ivy
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;
/**
* Savings Endpoints
* All endpoints under the
* Savings Endpoint
* section of the API documentation will be implemented in this class.
*
* Response will be returned in String format.
*/
public class Savings {
private final String baseUrl;
private final RequestHandler requestHandler;
private final boolean showLimitUsage;
public Savings(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 Savings(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 ACTIVITY_PROJECT = "/sapi/v1/lending/project/list";
/**
* GET /sapi/v1/lending/project/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
* type -- mandatory/enum -- "ACTIVITY", "CUSTOMIZED_FIXED"
* status -- optional/enum -- "ALL", "SUBSCRIBABLE", "UNSUBSCRIBABLE"; default "ALL"
* isSortAsc -- optional/boolean -- default "true"
* sortBy -- optional/enum -- "START_TIME", "LOT_SIZE", "INTEREST_RATE", "DURATION"; default "START_TIME"
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default:10, Max:100
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#get-fixed-and-activity-project-list-user_data
*/
public String projectList(Map parameters) {
ParameterChecker.checkParameter(parameters, "type", String.class);
return requestHandler.sendSignedRequest(baseUrl, ACTIVITY_PROJECT, parameters, HttpMethod.GET, showLimitUsage);
}
private final String PURCHASE_ACTIVITY = "/sapi/v1/lending/customizedFixed/purchase";
/**
* POST /sapi/v1/lending/customizedFixed/purchase
*
* @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
* lot -- mandatory/long
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#purchase-fixed-activity-project-user_data
*/
public String purchaseProject(Map parameters) {
ParameterChecker.checkParameter(parameters, "projectId", String.class);
ParameterChecker.checkParameter(parameters, "lot", Long.class);
return requestHandler.sendSignedRequest(baseUrl, PURCHASE_ACTIVITY, parameters, HttpMethod.POST, showLimitUsage);
}
private final String PROJECT_POSITION = "/sapi/v1/lending/project/position/list";
/**
* GET /sapi/v1/lending/project/position/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
* projectId -- optional/string
* status -- optional/enum -- "HOLDING", "REDEEMED"
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#get-fixed-activity-project-position-user_data
*/
public String projectPosition(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, PROJECT_POSITION, parameters, HttpMethod.GET, showLimitUsage);
}
private final String CHANGE_TO_DAILY_POSITION = "/sapi/v1/lending/positionChanged";
/**
* POST /sapi/v1/lending/positionChanged
*
* @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
* lot -- mandatory/long
* positionId -- optional/long -- for fixed position
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#change-fixed-activity-position-to-daily-position-user_data
*/
public String changeToDailyPosition(Map parameters) {
ParameterChecker.checkParameter(parameters, "projectId", String.class);
ParameterChecker.checkParameter(parameters, "lot", Long.class);
return requestHandler.sendSignedRequest(baseUrl, CHANGE_TO_DAILY_POSITION, parameters, HttpMethod.POST, showLimitUsage);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy