Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
* All endpoints under the
* Mining Endpoint
* section of the API documentation will be implemented in this class.
*
* Response will be returned in String format.
*/
public class Mining {
private final String baseUrl;
private final RequestHandler requestHandler;
private final boolean showLimitUsage;
public Mining(String baseUrl, String apiKey, String secretKey, boolean showLimitUsage) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, new HmacSignatureGenerator(secretKey));
this.showLimitUsage = showLimitUsage;
}
public Mining(String baseUrl, String apiKey, SignatureGenerator signatureGenerator, boolean showLimitUsage) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, signatureGenerator);
this.showLimitUsage = showLimitUsage;
}
private final String ALGO = "/sapi/v1/mining/pub/algoList";
/**
* GET /sapi/v1/mining/pub/algoList
*
* @param
* parameters LinkedHashedMap 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/#acquiring-algorithm-user_data
*/
public String algorithm(LinkedHashMap parameters) {
return requestHandler.sendSignedRequest(baseUrl, ALGO, parameters, HttpMethod.GET, showLimitUsage);
}
private final String COIN_NAME = "/sapi/v1/mining/pub/coinList";
/**
* GET /sapi/v1/mining/pub/coinList
*
* @param
* parameters LinkedHashedMap 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/#acquiring-coinname-user_data
*/
public String coinName(LinkedHashMap parameters) {
return requestHandler.sendSignedRequest(baseUrl, COIN_NAME, parameters, HttpMethod.GET, showLimitUsage);
}
private final String DETAIL_MINER_LIST = "/sapi/v1/mining/worker/detail";
/**
* GET /sapi/v1/mining/worker/detail
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* algo -- mandatory/string -- sha256
* userName -- mandatory/string -- Mining account
* workerName -- mandatory/string -- Miner's name(required)
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#request-for-detail-miner-list-user_data
*/
public String detailMinerList(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "algo", String.class);
ParameterChecker.checkParameter(parameters, "userName", String.class);
ParameterChecker.checkParameter(parameters, "workerName", String.class);
return requestHandler.sendSignedRequest(baseUrl, DETAIL_MINER_LIST, parameters, HttpMethod.GET, showLimitUsage);
}
private final String MINER_LIST = "/sapi/v1/mining/worker/list";
/**
* GET /sapi/v1/mining/worker/list
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* algo -- mandatory/string -- sha256
* userName -- mandatory/string -- Mining account
* pageIndex -- optional/int -- Page number,default is first page,start form 1
* sort -- optional/int -- sort sequence(default=0)0 positive sequence, 1 negative sequence
* sortColumn -- optional/int -- Sort by( default 1):
* 1: miner name,
* 2: real-time computing power,
* 3: daily average computing power,
* 4: real-time rejection rate,
* 5: last submission time
* workerStatus -- optional/int -- miners status(default=0)0 all,1 valid,2 invalid,3 failure
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#request-for-miner-list-user_data
*/
public String minerList(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "algo", String.class);
ParameterChecker.checkParameter(parameters, "userName", String.class);
return requestHandler.sendSignedRequest(baseUrl, MINER_LIST, parameters, HttpMethod.GET, showLimitUsage);
}
private final String EARNING_LIST = "/sapi/v1/mining/payment/list";
/**
* GET /sapi/v1/mining/payment/list
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* algo -- mandatory/string -- sha256
* userName -- mandatory/string -- Mining account
* coin -- optional/string
* startDate -- optional/long -- Search date, millisecond timestamp, while empty query all
* endDate -- optional/long -- Search date, millisecond timestamp, while empty query all
* pageIndex -- optional/int -- Page number, empty default first page, starting from 1
* pageSize -- optional/int -- Number of pages, minimum 10, maximum 200
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#earnings-list-user_data
*/
public String earningList(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "algo", String.class);
ParameterChecker.checkParameter(parameters, "userName", String.class);
return requestHandler.sendSignedRequest(baseUrl, EARNING_LIST, parameters, HttpMethod.GET, showLimitUsage);
}
private final String BONUS_LIST = "/sapi/v1/mining/payment/other";
/**
* GET /sapi/v1/mining/payment/other
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* algo -- mandatory/string -- sha256
* userName -- mandatory/string -- Mining account
* coin -- optional/string
* startDate -- optional/long -- Search date, millisecond timestamp, while empty query all
* endDate -- optional/long -- Search date, millisecond timestamp, while empty query all
* pageIndex -- optional/int -- Page number, empty default first page, starting from 1
* pageSize -- optional/int -- Number of pages, minimum 10, maximum 200
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#extra-bonus-list-user_data
*/
public String bonusList(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "algo", String.class);
ParameterChecker.checkParameter(parameters, "userName", String.class);
return requestHandler.sendSignedRequest(baseUrl, BONUS_LIST, parameters, HttpMethod.GET, showLimitUsage);
}
private final String HASHRATE_RESALE_LIST = "/sapi/v1/mining/hash-transfer/config/details/list";
/**
* GET /sapi/v1/mining/hash-transfer/config/details/list
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* pageIndex -- optional/int -- Page number, empty default first page, starting from 1
* pageSize -- optional/int -- Number of pages, minimum 10, maximum 200
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-list-user_data
*/
public String hashrateResaleList(LinkedHashMap parameters) {
return requestHandler.sendSignedRequest(baseUrl, HASHRATE_RESALE_LIST, parameters, HttpMethod.GET, showLimitUsage);
}
private final String HASHRATE_RESALE_DETAIL = "/sapi/v1/mining/hash-transfer/profit/details";
/**
* GET /sapi/v1/mining/hash-transfer/profit/details
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* configId -- mandatory/int -- Mining ID
* userName -- mandatory/string -- Mining Account
* pageIndex -- optional/int -- Page number, empty default first page, starting from 1
* pageSize -- optional/int -- Number of pages, minimum 10, maximum 200
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-detail-user_data
*/
public String hashrateResaleDetail(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "configId", Integer.class);
ParameterChecker.checkParameter(parameters, "userName", String.class);
return requestHandler.sendSignedRequest(baseUrl, HASHRATE_RESALE_DETAIL, parameters, HttpMethod.GET, showLimitUsage);
}
private final String HASHRATE_RESALE_REQUEST = "/sapi/v1/mining/hash-transfer/config";
/**
* GET /sapi/v1/mining/hash-transfer/config
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* userName -- mandatory/string -- Mining Account
* algo -- mandatory/string -- Transfer algorithm(sha256)
* endDate -- mandatory/long -- Resale End Time (Millisecond timestamp)
* startDate -- mandatory/long -- Resale Start Time(Millisecond timestamp)
* toPoolUser -- mandatory/string -- Mining Account
* hashRate -- mandatory/long -- Resale hashrate h/s must be transferred (BTC is greater than 500000000000 ETH is greater than 500000)
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-request-user_data
*/
public String hashrateResaleRequest(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "userName", String.class);
ParameterChecker.checkParameter(parameters, "algo", String.class);
ParameterChecker.checkParameter(parameters, "endDate", Long.class);
ParameterChecker.checkParameter(parameters, "startDate", Long.class);
ParameterChecker.checkParameter(parameters, "toPoolUser", String.class);
ParameterChecker.checkParameter(parameters, "hashRate", Long.class);
return requestHandler.sendSignedRequest(baseUrl, HASHRATE_RESALE_REQUEST, parameters, HttpMethod.POST, showLimitUsage);
}
private final String CANCEL_HASHRATE_RESALE_CONFIG = "/sapi/v1/mining/hash-transfer/config/cancel";
/**
* GET /sapi/v1/mining/hash-transfer/config/cancel
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* configId -- mandatory/int -- Mining ID
* userName -- mandatory/string -- Mining Account
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#cancel-hashrate-resale-configuration-user_data
*/
public String cancelHashrateResaleConfig(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "configId", Integer.class);
ParameterChecker.checkParameter(parameters, "userName", String.class);
return requestHandler.sendSignedRequest(baseUrl, CANCEL_HASHRATE_RESALE_CONFIG, parameters, HttpMethod.POST, showLimitUsage);
}
private final String STATSTICS_LIST = "/sapi/v1/mining/statistics/user/status";
/**
* GET /sapi/v1/mining/statistics/user/status
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* algo -- mandatory/string -- Algorithm(sha256)
* userName -- mandatory/string -- Mining Account
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#statistic-list-user_data
*/
public String statsticsList(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "algo", String.class);
ParameterChecker.checkParameter(parameters, "userName", String.class);
return requestHandler.sendSignedRequest(baseUrl, STATSTICS_LIST, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ACCOUNT_LIST = "/sapi/v1/mining/statistics/user/list";
/**
* GET /sapi/v1/mining/statistics/user/list
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* algo -- mandatory/string -- Algorithm(sha256)
* userName -- mandatory/string -- Mining Account
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#account-list-user_data
*/
public String accountList(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "algo", String.class);
ParameterChecker.checkParameter(parameters, "userName", String.class);
return requestHandler.sendSignedRequest(baseUrl, ACCOUNT_LIST, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ACCOUNT_EARNING = "/sapi/v1/mining/payment/uid";
/**
* GET /sapi/v1/mining/payment/uid
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*