diff --git a/CHANGELOG.md b/CHANGELOG.md index ff123ae5..d78ea61a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,41 @@ # Changelog +## 3.1.0 - 2023-10-17 + +### Added +- Allow custom timestamp when sending a signed request for both REST API and WebSocket API. + +### Removed +- Deleted some deprecated Lending endpoints (within Savings): + - `GET /sapi/v1/lending/daily/product/list` + - `GET /sapi/v1/lending/daily/userLeftQuota` + - `POST /sapi/v1/lending/daily/purchase` + - `GET /sapi/v1/lending/daily/userRedemptionQuota` + - `POST /sapi/v1/lending/daily/redeem` + - `GET /sapi/v1/lending/daily/token/position` + - `GET /sapi/v1/lending/union/account` + - `GET /sapi/v1/lending/union/purchaseRecord` + - `GET /sapi/v1/lending/union/redemptionRecord` + - `GET /sapi/v1/lending/union/interestHistory` + +- Deleted deprecated Futures cross collateral endpoints: + - `GET /sapi/v1/futures/loan/borrow/history` + - `GET /sapi/v1/futures/loan/repay/history` + - `GET /sapi/v2/futures/loan/wallet` + - `GET /sapi/v1/futures/loan/adjustCollateral/history` + - `GET /sapi/v1/futures/loan/liquidationHistory` + - `GET /sapi/v1/futures/loan/interestHistory` + +- Deleted WebSocketStreamClient's `allBookTickerStream` (`!bookTicker`). + +### Changed +- Upgraded `org.json` dependency to version `20231013`. + ## 3.0.0 - 2023-09-28 ### Changed - Upgraded `org.bouncycastle:bcprov-jdk18on` dependency to version `1.74`. - ## 3.0.0rc3 - 2023-06-27 ### Added diff --git a/pom.xml b/pom.xml index 89689164..550321cf 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.binance binance-connector-java - 3.0.0 + 3.1.0 jar ${project.groupId}:${project.artifactId} lightweight connector to API @@ -172,7 +172,7 @@ org.json json - 20230227 + 20231013 org.slf4j diff --git a/src/main/java/com/binance/connector/client/WebSocketStreamClient.java b/src/main/java/com/binance/connector/client/WebSocketStreamClient.java index 4128b24b..58d97ef5 100644 --- a/src/main/java/com/binance/connector/client/WebSocketStreamClient.java +++ b/src/main/java/com/binance/connector/client/WebSocketStreamClient.java @@ -29,8 +29,6 @@ public interface WebSocketStreamClient { int allRollingWindowTicker(String windowSize, WebSocketOpenCallback onOpenCallback, WebSocketMessageCallback onMessageCallback, WebSocketClosingCallback onClosingCallback, WebSocketClosedCallback onClosedCallback, WebSocketFailureCallback onFailureCallback); int bookTicker(String symbol, WebSocketMessageCallback callback); int bookTicker(String symbol, WebSocketOpenCallback onOpenCallback, WebSocketMessageCallback onMessageCallback, WebSocketClosingCallback onClosingCallback, WebSocketClosedCallback onClosedCallback, WebSocketFailureCallback onFailureCallback); - int allBookTickerStream(WebSocketMessageCallback callback); - int allBookTickerStream(WebSocketOpenCallback onOpenCallback, WebSocketMessageCallback onMessageCallback, WebSocketClosingCallback onClosingCallback, WebSocketClosedCallback onClosedCallback, WebSocketFailureCallback onFailureCallback); int partialDepthStream(String symbol, int levels, int speed, WebSocketMessageCallback callback); int partialDepthStream(String symbol, int levels, int speed, WebSocketOpenCallback onOpenCallback, WebSocketMessageCallback onMessageCallback, WebSocketClosingCallback onClosingCallback, WebSocketClosedCallback onClosedCallback, WebSocketFailureCallback onFailureCallback); int diffDepthStream(String symbol, int speed, WebSocketMessageCallback callback); diff --git a/src/main/java/com/binance/connector/client/impl/WebSocketStreamClientImpl.java b/src/main/java/com/binance/connector/client/impl/WebSocketStreamClientImpl.java index 5efdd5af..d7587ced 100644 --- a/src/main/java/com/binance/connector/client/impl/WebSocketStreamClientImpl.java +++ b/src/main/java/com/binance/connector/client/impl/WebSocketStreamClientImpl.java @@ -426,37 +426,6 @@ public int bookTicker(String symbol, WebSocketOpenCallback onOpenCallback, WebSo return createConnection(onOpenCallback, onMessageCallback, onClosingCallback, onClosedCallback, onFailureCallback, request); } - /** - * Pushes any update to the best bid or ask's price or quantity in real-time for all symbols. - *

- * !bookTicker - *

- * Update Speed: Real-time - * - * @return int - Connection ID - * @see - * https://binance-docs.github.io/apidocs/spot/en/#all-book-tickers-stream - */ - @Override - public int allBookTickerStream(WebSocketMessageCallback callback) { - return allBookTickerStream(noopOpenCallback, callback, noopClosingCallback, noopClosedCallback, noopFailureCallback); - } - - /** - * Same as {@link #allBookTickerStream(WebSocketMessageCallback)} plus accepts callbacks for all major websocket connection events. - * - * @param onOpenCallback Callback for when the websocket connection is opened - * @param onMessageCallback Callback for when a message is received - * @param onClosingCallback Callback for when the websocket connection is closing - * @param onFailureCallback Callback for when an error occurs - * @return int - Connection ID - */ - @Override - public int allBookTickerStream(WebSocketOpenCallback onOpenCallback, WebSocketMessageCallback onMessageCallback, WebSocketClosingCallback onClosingCallback, WebSocketClosedCallback onClosedCallback, WebSocketFailureCallback onFailureCallback) { - Request request = RequestBuilder.buildWebSocketRequest(String.format("%s/ws/!bookTicker", baseUrl)); - return createConnection(onOpenCallback, onMessageCallback, onClosingCallback, onClosedCallback, onFailureCallback, request); - } - /** * Top bids and asks, Valid are 5, 10, or 20. *

diff --git a/src/main/java/com/binance/connector/client/impl/spot/Futures.java b/src/main/java/com/binance/connector/client/impl/spot/Futures.java index f0797605..621aa23d 100644 --- a/src/main/java/com/binance/connector/client/impl/spot/Futures.java +++ b/src/main/java/com/binance/connector/client/impl/spot/Futures.java @@ -84,129 +84,4 @@ public String futuresTransferHistory(Map parameters) { ParameterChecker.checkParameter(parameters, "startTime", Long.class); return requestHandler.sendSignedRequest(baseUrl, FUTURES_TRANSFER, parameters, HttpMethod.GET, showLimitUsage); } - - private final String BORROW_HISTORY = "/sapi/v1/futures/loan/borrow/history"; - /** - * GET /sapi/v1/futures/loan/borrow/history - *
- * @param - * parameters Map of String,Object pair - * where String is the name of the parameter and Object is the value of the parameter - *

- * coin -- optional/string
- * startTime -- optional/long
- * endTime -- optional/long
- * limit -- optional/long -- default 500, max 1000
- * recvWindow -- optional/long
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-borrow-history-user_data - */ - public String borrowHistory(Map parameters) { - return requestHandler.sendSignedRequest(baseUrl, BORROW_HISTORY, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String REPAY_HISTORY = "/sapi/v1/futures/loan/repay/history"; - /** - * GET /sapi/v1/futures/loan/repay/history - *
- * @param - * parameters Map of String,Object pair - * where String is the name of the parameter and Object is the value of the parameter - *

- * coin -- optional/string
- * startTime -- optional/long
- * endTime -- optional/long
- * limit -- optional/long -- default 500, max 1000
- * recvWindow -- optional/long
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-repayment-history-user_data - */ - public String repayHistory(Map parameters) { - return requestHandler.sendSignedRequest(baseUrl, REPAY_HISTORY, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String WALLET = "/sapi/v2/futures/loan/wallet"; - /** - * GET /sapi/v2/futures/loan/wallet - *
- * @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/#cross-collateral-wallet-user_data - */ - public String loanWallet(Map parameters) { - return requestHandler.sendSignedRequest(baseUrl, WALLET, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String ADJUST_COLLATERAL_HISTORY = "/sapi/v1/futures/loan/adjustCollateral/history"; - /** - * GET /sapi/v1/futures/loan/adjustCollateral/history - *
- * @param - * parameters Map of String,Object pair - * where String is the name of the parameter and Object is the value of the parameter - *

- * loanCoin -- optional/string
- * collateralCoin -- optional/string
- * startTime -- optional/long
- * endTime -- optional/long
- * limit -- optional/long -- default 500, max 1000
- * recvWindow -- optional/long
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-history-user_data - */ - public String adjustCollateralHistory(Map parameters) { - return requestHandler.sendSignedRequest(baseUrl, ADJUST_COLLATERAL_HISTORY, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String LIQUIDATION_HISTORY = "/sapi/v1/futures/loan/liquidationHistory"; - /** - * GET /sapi/v1/futures/loan/liquidationHistory - *
- * @param - * parameters Map of String,Object pair - * where String is the name of the parameter and Object is the value of the parameter - *

- * loanCoin -- optional/string
- * collateralCoin -- optional/string
- * startTime -- optional/long
- * endTime -- optional/long
- * limit -- optional/long -- default 500, max 1000
- * recvWindow -- optional/long
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-liquidation-history-user_data - */ - public String liquidationHistory(Map parameters) { - return requestHandler.sendSignedRequest(baseUrl, LIQUIDATION_HISTORY, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String INTEREST_HISTORY = "/sapi/v1/futures/loan/interestHistory"; - /** - * GET /sapi/v1/futures/loan/interestHistory - *
- * @param - * parameters Map of String,Object pair - * where String is the name of the parameter and Object is the value of the parameter - *

- * collateralCoin -- optional/string
- * startTime -- optional/long
- * endTime -- optional/long
- * current -- optional/long -- Currently querying page. Start from 1. Default:1
- * limit -- optional/long -- default 500, max 1000
- * recvWindow -- optional/long
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-interest-history-user_data - */ - public String interestHistory(Map parameters) { - return requestHandler.sendSignedRequest(baseUrl, INTEREST_HISTORY, parameters, HttpMethod.GET, showLimitUsage); - } } diff --git a/src/main/java/com/binance/connector/client/impl/spot/Savings.java b/src/main/java/com/binance/connector/client/impl/spot/Savings.java index d006c9ac..3dcdda8b 100644 --- a/src/main/java/com/binance/connector/client/impl/spot/Savings.java +++ b/src/main/java/com/binance/connector/client/impl/spot/Savings.java @@ -34,129 +34,6 @@ public Savings(String baseUrl, String apiKey, SignatureGenerator signatureGenera this.showLimitUsage = showLimitUsage; } - private final String FLEXIBLE_PRODUCT = "/sapi/v1/lending/daily/product/list"; - /** - * GET /sapi/v1/lending/daily/product/list - *
- * @param - * parameters Map of String,Object pair - * where String is the name of the parameter and Object is the value of the parameter - *

- * status -- optional/enum -- "ALL", "SUBSCRIBABLE", "UNSUBSCRIBABLE"; Default: "ALL"
- * featured -- optional/string -- "ALL", "TRUE"; Default: "ALL"
- * current -- optional/long -- Current query page. Default: 1, Min: 1
- * size -- optional/long -- Default: 50, Max: 100
- * recvWindow -- optional/long
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-list-user_data - */ - public String flexibleProducts(Map parameters) { - return requestHandler.sendSignedRequest(baseUrl, FLEXIBLE_PRODUCT, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String PURCHASE_QUOTA = "/sapi/v1/lending/daily/userLeftQuota"; - /** - * GET /sapi/v1/lending/daily/userLeftQuota - *
- * @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
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#get-left-daily-purchase-quota-of-flexible-product-user_data - */ - public String purchaseQuotaFlexible(Map parameters) { - ParameterChecker.checkParameter(parameters, "productId", String.class); - return requestHandler.sendSignedRequest(baseUrl, PURCHASE_QUOTA, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String PURCHASE_PRODUCT = "/sapi/v1/lending/daily/purchase"; - /** - * POST /sapi/v1/lending/daily/purchase - *
- * @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
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#purchase-flexible-product-user_data - */ - public String purchaseFlexibleProduct(Map parameters) { - ParameterChecker.checkParameter(parameters, "productId", String.class); - ParameterChecker.checkRequiredParameter(parameters, "amount"); - return requestHandler.sendSignedRequest(baseUrl, PURCHASE_PRODUCT, parameters, HttpMethod.POST, showLimitUsage); - } - - private final String DAILY_REDEMPTION_QUOTA = "/sapi/v1/lending/daily/userRedemptionQuota"; - /** - * GET /sapi/v1/lending/daily/userRedemptionQuota - *
- * @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
- * type -- mandatory/enum -- "FAST", "NORMAL"
- * recvWindow -- optional/long
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#get-left-daily-redemption-quota-of-flexible-product-user_data - */ - public String dailyRedemptionQuota(Map parameters) { - ParameterChecker.checkParameter(parameters, "productId", String.class); - ParameterChecker.checkParameter(parameters, "type", String.class); - return requestHandler.sendSignedRequest(baseUrl, DAILY_REDEMPTION_QUOTA, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String REDEEM_PRODUCT = "/sapi/v1/lending/daily/redeem"; - /** - * POST /sapi/v1/lending/daily/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
- * amount -- mandatory/decimal
- * type -- mandatory/enum -- "FAST", "NORMAL"
- * recvWindow -- optional/long
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#redeem-flexible-product-user_data - */ - public String redeemFlexibleProduct(Map parameters) { - ParameterChecker.checkParameter(parameters, "productId", String.class); - ParameterChecker.checkRequiredParameter(parameters, "amount"); - ParameterChecker.checkParameter(parameters, "type", String.class); - return requestHandler.sendSignedRequest(baseUrl, REDEEM_PRODUCT, parameters, HttpMethod.POST, showLimitUsage); - } - - private final String PRODUCT_POSTION = "/sapi/v1/lending/daily/token/position"; - /** - * GET /sapi/v1/lending/daily/token/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
- * recvWindow -- optional/long
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-position-user_data - */ - public String flexibleProductPosition(Map parameters) { - return requestHandler.sendSignedRequest(baseUrl, PRODUCT_POSTION, parameters, HttpMethod.GET, showLimitUsage); - } - private final String ACTIVITY_PROJECT = "/sapi/v1/lending/project/list"; /** * GET /sapi/v1/lending/project/list @@ -223,95 +100,6 @@ public String projectPosition(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, PROJECT_POSITION, parameters, HttpMethod.GET, showLimitUsage); } - private final String LENDING_ACCOUNT = "/sapi/v1/lending/union/account"; - /** - * GET /sapi/v1/lending/union/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
- * @return String - * @see - * https://binance-docs.github.io/apidocs/spot/en/#lending-account-user_data - */ - public String lendingAccount(Map parameters) { - return requestHandler.sendSignedRequest(baseUrl, LENDING_ACCOUNT, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String PURCHASE_RECORD = "/sapi/v1/lending/union/purchaseRecord"; - /** - * GET /sapi/v1/lending/union/purchaseRecord - *
- * @param - * parameters Map of String,Object pair - * where String is the name of the parameter and Object is the value of the parameter - *

- * lendingType -- mandatory/enum -- "DAILY" for flexible, "ACTIVITY" for activity, "CUSTOMIZED_FIXED" for fixed
- * asset -- optional/string
- * startTime -- optional/long
- * endTime -- optional/long
- * 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-purchase-record-user_data - */ - public String purchaseRecord(Map parameters) { - ParameterChecker.checkParameter(parameters, "lendingType", String.class); - return requestHandler.sendSignedRequest(baseUrl, PURCHASE_RECORD, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String REDEMPTION_RECORD = "/sapi/v1/lending/union/redemptionRecord"; - /** - * GET /sapi/v1/lending/union/redemptionRecord - *
- * @param - * parameters Map of String,Object pair - * where String is the name of the parameter and Object is the value of the parameter - *

- * lendingType -- mandatory/enum -- "DAILY" for flexible, "ACTIVITY" for activity, "CUSTOMIZED_FIXED" for fixed
- * asset -- optional/string
- * startTime -- optional/long
- * endTime -- optional/long
- * 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-redemption-record-user_data - */ - public String redemptionRecord(Map parameters) { - ParameterChecker.checkParameter(parameters, "lendingType", String.class); - return requestHandler.sendSignedRequest(baseUrl, REDEMPTION_RECORD, parameters, HttpMethod.GET, showLimitUsage); - } - - private final String INTEREST_HISTORY = "/sapi/v1/lending/union/interestHistory"; - /** - * GET /sapi/v1/lending/union/interestHistory - *
- * @param - * parameters Map of String,Object pair - * where String is the name of the parameter and Object is the value of the parameter - *

- * lendingType -- mandatory/enum -- "DAILY" for flexible, "ACTIVITY" for activity, "CUSTOMIZED_FIXED" for fixed
- * asset -- optional/string
- * startTime -- optional/long
- * endTime -- optional/long
- * 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-interest-history-user_data-2 - */ - public String interestHistory(Map parameters) { - ParameterChecker.checkParameter(parameters, "lendingType", String.class); - return requestHandler.sendSignedRequest(baseUrl, INTEREST_HISTORY, parameters, HttpMethod.GET, showLimitUsage); - } - private final String CHANGE_TO_DAILY_POSITION = "/sapi/v1/lending/positionChanged"; /** * POST /sapi/v1/lending/positionChanged diff --git a/src/main/java/com/binance/connector/client/utils/RequestBuilder.java b/src/main/java/com/binance/connector/client/utils/RequestBuilder.java index d89afba6..45ef0154 100644 --- a/src/main/java/com/binance/connector/client/utils/RequestBuilder.java +++ b/src/main/java/com/binance/connector/client/utils/RequestBuilder.java @@ -9,7 +9,7 @@ public final class RequestBuilder { private static final MediaType JSON_TYPE = MediaType.parse("application/json; charset=utf-8"); - private static final String USER_AGENT = "binance-connector-java/3.0.0"; + private static final String USER_AGENT = "binance-connector-java/3.1.0"; private static final String CONTENT_TYPE = "application/x-www-form-urlencoded"; private RequestBuilder() { diff --git a/src/main/java/com/binance/connector/client/utils/RequestHandler.java b/src/main/java/com/binance/connector/client/utils/RequestHandler.java index 91af21d9..5fdfb879 100644 --- a/src/main/java/com/binance/connector/client/utils/RequestHandler.java +++ b/src/main/java/com/binance/connector/client/utils/RequestHandler.java @@ -53,7 +53,7 @@ public String sendSignedRequest(String baseUrl, String urlPath, Map parameters = new LinkedHashMap<>(); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createFutures().adjustCollateralHistory(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/futures/BorrowHistory.java b/src/test/java/examples/spot/futures/BorrowHistory.java deleted file mode 100644 index 5f203bfd..00000000 --- a/src/test/java/examples/spot/futures/BorrowHistory.java +++ /dev/null @@ -1,22 +0,0 @@ -package examples.spot.futures; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class BorrowHistory { - private BorrowHistory() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createFutures().borrowHistory(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/futures/InterestHistory.java b/src/test/java/examples/spot/futures/InterestHistory.java deleted file mode 100644 index c22ce857..00000000 --- a/src/test/java/examples/spot/futures/InterestHistory.java +++ /dev/null @@ -1,23 +0,0 @@ -package examples.spot.futures; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class InterestHistory { - private InterestHistory() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createFutures().interestHistory(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/futures/LiquidationHistory.java b/src/test/java/examples/spot/futures/LiquidationHistory.java deleted file mode 100644 index a3ffd299..00000000 --- a/src/test/java/examples/spot/futures/LiquidationHistory.java +++ /dev/null @@ -1,22 +0,0 @@ -package examples.spot.futures; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class LiquidationHistory { - private LiquidationHistory() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createFutures().liquidationHistory(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/futures/LoanWallet.java b/src/test/java/examples/spot/futures/LoanWallet.java deleted file mode 100644 index 879f1482..00000000 --- a/src/test/java/examples/spot/futures/LoanWallet.java +++ /dev/null @@ -1,22 +0,0 @@ -package examples.spot.futures; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class LoanWallet { - private LoanWallet() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createFutures().loanWallet(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/futures/RepayHistory.java b/src/test/java/examples/spot/futures/RepayHistory.java deleted file mode 100644 index afc92d1a..00000000 --- a/src/test/java/examples/spot/futures/RepayHistory.java +++ /dev/null @@ -1,22 +0,0 @@ -package examples.spot.futures; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class RepayHistory { - private RepayHistory() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createFutures().repayHistory(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/savings/DailyRedemptionQuota.java b/src/test/java/examples/spot/savings/DailyRedemptionQuota.java deleted file mode 100644 index 25fa2fd4..00000000 --- a/src/test/java/examples/spot/savings/DailyRedemptionQuota.java +++ /dev/null @@ -1,24 +0,0 @@ -package examples.spot.savings; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class DailyRedemptionQuota { - private DailyRedemptionQuota() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - parameters.put("productId", "TKO001"); - parameters.put("type", "FAST"); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createSavings().dailyRedemptionQuota(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/savings/FlexibleProductPosition.java b/src/test/java/examples/spot/savings/FlexibleProductPosition.java deleted file mode 100644 index a69437fd..00000000 --- a/src/test/java/examples/spot/savings/FlexibleProductPosition.java +++ /dev/null @@ -1,22 +0,0 @@ -package examples.spot.savings; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class FlexibleProductPosition { - private FlexibleProductPosition() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createSavings().flexibleProductPosition(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/savings/FlexibleProducts.java b/src/test/java/examples/spot/savings/FlexibleProducts.java deleted file mode 100644 index cb4a7fa8..00000000 --- a/src/test/java/examples/spot/savings/FlexibleProducts.java +++ /dev/null @@ -1,22 +0,0 @@ -package examples.spot.savings; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class FlexibleProducts { - private FlexibleProducts() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createSavings().flexibleProducts(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/savings/InterestHistory.java b/src/test/java/examples/spot/savings/InterestHistory.java deleted file mode 100644 index bd1d97a5..00000000 --- a/src/test/java/examples/spot/savings/InterestHistory.java +++ /dev/null @@ -1,23 +0,0 @@ -package examples.spot.savings; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class InterestHistory { - private InterestHistory() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - parameters.put("lendingType", "DAILY"); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createSavings().interestHistory(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/savings/LendingAccount.java b/src/test/java/examples/spot/savings/LendingAccount.java deleted file mode 100644 index 0235db9a..00000000 --- a/src/test/java/examples/spot/savings/LendingAccount.java +++ /dev/null @@ -1,22 +0,0 @@ -package examples.spot.savings; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class LendingAccount { - private LendingAccount() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createSavings().lendingAccount(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/savings/PurchaseFlexibleProduct.java b/src/test/java/examples/spot/savings/PurchaseFlexibleProduct.java deleted file mode 100644 index d878e9a0..00000000 --- a/src/test/java/examples/spot/savings/PurchaseFlexibleProduct.java +++ /dev/null @@ -1,25 +0,0 @@ -package examples.spot.savings; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class PurchaseFlexibleProduct { - private PurchaseFlexibleProduct() { - } - private static final double amount = 0.01; - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - parameters.put("productId", "TKO001"); - parameters.put("amount", amount); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createSavings().purchaseFlexibleProduct(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/savings/PurchaseQuota.java b/src/test/java/examples/spot/savings/PurchaseQuota.java deleted file mode 100644 index 7ed91a9c..00000000 --- a/src/test/java/examples/spot/savings/PurchaseQuota.java +++ /dev/null @@ -1,23 +0,0 @@ -package examples.spot.savings; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class PurchaseQuota { - private PurchaseQuota() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - parameters.put("productId", "TKO001"); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createSavings().purchaseQuotaFlexible(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/savings/PurchaseRecord.java b/src/test/java/examples/spot/savings/PurchaseRecord.java deleted file mode 100644 index 0ef9d12e..00000000 --- a/src/test/java/examples/spot/savings/PurchaseRecord.java +++ /dev/null @@ -1,23 +0,0 @@ -package examples.spot.savings; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class PurchaseRecord { - private PurchaseRecord() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - parameters.put("lendingType", "DAILY"); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createSavings().purchaseRecord(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/savings/RedeemFlexibleProduct.java b/src/test/java/examples/spot/savings/RedeemFlexibleProduct.java deleted file mode 100644 index ac7b8091..00000000 --- a/src/test/java/examples/spot/savings/RedeemFlexibleProduct.java +++ /dev/null @@ -1,26 +0,0 @@ -package examples.spot.savings; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class RedeemFlexibleProduct { - private RedeemFlexibleProduct() { - } - private static final double amount = 0.01; - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - parameters.put("productId", "TKO001"); - parameters.put("amount", amount); - parameters.put("type", "FAST"); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createSavings().redeemFlexibleProduct(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/examples/spot/savings/RedemptionRecord.java b/src/test/java/examples/spot/savings/RedemptionRecord.java deleted file mode 100644 index f6f17e3b..00000000 --- a/src/test/java/examples/spot/savings/RedemptionRecord.java +++ /dev/null @@ -1,23 +0,0 @@ -package examples.spot.savings; - -import java.util.LinkedHashMap; -import java.util.Map; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.impl.SpotClientImpl; - -import examples.PrivateConfig; - -public final class RedemptionRecord { - private RedemptionRecord() { - } - - public static void main(String[] args) { - Map parameters = new LinkedHashMap<>(); - parameters.put("lendingType", "DAILY"); - - SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY); - String result = client.createSavings().redemptionRecord(parameters); - System.out.println(result); - } -} diff --git a/src/test/java/unit/spot/futures/TestAdjustCollateralHistory.java b/src/test/java/unit/spot/futures/TestAdjustCollateralHistory.java deleted file mode 100644 index 31dfb989..00000000 --- a/src/test/java/unit/spot/futures/TestAdjustCollateralHistory.java +++ /dev/null @@ -1,42 +0,0 @@ -package unit.spot.futures; - -import static org.junit.Assert.assertEquals; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestAdjustCollateralHistory { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testAdjustCollateralHistory() { - String path = "/sapi/v1/futures/loan/adjustCollateral/history"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createFutures().adjustCollateralHistory(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/futures/TestBorrowHistory.java b/src/test/java/unit/spot/futures/TestBorrowHistory.java deleted file mode 100644 index 02a31198..00000000 --- a/src/test/java/unit/spot/futures/TestBorrowHistory.java +++ /dev/null @@ -1,42 +0,0 @@ -package unit.spot.futures; - -import static org.junit.Assert.assertEquals; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestBorrowHistory { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testBorrowHistory() { - String path = "/sapi/v1/futures/loan/borrow/history"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createFutures().borrowHistory(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/futures/TestInterestHistory.java b/src/test/java/unit/spot/futures/TestInterestHistory.java deleted file mode 100644 index 0fb97f70..00000000 --- a/src/test/java/unit/spot/futures/TestInterestHistory.java +++ /dev/null @@ -1,42 +0,0 @@ -package unit.spot.futures; - -import static org.junit.Assert.assertEquals; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestInterestHistory { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testInterestHistory() { - String path = "/sapi/v1/futures/loan/interestHistory"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createFutures().interestHistory(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/futures/TestLiquidationHistory.java b/src/test/java/unit/spot/futures/TestLiquidationHistory.java deleted file mode 100644 index f2f6167c..00000000 --- a/src/test/java/unit/spot/futures/TestLiquidationHistory.java +++ /dev/null @@ -1,42 +0,0 @@ -package unit.spot.futures; - -import static org.junit.Assert.assertEquals; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestLiquidationHistory { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testLiquidationHistory() { - String path = "/sapi/v1/futures/loan/liquidationHistory"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createFutures().liquidationHistory(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/futures/TestLoanWallet.java b/src/test/java/unit/spot/futures/TestLoanWallet.java deleted file mode 100644 index e4d90e4c..00000000 --- a/src/test/java/unit/spot/futures/TestLoanWallet.java +++ /dev/null @@ -1,42 +0,0 @@ -package unit.spot.futures; - -import static org.junit.Assert.assertEquals; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestLoanWallet { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testLoanWallet() { - String path = "/sapi/v2/futures/loan/wallet"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createFutures().loanWallet(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/futures/TestRepayHistory.java b/src/test/java/unit/spot/futures/TestRepayHistory.java deleted file mode 100644 index 4229beb9..00000000 --- a/src/test/java/unit/spot/futures/TestRepayHistory.java +++ /dev/null @@ -1,42 +0,0 @@ -package unit.spot.futures; - -import static org.junit.Assert.assertEquals; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestRepayHistory { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testRepayHistory() { - String path = "/sapi/v1/futures/loan/repay/history"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createFutures().repayHistory(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/savings/TestDailyRedemptionQuota.java b/src/test/java/unit/spot/savings/TestDailyRedemptionQuota.java deleted file mode 100644 index d3be2a5c..00000000 --- a/src/test/java/unit/spot/savings/TestDailyRedemptionQuota.java +++ /dev/null @@ -1,58 +0,0 @@ -package unit.spot.savings; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.exceptions.BinanceConnectorException; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestDailyRedemptionQuota { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testDailyRedemptionQuotaWithoutParameters() { - String path = "/sapi/v1/lending/daily/userRedemptionQuota"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - assertThrows(BinanceConnectorException.class, () -> client.createSavings().dailyRedemptionQuota(parameters)); - } - - @Test - public void testDailyRedemptionQuota() { - String path = "/sapi/v1/lending/daily/userRedemptionQuota?productId=123&type=FAST"; - Map parameters = new LinkedHashMap<>(); - parameters.put("productId", "123"); - parameters.put("type", "FAST"); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createSavings().dailyRedemptionQuota(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/savings/TestFlexibleProductPosition.java b/src/test/java/unit/spot/savings/TestFlexibleProductPosition.java deleted file mode 100644 index 318febe8..00000000 --- a/src/test/java/unit/spot/savings/TestFlexibleProductPosition.java +++ /dev/null @@ -1,42 +0,0 @@ -package unit.spot.savings; - -import static org.junit.Assert.assertEquals; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestFlexibleProductPosition { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testFlexibleProductPosition() { - String path = "/sapi/v1/lending/daily/token/position"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createSavings().flexibleProductPosition(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/savings/TestFlexibleProducts.java b/src/test/java/unit/spot/savings/TestFlexibleProducts.java deleted file mode 100644 index 86640106..00000000 --- a/src/test/java/unit/spot/savings/TestFlexibleProducts.java +++ /dev/null @@ -1,44 +0,0 @@ -package unit.spot.savings; - -import static org.junit.Assert.assertEquals; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestFlexibleProducts { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testFlexibleProducts() { - String path = "/sapi/v1/lending/daily/product/list?status=ALL&featured=ALL"; - Map parameters = new LinkedHashMap<>(); - parameters.put("status", "ALL"); - parameters.put("featured", "ALL"); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createSavings().flexibleProducts(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/savings/TestInterestHistory.java b/src/test/java/unit/spot/savings/TestInterestHistory.java deleted file mode 100644 index ab4ef2df..00000000 --- a/src/test/java/unit/spot/savings/TestInterestHistory.java +++ /dev/null @@ -1,57 +0,0 @@ -package unit.spot.savings; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.exceptions.BinanceConnectorException; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestInterestHistory { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testInterestHistoryWithoutParameters() { - String path = "/sapi/v1/lending/union/interestHistory"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - assertThrows(BinanceConnectorException.class, () -> client.createSavings().interestHistory(parameters)); - } - - @Test - public void testInterestHistory() { - String path = "/sapi/v1/lending/union/interestHistory?lendingType=DAILY"; - Map parameters = new LinkedHashMap<>(); - parameters.put("lendingType", "DAILY"); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createSavings().interestHistory(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/savings/TestLendingAccount.java b/src/test/java/unit/spot/savings/TestLendingAccount.java deleted file mode 100644 index 5619110e..00000000 --- a/src/test/java/unit/spot/savings/TestLendingAccount.java +++ /dev/null @@ -1,43 +0,0 @@ -package unit.spot.savings; - -import static org.junit.Assert.assertEquals; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestLendingAccount { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testLendingAccount() { - String path = "/sapi/v1/lending/union/account"; - Map parameters = new LinkedHashMap<>(); - - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createSavings().lendingAccount(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/savings/TestPurchaseFlexibleProduct.java b/src/test/java/unit/spot/savings/TestPurchaseFlexibleProduct.java deleted file mode 100644 index b5c1d648..00000000 --- a/src/test/java/unit/spot/savings/TestPurchaseFlexibleProduct.java +++ /dev/null @@ -1,60 +0,0 @@ -package unit.spot.savings; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.exceptions.BinanceConnectorException; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestPurchaseFlexibleProduct { - private MockWebServer mockWebServer; - private String baseUrl; - - private final double amount = 0.01; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testPurchaseFlexibleProductWithoutParameters() { - String path = "/sapi/v1/lending/daily/purchase"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.POST, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - assertThrows(BinanceConnectorException.class, () -> client.createSavings().purchaseFlexibleProduct(parameters)); - } - - @Test - public void testPurchaseFlexibleProduct() { - String path = "/sapi/v1/lending/daily/purchase?productId=123&amount=0.01"; - Map parameters = new LinkedHashMap<>(); - parameters.put("productId", "123"); - parameters.put("amount", amount); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.POST, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createSavings().purchaseFlexibleProduct(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/savings/TestPurchaseQuota.java b/src/test/java/unit/spot/savings/TestPurchaseQuota.java deleted file mode 100644 index ffd298da..00000000 --- a/src/test/java/unit/spot/savings/TestPurchaseQuota.java +++ /dev/null @@ -1,57 +0,0 @@ -package unit.spot.savings; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.exceptions.BinanceConnectorException; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestPurchaseQuota { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testPurchaseQuotaWithoutParameters() { - String path = "/sapi/v1/lending/daily/userLeftQuota"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - assertThrows(BinanceConnectorException.class, () -> client.createSavings().purchaseQuotaFlexible(parameters)); - } - - @Test - public void testPurchaseQuota() { - String path = "/sapi/v1/lending/daily/userLeftQuota?productId=123"; - Map parameters = new LinkedHashMap<>(); - parameters.put("productId", "123"); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createSavings().purchaseQuotaFlexible(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/savings/TestPurchaseRecord.java b/src/test/java/unit/spot/savings/TestPurchaseRecord.java deleted file mode 100644 index f6e8e12e..00000000 --- a/src/test/java/unit/spot/savings/TestPurchaseRecord.java +++ /dev/null @@ -1,57 +0,0 @@ -package unit.spot.savings; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.exceptions.BinanceConnectorException; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestPurchaseRecord { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testPurchaseRecordWithoutParameters() { - String path = "/sapi/v1/lending/union/purchaseRecord"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - assertThrows(BinanceConnectorException.class, () -> client.createSavings().purchaseRecord(parameters)); - } - - @Test - public void testPurchaseRecord() { - String path = "/sapi/v1/lending/union/purchaseRecord?lendingType=DAILY"; - Map parameters = new LinkedHashMap<>(); - parameters.put("lendingType", "DAILY"); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createSavings().purchaseRecord(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/savings/TestRedeemFlexibleProduct.java b/src/test/java/unit/spot/savings/TestRedeemFlexibleProduct.java deleted file mode 100644 index 1b057146..00000000 --- a/src/test/java/unit/spot/savings/TestRedeemFlexibleProduct.java +++ /dev/null @@ -1,61 +0,0 @@ -package unit.spot.savings; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.exceptions.BinanceConnectorException; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestRedeemFlexibleProduct { - private MockWebServer mockWebServer; - private String baseUrl; - - private final double amount = 0.01; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testRedeemFlexibleProductWithoutParameters() { - String path = "/sapi/v1/lending/daily/redeem"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.POST, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - assertThrows(BinanceConnectorException.class, () -> client.createSavings().redeemFlexibleProduct(parameters)); - } - - @Test - public void testRedeemFlexibleProduct() { - String path = "/sapi/v1/lending/daily/redeem?productId=123&amount=0.01&type=FAST"; - Map parameters = new LinkedHashMap<>(); - parameters.put("productId", "123"); - parameters.put("amount", amount); - parameters.put("type", "FAST"); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.POST, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createSavings().redeemFlexibleProduct(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -} diff --git a/src/test/java/unit/spot/savings/TestRedemptionRecord.java b/src/test/java/unit/spot/savings/TestRedemptionRecord.java deleted file mode 100644 index 7cb7c705..00000000 --- a/src/test/java/unit/spot/savings/TestRedemptionRecord.java +++ /dev/null @@ -1,57 +0,0 @@ -package unit.spot.savings; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.binance.connector.client.SpotClient; -import com.binance.connector.client.enums.HttpMethod; -import com.binance.connector.client.exceptions.BinanceConnectorException; -import com.binance.connector.client.impl.SpotClientImpl; - -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockWebServer; -import unit.MockData; -import unit.MockWebServerDispatcher; - -public class TestRedemptionRecord { - private MockWebServer mockWebServer; - private String baseUrl; - - @Before - public void init() { - this.mockWebServer = new MockWebServer(); - this.baseUrl = mockWebServer.url(MockData.PREFIX).toString(); - } - - @Test - public void testRedemptionRecordWithoutParameters() { - String path = "/sapi/v1/lending/union/redemptionRecord"; - Map parameters = new LinkedHashMap<>(); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - assertThrows(BinanceConnectorException.class, () -> client.createSavings().redemptionRecord(parameters)); - } - - @Test - public void testRedemptionRecord() { - String path = "/sapi/v1/lending/union/redemptionRecord?lendingType=DAILY"; - Map parameters = new LinkedHashMap<>(); - parameters.put("lendingType", "DAILY"); - - Dispatcher dispatcher = MockWebServerDispatcher.getDispatcher(MockData.PREFIX, path, MockData.MOCK_RESPONSE, HttpMethod.GET, MockData.HTTP_STATUS_OK); - mockWebServer.setDispatcher(dispatcher); - - SpotClient client = new SpotClientImpl(MockData.API_KEY, MockData.SECRET_KEY, baseUrl); - String result = client.createSavings().redemptionRecord(parameters); - assertEquals(MockData.MOCK_RESPONSE, result); - } -}