From 20918984b9805bafe429478ffe870993fed8aaf7 Mon Sep 17 00:00:00 2001 From: theo-s68 <194042188+theo-s68@users.noreply.github.com> Date: Wed, 18 Mar 2026 14:29:53 +0700 Subject: [PATCH] regenerate product 18/03/2026 --- MIGRATION.md | 2 +- README.md | 2 +- clients/common/pom.xml | 2 +- .../websocket/adapter/ConnectionWrapper.java | 24 +- .../stream/StreamConnectionWrapper.java | 5 + .../CHANGELOG.md | 12 + ...ExchangeInformationResponseSymbolsInner.md | 2 +- .../docs/rest-api/migration-guide.md | 4 +- .../derivatives-trading-coin-futures/pom.xml | 4 +- .../rest/api/AccountApi.java | 2 +- .../rest/api/MarketDataApi.java | 2 +- .../rest/api/PortfolioMarginEndpointsApi.java | 2 +- .../rest/api/TradeApi.java | 2 +- .../rest/api/UserDataStreamsApi.java | 2 +- ...changeInformationResponseSymbolsInner.java | 61 +- ...vativesTradingCoinFuturesWebSocketApi.java | 2 +- ...vesTradingCoinFuturesWebSocketStreams.java | 2 +- .../stream/api/WebsocketMarketStreamsApi.java | 2 +- .../derivatives-trading-options/CHANGELOG.md | 9 + ...AllOptionOrdersOnSpecificSymbolResponse.md | 2 +- .../docs/MarketMakerEndpointsApi.md | 2 +- .../docs/rest-api/migration-guide.md | 4 +- clients/derivatives-trading-options/pom.xml | 4 +- .../rest/api/AccountApi.java | 2 +- .../api/DerivativesTradingOptionsRestApi.java | 2 +- .../rest/api/MarketDataApi.java | 2 +- .../rest/api/MarketMakerBlockTradeApi.java | 2 +- .../rest/api/MarketMakerEndpointsApi.java | 4 +- .../rest/api/TradeApi.java | 2 +- .../rest/api/UserDataStreamsApi.java | 2 +- ...lOptionOrdersOnSpecificSymbolResponse.java | 16 +- ...vativesTradingOptionsWebSocketStreams.java | 2 +- .../websocket/stream/api/MarketApi.java | 2 +- .../websocket/stream/api/PublicApi.java | 2 +- .../CHANGELOG.md | 51 + ...ExchangeInformationResponseSymbolsInner.md | 2 +- ...arkPriceStreamForAllMarketResponseInner.md | 1 + .../docs/MarkPriceStreamResponse.md | 1 + .../docs/MarketApi.md | 953 +++++++++++ .../docs/PublicApi.md | 323 ++++ .../docs/rest-api/migration-guide.md | 4 +- .../example_websocket_stream.md | 44 +- .../derivatives-trading-usds-futures/pom.xml | 4 +- .../rest/JSON.java | 3 - .../rest/api/AccountApi.java | 2 +- .../rest/api/ConvertApi.java | 2 +- .../rest/api/MarketDataApi.java | 2 +- .../rest/api/PortfolioMarginEndpointsApi.java | 2 +- .../rest/api/TradeApi.java | 2 +- .../rest/api/UserDataStreamsApi.java | 2 +- .../rest/model/CancelOrderResponse.java | 41 + ...changeInformationResponseSymbolsInner.java | 61 +- .../rest/model/QueryOrderResponse.java | 887 +++++++++- ...vativesTradingUsdsFuturesWebSocketApi.java | 2 +- ...vesTradingUsdsFuturesWebSocketStreams.java | 153 +- .../websocket/stream/api/MarketApi.java | 1431 +++++++++++++++++ .../websocket/stream/api/PublicApi.java | 525 ++++++ ...kPriceStreamForAllMarketResponseInner.java | 48 +- .../stream/model/MarkPriceStreamResponse.java | 48 +- .../websocket/stream/api/MarketApiTest.java | 633 ++++++++ .../websocket/stream/api/PublicApiTest.java | 259 +++ clients/simple-earn/CHANGELOG.md | 7 + clients/simple-earn/docs/BfusdApi.md | 2 +- clients/simple-earn/docs/FlexibleLockedApi.md | 12 +- .../docs/GetBfusdQuotaDetailsResponse.md | 1 + ...sdQuotaDetailsResponseSubscriptionQuota.md | 13 + .../docs/rest-api/migration-guide.md | 4 +- clients/simple-earn/pom.xml | 4 +- .../client/simple_earn/rest/JSON.java | 3 + .../client/simple_earn/rest/api/BfusdApi.java | 6 +- .../rest/api/FlexibleLockedApi.java | 14 +- .../client/simple_earn/rest/api/RwusdApi.java | 2 +- .../rest/api/SimpleEarnRestApi.java | 16 +- .../model/GetBfusdQuotaDetailsResponse.java | 48 +- ...QuotaDetailsResponseSubscriptionQuota.java | 226 +++ clients/spot/CHANGELOG.md | 20 + clients/spot/docs/ExecutionReport.md | 1 + clients/spot/docs/ExecutionRulesRequest.md | 15 + clients/spot/docs/ExecutionRulesResponse.md | 15 + .../spot/docs/ExecutionRulesResponseResult.md | 13 + ...tionRulesResponseResultSymbolRulesInner.md | 14 + ...esponseResultSymbolRulesInnerRulesInner.md | 17 + .../ExecutionRulesResponseSymbolRulesInner.md | 14 + ...RulesResponseSymbolRulesInnerRulesInner.md | 17 + clients/spot/docs/GeneralApi.md | 63 + clients/spot/docs/MarketApi.md | 126 ++ .../docs/ReferencePriceCalculationRequest.md | 14 + .../docs/ReferencePriceCalculationResponse.md | 15 + ...ReferencePriceCalculationResponseResult.md | 17 + clients/spot/docs/ReferencePriceRequest.md | 13 + clients/spot/docs/ReferencePriceResponse.md | 16 + .../spot/docs/ReferencePriceResponseResult.md | 15 + clients/spot/docs/TradeApi.md | 2 +- .../spot/docs/UserDataStreamEventsResponse.md | 1 + clients/spot/docs/WebSocketStreamsApi.md | 63 + clients/spot/docs/rest-api/migration-guide.md | 4 +- clients/spot/example_rest.md | 8 +- clients/spot/example_websocket_api.md | 8 +- clients/spot/example_websocket_stream.md | 2 + clients/spot/pom.xml | 4 +- .../connector/client/spot/rest/JSON.java | 16 + .../client/spot/rest/api/AccountApi.java | 2 +- .../client/spot/rest/api/GeneralApi.java | 158 +- .../client/spot/rest/api/MarketApi.java | 280 +++- .../client/spot/rest/api/SpotRestApi.java | 86 +- .../client/spot/rest/api/TradeApi.java | 11 +- .../rest/model/ExecutionRulesResponse.java | 245 +++ ...xecutionRulesResponseSymbolRulesInner.java | 295 ++++ ...lesResponseSymbolRulesInnerRulesInner.java | 403 +++++ .../ReferencePriceCalculationResponse.java | 366 +++++ .../rest/model/ReferencePriceResponse.java | 283 ++++ .../client/spot/websocket/api/JSON.java | 34 + .../spot/websocket/api/api/GeneralApi.java | 66 + .../spot/websocket/api/api/MarketApi.java | 132 ++ .../websocket/api/api/SpotWebSocketApi.java | 23 +- .../spot/websocket/api/api/TradeApi.java | 7 +- .../websocket/api/model/ExecutionReport.java | 50 +- .../api/model/ExecutionRulesRequest.java | 322 ++++ .../api/model/ExecutionRulesResponse.java | 321 ++++ .../model/ExecutionRulesResponseResult.java | 276 ++++ ...onRulesResponseResultSymbolRulesInner.java | 331 ++++ ...ponseResultSymbolRulesInnerRulesInner.java | 460 ++++++ .../ReferencePriceCalculationRequest.java | 301 ++++ .../ReferencePriceCalculationResponse.java | 329 ++++ ...ferencePriceCalculationResponseResult.java | 422 +++++ .../api/model/ReferencePriceRequest.java | 251 +++ .../api/model/ReferencePriceResponse.java | 321 ++++ .../model/ReferencePriceResponseResult.java | 327 ++++ .../client/spot/websocket/stream/JSON.java | 6 + .../stream/api/SpotWebSocketStreams.java | 9 +- .../stream/api/WebSocketStreamsApi.java | 81 +- .../stream/model/ReferencePriceRequest.java | 251 +++ .../stream/model/ReferencePriceResponse.java | 367 +++++ .../websocket/api/api/GeneralApiTest.java | 67 + .../derivatives-trading-coin-futures/pom.xml | 2 +- examples/derivatives-trading-options/pom.xml | 2 +- .../SetAutoCancelAllOpenOrdersExample.java | 2 +- .../derivatives-trading-usds-futures/pom.xml | 2 +- .../market/AggregateTradeStreamsExample.java | 57 + ...lMarketLiquidationOrderStreamsExample.java | 56 + .../AllMarketMiniTickersStreamExample.java | 54 + .../AllMarketTickersStreamsExample.java | 54 + ...eIndexSymbolInformationStreamsExample.java | 56 + ...ontractKlineCandlestickStreamsExample.java | 58 + .../market/ContractInfoStreamExample.java | 53 + ...dividualSymbolMiniTickerStreamExample.java | 56 + .../IndividualSymbolTickerStreamsExample.java | 54 + .../KlineCandlestickStreamsExample.java | 55 + .../LiquidationOrderStreamsExample.java | 56 + .../stream/market/MarkPriceStreamExample.java | 53 + .../MarkPriceStreamForAllMarketExample.java | 54 + .../MultiAssetsModeAssetIndexExample.java | 52 + .../market/TradingSessionStreamExample.java | 57 + .../AllBookTickersStreamExample.java | 53 + .../DiffBookDepthStreamsExample.java | 54 + ...ividualSymbolBookTickerStreamsExample.java | 57 + .../PartialBookDepthStreamsExample.java | 56 + .../RpiDiffBookDepthStreamsExample.java | 57 + examples/simple-earn/pom.xml | 2 +- .../bfusd/GetBfusdQuotaDetailsExample.java | 4 +- .../GetFlexibleRedemptionRecordExample.java | 2 +- .../GetFlexibleRewardsHistoryExample.java | 2 +- .../GetFlexibleSubscriptionRecordExample.java | 2 +- .../GetLockedRedemptionRecordExample.java | 2 +- .../GetLockedRewardsHistoryExample.java | 2 +- .../GetLockedSubscriptionRecordExample.java | 2 +- examples/spot/pom.xml | 2 +- .../rest/general/ExecutionRulesExample.java | 57 + .../ReferencePriceCalculationExample.java | 54 + .../rest/market/ReferencePriceExample.java | 51 + .../rest/trade/OrderCancelReplaceExample.java | 8 +- .../api/general/ExecutionRulesExample.java | 76 + .../ReferencePriceCalculationExample.java | 78 + .../api/market/ReferencePriceExample.java | 76 + .../api/trade/OrderCancelReplaceExample.java | 16 +- .../ReferencePriceExample.java | 50 + 176 files changed, 14699 insertions(+), 330 deletions(-) create mode 100644 clients/derivatives-trading-usds-futures/docs/MarketApi.md create mode 100644 clients/derivatives-trading-usds-futures/docs/PublicApi.md create mode 100644 clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/MarketApi.java create mode 100644 clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/PublicApi.java create mode 100644 clients/derivatives-trading-usds-futures/src/test/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/MarketApiTest.java create mode 100644 clients/derivatives-trading-usds-futures/src/test/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/PublicApiTest.java create mode 100644 clients/simple-earn/docs/GetBfusdQuotaDetailsResponseSubscriptionQuota.md create mode 100644 clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/model/GetBfusdQuotaDetailsResponseSubscriptionQuota.java create mode 100644 clients/spot/docs/ExecutionRulesRequest.md create mode 100644 clients/spot/docs/ExecutionRulesResponse.md create mode 100644 clients/spot/docs/ExecutionRulesResponseResult.md create mode 100644 clients/spot/docs/ExecutionRulesResponseResultSymbolRulesInner.md create mode 100644 clients/spot/docs/ExecutionRulesResponseResultSymbolRulesInnerRulesInner.md create mode 100644 clients/spot/docs/ExecutionRulesResponseSymbolRulesInner.md create mode 100644 clients/spot/docs/ExecutionRulesResponseSymbolRulesInnerRulesInner.md create mode 100644 clients/spot/docs/ReferencePriceCalculationRequest.md create mode 100644 clients/spot/docs/ReferencePriceCalculationResponse.md create mode 100644 clients/spot/docs/ReferencePriceCalculationResponseResult.md create mode 100644 clients/spot/docs/ReferencePriceRequest.md create mode 100644 clients/spot/docs/ReferencePriceResponse.md create mode 100644 clients/spot/docs/ReferencePriceResponseResult.md create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponse.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponseSymbolRulesInner.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponseSymbolRulesInnerRulesInner.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ReferencePriceCalculationResponse.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ReferencePriceResponse.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesRequest.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponse.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResult.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResultSymbolRulesInner.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResultSymbolRulesInnerRulesInner.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationRequest.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationResponse.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationResponseResult.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceRequest.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceResponse.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceResponseResult.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/model/ReferencePriceRequest.java create mode 100644 clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/model/ReferencePriceResponse.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AggregateTradeStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketLiquidationOrderStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketMiniTickersStreamExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketTickersStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/CompositeIndexSymbolInformationStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/ContinuousContractKlineCandlestickStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/ContractInfoStreamExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/IndividualSymbolMiniTickerStreamExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/IndividualSymbolTickerStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/KlineCandlestickStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/LiquidationOrderStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamForAllMarketExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MultiAssetsModeAssetIndexExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/TradingSessionStreamExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/AllBookTickersStreamExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/DiffBookDepthStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/IndividualSymbolBookTickerStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/PartialBookDepthStreamsExample.java create mode 100644 examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/RpiDiffBookDepthStreamsExample.java create mode 100644 examples/spot/src/main/java/com/binance/connector/client/spot/rest/general/ExecutionRulesExample.java create mode 100644 examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/ReferencePriceCalculationExample.java create mode 100644 examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/ReferencePriceExample.java create mode 100644 examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/general/ExecutionRulesExample.java create mode 100644 examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/ReferencePriceCalculationExample.java create mode 100644 examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/ReferencePriceExample.java create mode 100644 examples/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/websocketstreams/ReferencePriceExample.java diff --git a/MIGRATION.md b/MIGRATION.md index cd981a333..057de289c 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -37,7 +37,7 @@ For Spot (Spot package): io.github.binance binance-spot - 9.0.0 + 10.0.0 ``` diff --git a/README.md b/README.md index 925fe6202..ccc66043f 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Each connector is published as a separate maven dependency. For example: io.github.binance binance-spot - 9.0.0 + 10.0.0 ``` diff --git a/clients/common/pom.xml b/clients/common/pom.xml index ffd87392c..09cc7efbc 100644 --- a/clients/common/pom.xml +++ b/clients/common/pom.xml @@ -10,6 +10,6 @@ binance-common common - 2.3.1 + 2.4.1 jar \ No newline at end of file diff --git a/clients/common/src/main/java/com/binance/connector/client/common/websocket/adapter/ConnectionWrapper.java b/clients/common/src/main/java/com/binance/connector/client/common/websocket/adapter/ConnectionWrapper.java index 633dee54b..c55cd76de 100644 --- a/clients/common/src/main/java/com/binance/connector/client/common/websocket/adapter/ConnectionWrapper.java +++ b/clients/common/src/main/java/com/binance/connector/client/common/websocket/adapter/ConnectionWrapper.java @@ -447,6 +447,11 @@ public void onWebSocketText(String message) { try { JsonElement root = JsonParser.parseString(message); JsonObject obj = root.getAsJsonObject(); + + if (handleShutdownMessage(obj)) { + return; + } + JsonElement idElem = obj.get("id"); String id = idElem == null ? null : idElem.getAsString(); RequestWrapperDTO requestWrapperDTO = null; @@ -455,8 +460,8 @@ public void onWebSocketText(String message) { } if (requestWrapperDTO == null) { + JsonElement eventElem = obj.get("event"); for (BlockingQueue streamQueue : streamQueues) { - JsonElement eventElem = obj.get("event"); streamQueue.offer(eventElem != null ? eventElem.toString() : message); } return; @@ -493,6 +498,23 @@ public boolean canReconnect() { return isReady && pendingRequest.isEmpty(); } + protected boolean handleShutdownMessage(JsonObject jsonObj) { + JsonElement eventElem = jsonObj.get("event"); + if (eventElem != null) { + JsonObject eventElemObj = eventElem.getAsJsonObject(); + JsonElement eElement = eventElemObj.get("e"); + if (eElement != null && "serverShutdown".equals(eElement.getAsString())) { + if (canReconnect()) { + connect(); + } else { + pendingReconnect = true; + } + return true; + } + } + return false; + } + protected void beforeConnect() { // session exists and is open, it's a reconnect if (this.session != null && this.session.isOpen()) { diff --git a/clients/common/src/main/java/com/binance/connector/client/common/websocket/adapter/stream/StreamConnectionWrapper.java b/clients/common/src/main/java/com/binance/connector/client/common/websocket/adapter/stream/StreamConnectionWrapper.java index 1fc647fa8..c5749ea8a 100644 --- a/clients/common/src/main/java/com/binance/connector/client/common/websocket/adapter/stream/StreamConnectionWrapper.java +++ b/clients/common/src/main/java/com/binance/connector/client/common/websocket/adapter/stream/StreamConnectionWrapper.java @@ -95,6 +95,11 @@ public void onWebSocketText(String message) { try { JsonElement root = JsonParser.parseString(message); JsonObject obj = root.getAsJsonObject(); + + if (handleShutdownMessage(obj)) { + return; + } + // Response to subscribe JsonElement id = obj.get("id"); if (id != null) { diff --git a/clients/derivatives-trading-coin-futures/CHANGELOG.md b/clients/derivatives-trading-coin-futures/CHANGELOG.md index a5dd1fc97..dbd80f344 100644 --- a/clients/derivatives-trading-coin-futures/CHANGELOG.md +++ b/clients/derivatives-trading-coin-futures/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 7.0.0 - 2026-03-18 + +### Changed (1) + +#### REST API + +- Modified response for `exchangeInformation()` (`GET /dapi/v1/exchangeInfo`): + - `symbols`.items: property `orderTypes` added + - `symbols`.items: property `OrderType` deleted + - `symbols`.items: item property `orderTypes` added + - `symbols`.items: item property `OrderType` deleted + ## 6.0.0 - 2026-02-12 ### Changed (2) diff --git a/clients/derivatives-trading-coin-futures/docs/ExchangeInformationResponseSymbolsInner.md b/clients/derivatives-trading-coin-futures/docs/ExchangeInformationResponseSymbolsInner.md index da8573198..ceaf70a18 100644 --- a/clients/derivatives-trading-coin-futures/docs/ExchangeInformationResponseSymbolsInner.md +++ b/clients/derivatives-trading-coin-futures/docs/ExchangeInformationResponseSymbolsInner.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**filters** | [**List<ExchangeInformationResponseSymbolsInnerFiltersInner>**](ExchangeInformationResponseSymbolsInnerFiltersInner.md) | | [optional] | -|**orderType** | **List<String>** | | [optional] | +|**orderTypes** | **List<String>** | | [optional] | |**timeInForce** | **List<String>** | | [optional] | |**liquidationFee** | **String** | | [optional] | |**marketTakeBound** | **String** | | [optional] | diff --git a/clients/derivatives-trading-coin-futures/docs/rest-api/migration-guide.md b/clients/derivatives-trading-coin-futures/docs/rest-api/migration-guide.md index b1a919496..09f20692a 100644 --- a/clients/derivatives-trading-coin-futures/docs/rest-api/migration-guide.md +++ b/clients/derivatives-trading-coin-futures/docs/rest-api/migration-guide.md @@ -22,7 +22,7 @@ With the transition to a modularized structure, the Binance Connector has been s io.github.binance binance-derivatives-trading-coin-futures - 6.0.0 + 7.0.0 ``` @@ -91,7 +91,7 @@ by: io.github.binance binance-derivatives-trading-coin-futures - 6.0.0 + 7.0.0 ``` diff --git a/clients/derivatives-trading-coin-futures/pom.xml b/clients/derivatives-trading-coin-futures/pom.xml index 7455e2d52..796853d8c 100644 --- a/clients/derivatives-trading-coin-futures/pom.xml +++ b/clients/derivatives-trading-coin-futures/pom.xml @@ -5,7 +5,7 @@ 4.0.0 binance-derivatives-trading-coin-futures derivatives-trading-coin-futures - 6.0.0 + 7.0.0 jar @@ -31,7 +31,7 @@ io.github.binance binance-common - 2.3.1 + 2.4.1 \ No newline at end of file diff --git a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/AccountApi.java b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/AccountApi.java index e47d23245..8f816ee9c 100644 --- a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/AccountApi.java +++ b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/AccountApi.java @@ -54,7 +54,7 @@ public class AccountApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-coin-futures/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-coin-futures/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/MarketDataApi.java b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/MarketDataApi.java index 6f1d90074..2aebbfa47 100644 --- a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/MarketDataApi.java +++ b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/MarketDataApi.java @@ -69,7 +69,7 @@ public class MarketDataApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-coin-futures/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-coin-futures/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/PortfolioMarginEndpointsApi.java b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/PortfolioMarginEndpointsApi.java index 997507abc..5fc706b67 100644 --- a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/PortfolioMarginEndpointsApi.java +++ b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/PortfolioMarginEndpointsApi.java @@ -42,7 +42,7 @@ public class PortfolioMarginEndpointsApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-coin-futures/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-coin-futures/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/TradeApi.java b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/TradeApi.java index 0d7bbe58f..ea2707996 100644 --- a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/TradeApi.java +++ b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/TradeApi.java @@ -79,7 +79,7 @@ public class TradeApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-coin-futures/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-coin-futures/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/UserDataStreamsApi.java b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/UserDataStreamsApi.java index ee13e380a..3bb5a1265 100644 --- a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/UserDataStreamsApi.java +++ b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/api/UserDataStreamsApi.java @@ -43,7 +43,7 @@ public class UserDataStreamsApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-coin-futures/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-coin-futures/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/model/ExchangeInformationResponseSymbolsInner.java b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/model/ExchangeInformationResponseSymbolsInner.java index bc551d943..2cfec841d 100644 --- a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/model/ExchangeInformationResponseSymbolsInner.java +++ b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/model/ExchangeInformationResponseSymbolsInner.java @@ -48,11 +48,11 @@ public class ExchangeInformationResponseSymbolsInner { @jakarta.annotation.Nullable private List<@Valid ExchangeInformationResponseSymbolsInnerFiltersInner> filters; - public static final String SERIALIZED_NAME_ORDER_TYPE = "OrderType"; + public static final String SERIALIZED_NAME_ORDER_TYPES = "orderTypes"; - @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + @SerializedName(SERIALIZED_NAME_ORDER_TYPES) @jakarta.annotation.Nullable - private List orderType; + private List orderTypes; public static final String SERIALIZED_NAME_TIME_IN_FORCE = "timeInForce"; @@ -227,32 +227,32 @@ public void setFilters( this.filters = filters; } - public ExchangeInformationResponseSymbolsInner orderType( - @jakarta.annotation.Nullable List orderType) { - this.orderType = orderType; + public ExchangeInformationResponseSymbolsInner orderTypes( + @jakarta.annotation.Nullable List orderTypes) { + this.orderTypes = orderTypes; return this; } - public ExchangeInformationResponseSymbolsInner addOrderTypeItem(String orderTypeItem) { - if (this.orderType == null) { - this.orderType = new ArrayList<>(); + public ExchangeInformationResponseSymbolsInner addOrderTypesItem(String orderTypesItem) { + if (this.orderTypes == null) { + this.orderTypes = new ArrayList<>(); } - this.orderType.add(orderTypeItem); + this.orderTypes.add(orderTypesItem); return this; } /** - * Get orderType + * Get orderTypes * - * @return orderType + * @return orderTypes */ @jakarta.annotation.Nullable - public List getOrderType() { - return orderType; + public List getOrderTypes() { + return orderTypes; } - public void setOrderType(@jakarta.annotation.Nullable List orderType) { - this.orderType = orderType; + public void setOrderTypes(@jakarta.annotation.Nullable List orderTypes) { + this.orderTypes = orderTypes; } public ExchangeInformationResponseSymbolsInner timeInForce( @@ -743,7 +743,8 @@ public boolean equals(Object o) { ExchangeInformationResponseSymbolsInner exchangeInformationResponseSymbolsInner = (ExchangeInformationResponseSymbolsInner) o; return Objects.equals(this.filters, exchangeInformationResponseSymbolsInner.filters) - && Objects.equals(this.orderType, exchangeInformationResponseSymbolsInner.orderType) + && Objects.equals( + this.orderTypes, exchangeInformationResponseSymbolsInner.orderTypes) && Objects.equals( this.timeInForce, exchangeInformationResponseSymbolsInner.timeInForce) && Objects.equals( @@ -800,7 +801,7 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash( filters, - orderType, + orderTypes, timeInForce, liquidationFee, marketTakeBound, @@ -831,7 +832,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ExchangeInformationResponseSymbolsInner {\n"); sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" orderTypes: ").append(toIndentedString(orderTypes)).append("\n"); sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n"); sb.append(" liquidationFee: ").append(toIndentedString(liquidationFee)).append("\n"); sb.append(" marketTakeBound: ").append(toIndentedString(marketTakeBound)).append("\n"); @@ -875,13 +876,13 @@ public String toUrlQueryString() { ((Collection) filtersValue) .stream().map(Object::toString).collect(Collectors.joining(",")); sb.append("filters=").append(urlEncode(filtersValueAsString)).append(""); - Object orderTypeValue = getOrderType(); - String orderTypeValueAsString = ""; - orderTypeValueAsString = + Object orderTypesValue = getOrderTypes(); + String orderTypesValueAsString = ""; + orderTypesValueAsString = (String) - ((Collection) orderTypeValue) + ((Collection) orderTypesValue) .stream().map(Object::toString).collect(Collectors.joining(",")); - sb.append("orderType=").append(urlEncode(orderTypeValueAsString)).append(""); + sb.append("orderTypes=").append(urlEncode(orderTypesValueAsString)).append(""); Object timeInForceValue = getTimeInForce(); String timeInForceValueAsString = ""; timeInForceValueAsString = @@ -1021,7 +1022,7 @@ private String toIndentedString(Object o) { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); openapiFields.add("filters"); - openapiFields.add("OrderType"); + openapiFields.add("orderTypes"); openapiFields.add("timeInForce"); openapiFields.add("liquidationFee"); openapiFields.add("marketTakeBound"); @@ -1092,14 +1093,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } // ensure the optional json data is an array if present - if (jsonObj.get("OrderType") != null - && !jsonObj.get("OrderType").isJsonNull() - && !jsonObj.get("OrderType").isJsonArray()) { + if (jsonObj.get("orderTypes") != null + && !jsonObj.get("orderTypes").isJsonNull() + && !jsonObj.get("orderTypes").isJsonArray()) { throw new IllegalArgumentException( String.format( - "Expected the field `OrderType` to be an array in the JSON string but" + "Expected the field `orderTypes` to be an array in the JSON string but" + " got `%s`", - jsonObj.get("OrderType").toString())); + jsonObj.get("orderTypes").toString())); } // ensure the optional json data is an array if present if (jsonObj.get("timeInForce") != null diff --git a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/api/api/DerivativesTradingCoinFuturesWebSocketApi.java b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/api/api/DerivativesTradingCoinFuturesWebSocketApi.java index bab9e717f..3fe38ddd3 100644 --- a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/api/api/DerivativesTradingCoinFuturesWebSocketApi.java +++ b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/api/api/DerivativesTradingCoinFuturesWebSocketApi.java @@ -34,7 +34,7 @@ public class DerivativesTradingCoinFuturesWebSocketApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-coin-futures/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-coin-futures/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private AccountApi accountApi; diff --git a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/stream/api/DerivativesTradingCoinFuturesWebSocketStreams.java b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/stream/api/DerivativesTradingCoinFuturesWebSocketStreams.java index f21114cc5..d48ea6082 100644 --- a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/stream/api/DerivativesTradingCoinFuturesWebSocketStreams.java +++ b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/stream/api/DerivativesTradingCoinFuturesWebSocketStreams.java @@ -58,7 +58,7 @@ public class DerivativesTradingCoinFuturesWebSocketStreams { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-coin-futures/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-coin-futures/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private final StreamConnectionInterface connection; diff --git a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/stream/api/WebsocketMarketStreamsApi.java b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/stream/api/WebsocketMarketStreamsApi.java index f9f2714d7..84acac394 100644 --- a/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/stream/api/WebsocketMarketStreamsApi.java +++ b/clients/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/websocket/stream/api/WebsocketMarketStreamsApi.java @@ -75,7 +75,7 @@ public class WebsocketMarketStreamsApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-coin-futures/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-coin-futures/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private StreamConnectionInterface connection; diff --git a/clients/derivatives-trading-options/CHANGELOG.md b/clients/derivatives-trading-options/CHANGELOG.md index 8dfc07d1d..53230f778 100644 --- a/clients/derivatives-trading-options/CHANGELOG.md +++ b/clients/derivatives-trading-options/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 6.0.0 - 2026-03-18 + +### Changed (1) + +#### REST API + +- Modified response for `cancelAllOptionOrdersOnSpecificSymbol()` (`DELETE /eapi/v1/allOpenOrders`): + - `code`: type `integer` → `string` + ## 5.0.0 - 2025-12-16 ### Changed (2) diff --git a/clients/derivatives-trading-options/docs/CancelAllOptionOrdersOnSpecificSymbolResponse.md b/clients/derivatives-trading-options/docs/CancelAllOptionOrdersOnSpecificSymbolResponse.md index d2e033007..2ba6d315c 100644 --- a/clients/derivatives-trading-options/docs/CancelAllOptionOrdersOnSpecificSymbolResponse.md +++ b/clients/derivatives-trading-options/docs/CancelAllOptionOrdersOnSpecificSymbolResponse.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**code** | **Long** | | [optional] | +|**code** | **String** | | [optional] | |**msg** | **String** | | [optional] | diff --git a/clients/derivatives-trading-options/docs/MarketMakerEndpointsApi.md b/clients/derivatives-trading-options/docs/MarketMakerEndpointsApi.md index 33f4ed14d..1604e153a 100644 --- a/clients/derivatives-trading-options/docs/MarketMakerEndpointsApi.md +++ b/clients/derivatives-trading-options/docs/MarketMakerEndpointsApi.md @@ -270,7 +270,7 @@ No authorization required Set Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE) -This endpoint sets the parameters of the auto-cancel feature which cancels all open orders (both market maker protection and non market maker protection order types) of the underlying symbol at the end of the specified countdown time period if no heartbeat message is sent. After the countdown time period, all open orders will be cancelled and new orders will be rejected with error code -2010 until either a heartbeat message is sent or the auto-cancel feature is turned off by setting countdownTime to 0. * This rest endpoint sets up the parameters to cancel your open orders in case of an outage or disconnection. * Example usage: Call this endpoint with a countdownTime value of 10000 (10 seconds) to turn on the auto-cancel feature. If the corresponding countdownCancelAllHeartBeat endpoint is not called within 10 seconds with the specified underlying symbol, all open orders of the specified symbol will be automatically canceled. If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped. * The system will check all countdowns approximately every 1000 milliseconds, **please note that sufficient redundancy should be considered when using this function**. We do not recommend setting the countdown time to be too precise or too small. Weight: 1 +This endpoint sets the parameters of the auto-cancel feature which cancels all open orders (both market maker protection and non market maker protection order types) of the underlying symbol at the end of the specified countdown time period if no heartbeat message is sent. After the countdown time period, all open orders will be cancelled and new orders will be rejected with error code -2010 until either a heartbeat message is sent or the auto-cancel feature is turned off by setting countdownTime to 0. * This rest endpoint sets up the parameters to cancel your open orders in case of an outage or disconnection. * Example usage: Call this endpoint with a countdownTime value of 10000 (10 seconds) to turn on the auto-cancel feature. If the corresponding countdownCancelAllHeartBeat endpoint is not called within 10 seconds with the specified underlying symbol, all open orders of the specified symbol will be automatically canceled. If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped. * The system will check all countdowns approximately every 100 milliseconds, **please note that sufficient redundancy should be considered when using this function**. We do not recommend setting the countdown time to be too precise or too small. Weight: 1 ### Example ```java diff --git a/clients/derivatives-trading-options/docs/rest-api/migration-guide.md b/clients/derivatives-trading-options/docs/rest-api/migration-guide.md index 2248794b0..ebb8c3759 100644 --- a/clients/derivatives-trading-options/docs/rest-api/migration-guide.md +++ b/clients/derivatives-trading-options/docs/rest-api/migration-guide.md @@ -22,7 +22,7 @@ With the transition to a modularized structure, the Binance Connector has been s io.github.binance binance-derivatives-trading-options - 5.0.0 + 7.0.0 ``` @@ -91,7 +91,7 @@ by: io.github.binance binance-derivatives-trading-options - 5.0.0 + 7.0.0 ``` diff --git a/clients/derivatives-trading-options/pom.xml b/clients/derivatives-trading-options/pom.xml index 2e4e917de..fb2b5a150 100644 --- a/clients/derivatives-trading-options/pom.xml +++ b/clients/derivatives-trading-options/pom.xml @@ -5,7 +5,7 @@ 4.0.0 binance-derivatives-trading-options derivatives-trading-options - 6.0.0 + 7.0.0 jar @@ -31,7 +31,7 @@ io.github.binance binance-common - 2.3.1 + 2.4.1 \ No newline at end of file diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/AccountApi.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/AccountApi.java index bbf28641b..7c92e20e7 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/AccountApi.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/AccountApi.java @@ -43,7 +43,7 @@ public class AccountApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-options/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-options/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/DerivativesTradingOptionsRestApi.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/DerivativesTradingOptionsRestApi.java index 8ad4f28d0..0f2862793 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/DerivativesTradingOptionsRestApi.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/DerivativesTradingOptionsRestApi.java @@ -720,7 +720,7 @@ public ApiResponse resetMarketMakerPro * corresponding countdownCancelAllHeartBeat endpoint is not called within 10 seconds with the * specified underlying symbol, all open orders of the specified symbol will be automatically * canceled. If this endpoint is called with an countdownTime of 0, the countdown timer will be - * stopped. * The system will check all countdowns approximately every 1000 milliseconds, + * stopped. * The system will check all countdowns approximately every 100 milliseconds, * **please note that sufficient redundancy should be considered when using this function**. We * do not recommend setting the countdown time to be too precise or too small. Weight: 1 * diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketDataApi.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketDataApi.java index 734740565..bb69a8c61 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketDataApi.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketDataApi.java @@ -52,7 +52,7 @@ public class MarketDataApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-options/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-options/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketMakerBlockTradeApi.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketMakerBlockTradeApi.java index 3773a6ffd..d8b75e879 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketMakerBlockTradeApi.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketMakerBlockTradeApi.java @@ -52,7 +52,7 @@ public class MarketMakerBlockTradeApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-options/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-options/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketMakerEndpointsApi.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketMakerEndpointsApi.java index f442c148a..43d553228 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketMakerEndpointsApi.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/MarketMakerEndpointsApi.java @@ -53,7 +53,7 @@ public class MarketMakerEndpointsApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-options/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-options/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; @@ -816,7 +816,7 @@ private okhttp3.Call setAutoCancelAllOpenOrdersValidateBeforeCall( * corresponding countdownCancelAllHeartBeat endpoint is not called within 10 seconds with the * specified underlying symbol, all open orders of the specified symbol will be automatically * canceled. If this endpoint is called with an countdownTime of 0, the countdown timer will be - * stopped. * The system will check all countdowns approximately every 1000 milliseconds, + * stopped. * The system will check all countdowns approximately every 100 milliseconds, * **please note that sufficient redundancy should be considered when using this function**. We * do not recommend setting the countdown time to be too precise or too small. Weight: 1 * diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/TradeApi.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/TradeApi.java index b2476c393..7e9e930d5 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/TradeApi.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/TradeApi.java @@ -61,7 +61,7 @@ public class TradeApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-options/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-options/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/UserDataStreamsApi.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/UserDataStreamsApi.java index d737538f4..77dde7f58 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/UserDataStreamsApi.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/api/UserDataStreamsApi.java @@ -42,7 +42,7 @@ public class UserDataStreamsApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-options/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-options/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/model/CancelAllOptionOrdersOnSpecificSymbolResponse.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/model/CancelAllOptionOrdersOnSpecificSymbolResponse.java index 62dbce6bc..78da329eb 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/model/CancelAllOptionOrdersOnSpecificSymbolResponse.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/model/CancelAllOptionOrdersOnSpecificSymbolResponse.java @@ -40,7 +40,7 @@ public class CancelAllOptionOrdersOnSpecificSymbolResponse { @SerializedName(SERIALIZED_NAME_CODE) @jakarta.annotation.Nullable - private Long code; + private String code; public static final String SERIALIZED_NAME_MSG = "msg"; @@ -51,7 +51,7 @@ public class CancelAllOptionOrdersOnSpecificSymbolResponse { public CancelAllOptionOrdersOnSpecificSymbolResponse() {} public CancelAllOptionOrdersOnSpecificSymbolResponse code( - @jakarta.annotation.Nullable Long code) { + @jakarta.annotation.Nullable String code) { this.code = code; return this; } @@ -62,11 +62,11 @@ public CancelAllOptionOrdersOnSpecificSymbolResponse code( * @return code */ @jakarta.annotation.Nullable - public Long getCode() { + public String getCode() { return code; } - public void setCode(@jakarta.annotation.Nullable Long code) { + public void setCode(@jakarta.annotation.Nullable String code) { this.code = code; } @@ -187,6 +187,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } if ((jsonObj.get("msg") != null && !jsonObj.get("msg").isJsonNull()) && !jsonObj.get("msg").isJsonPrimitive()) { throw new IllegalArgumentException( diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/DerivativesTradingOptionsWebSocketStreams.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/DerivativesTradingOptionsWebSocketStreams.java index 10e3b2348..9edfc81d2 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/DerivativesTradingOptionsWebSocketStreams.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/DerivativesTradingOptionsWebSocketStreams.java @@ -40,7 +40,7 @@ public class DerivativesTradingOptionsWebSocketStreams { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-options/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-options/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private WebSocketClientConfiguration clientConfiguration; diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/MarketApi.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/MarketApi.java index a66244250..1b394335c 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/MarketApi.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/MarketApi.java @@ -47,7 +47,7 @@ public class MarketApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-options/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-options/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private StreamConnectionInterface connection; diff --git a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/PublicApi.java b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/PublicApi.java index 28030899c..0485f5b4d 100644 --- a/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/PublicApi.java +++ b/clients/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/websocket/stream/api/PublicApi.java @@ -47,7 +47,7 @@ public class PublicApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-options/6.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-options/7.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private StreamConnectionInterface connection; diff --git a/clients/derivatives-trading-usds-futures/CHANGELOG.md b/clients/derivatives-trading-usds-futures/CHANGELOG.md index 521c633e2..684ddb734 100644 --- a/clients/derivatives-trading-usds-futures/CHANGELOG.md +++ b/clients/derivatives-trading-usds-futures/CHANGELOG.md @@ -1,5 +1,56 @@ # Changelog +## 10.0.0 - 2026-03-18 + +### Changed (5) + +#### REST API + +- Modified response for `exchangeInformation()` (`GET /fapi/v1/exchangeInfo`): + - `symbols`.items: property `orderTypes` added + - `symbols`.items: property `OrderType` deleted + - `symbols`.items: item property `orderTypes` added + - `symbols`.items: item property `OrderType` deleted + +- Modified response for `cancelOrder()` (`DELETE /fapi/v1/order`): + - property `avgPrice` added + +- Modified response for `queryOrder()` (`GET /fapi/v1/order`): + - property `executedQty` added + - property `priceProtect` added + - property `priceRate` added + - property `type` added + - property `workingType` added + - property `side` added + - property `time` added + - property `timeInForce` added + - property `clientOrderId` added + - property `stopPrice` added + - property `reduceOnly` added + - property `cumQuote` added + - property `price` added + - property `closePosition` added + - property `symbol` added + - property `positionSide` added + - property `origType` added + - property `avgPrice` added + - property `origQty` added + - property `updateTime` added + - property `activatePrice` added + - property `orderId` added + - property `result` deleted + - property `id` deleted + - `status`: type `integer` → `string` + +#### WebSocket Streams + +- Modified response for `markPriceStreamForAllMarket()` (`!markPrice@arr@` stream): + - items: property `ap` added + - items: item property `ap` added + +- Modified response for `markPriceStream()` (`@markPrice@` stream): + - property `ap` added + ## 9.0.0 - 2026-02-12 ### Changed (20) diff --git a/clients/derivatives-trading-usds-futures/docs/ExchangeInformationResponseSymbolsInner.md b/clients/derivatives-trading-usds-futures/docs/ExchangeInformationResponseSymbolsInner.md index d4a29687f..88a6811c2 100644 --- a/clients/derivatives-trading-usds-futures/docs/ExchangeInformationResponseSymbolsInner.md +++ b/clients/derivatives-trading-usds-futures/docs/ExchangeInformationResponseSymbolsInner.md @@ -27,7 +27,7 @@ |**settlePlan** | **Long** | | [optional] | |**triggerProtect** | **String** | | [optional] | |**filters** | [**List<ExchangeInformationResponseSymbolsInnerFiltersInner>**](ExchangeInformationResponseSymbolsInnerFiltersInner.md) | | [optional] | -|**orderType** | **List<String>** | | [optional] | +|**orderTypes** | **List<String>** | | [optional] | |**timeInForce** | **List<String>** | | [optional] | |**liquidationFee** | **String** | | [optional] | |**marketTakeBound** | **String** | | [optional] | diff --git a/clients/derivatives-trading-usds-futures/docs/MarkPriceStreamForAllMarketResponseInner.md b/clients/derivatives-trading-usds-futures/docs/MarkPriceStreamForAllMarketResponseInner.md index 0f5d9cd5c..05fddd03f 100644 --- a/clients/derivatives-trading-usds-futures/docs/MarkPriceStreamForAllMarketResponseInner.md +++ b/clients/derivatives-trading-usds-futures/docs/MarkPriceStreamForAllMarketResponseInner.md @@ -11,6 +11,7 @@ |**E** | **Long** | | [optional] | |**sLowerCase** | **String** | | [optional] | |**pLowerCase** | **String** | | [optional] | +|**ap** | **String** | | [optional] | |**iLowerCase** | **String** | | [optional] | |**P** | **String** | | [optional] | |**rLowerCase** | **String** | | [optional] | diff --git a/clients/derivatives-trading-usds-futures/docs/MarkPriceStreamResponse.md b/clients/derivatives-trading-usds-futures/docs/MarkPriceStreamResponse.md index 04a156486..0170c1652 100644 --- a/clients/derivatives-trading-usds-futures/docs/MarkPriceStreamResponse.md +++ b/clients/derivatives-trading-usds-futures/docs/MarkPriceStreamResponse.md @@ -11,6 +11,7 @@ |**E** | **Long** | | [optional] | |**sLowerCase** | **String** | | [optional] | |**pLowerCase** | **String** | | [optional] | +|**ap** | **String** | | [optional] | |**iLowerCase** | **String** | | [optional] | |**P** | **String** | | [optional] | |**rLowerCase** | **String** | | [optional] | diff --git a/clients/derivatives-trading-usds-futures/docs/MarketApi.md b/clients/derivatives-trading-usds-futures/docs/MarketApi.md new file mode 100644 index 000000000..ad1bdf4ab --- /dev/null +++ b/clients/derivatives-trading-usds-futures/docs/MarketApi.md @@ -0,0 +1,953 @@ +# MarketApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**aggregateTradeStreams**](MarketApi.md#aggregateTradeStreams) | **POST** /<symbol>@aggTrade | Aggregate Trade Streams | +| [**allMarketLiquidationOrderStreams**](MarketApi.md#allMarketLiquidationOrderStreams) | **POST** /!forceOrder@arr | All Market Liquidation Order Streams | +| [**allMarketMiniTickersStream**](MarketApi.md#allMarketMiniTickersStream) | **POST** /!miniTicker@arr | All Market Mini Tickers Stream | +| [**allMarketTickersStreams**](MarketApi.md#allMarketTickersStreams) | **POST** /!ticker@arr | All Market Tickers Streams | +| [**compositeIndexSymbolInformationStreams**](MarketApi.md#compositeIndexSymbolInformationStreams) | **POST** /<symbol>@compositeIndex | Composite Index Symbol Information Streams | +| [**continuousContractKlineCandlestickStreams**](MarketApi.md#continuousContractKlineCandlestickStreams) | **POST** /<pair>_<contractType>@continuousKline_<interval> | Continuous Contract Kline/Candlestick Streams | +| [**contractInfoStream**](MarketApi.md#contractInfoStream) | **POST** /!contractInfo | Contract Info Stream | +| [**individualSymbolMiniTickerStream**](MarketApi.md#individualSymbolMiniTickerStream) | **POST** /<symbol>@miniTicker | Individual Symbol Mini Ticker Stream | +| [**individualSymbolTickerStreams**](MarketApi.md#individualSymbolTickerStreams) | **POST** /<symbol>@ticker | Individual Symbol Ticker Streams | +| [**klineCandlestickStreams**](MarketApi.md#klineCandlestickStreams) | **POST** /<symbol>@kline_<interval> | Kline/Candlestick Streams | +| [**liquidationOrderStreams**](MarketApi.md#liquidationOrderStreams) | **POST** /<symbol>@forceOrder | Liquidation Order Streams | +| [**markPriceStream**](MarketApi.md#markPriceStream) | **POST** /<symbol>@markPrice@<updateSpeed> | Mark Price Stream | +| [**markPriceStreamForAllMarket**](MarketApi.md#markPriceStreamForAllMarket) | **POST** /!markPrice@arr@<updateSpeed> | Mark Price Stream for All market | +| [**multiAssetsModeAssetIndex**](MarketApi.md#multiAssetsModeAssetIndex) | **POST** /!assetIndex@arr | Multi-Assets Mode Asset Index | +| [**tradingSessionStream**](MarketApi.md#tradingSessionStream) | **POST** /tradingSession | Trading Session Stream | + + + +# **aggregateTradeStreams** +> AggregateTradeStreamsResponse aggregateTradeStreams(aggregateTradeStreamsRequest) + +Aggregate Trade Streams + +The Aggregate Trade Streams push market trade information that is aggregated for fills with same price and taking side every 100 milliseconds. Only market trades will be aggregated, which means the insurance fund trades and ADL trades won't be aggregated. Retail Price Improvement(RPI) orders are aggregated into field `q` and without special tags to be distinguished. Update Speed: 100ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + AggregateTradeStreamsRequest aggregateTradeStreamsRequest = new AggregateTradeStreamsRequest(); // AggregateTradeStreamsRequest | + try { + AggregateTradeStreamsResponse result = apiInstance.aggregateTradeStreams(aggregateTradeStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#aggregateTradeStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **aggregateTradeStreamsRequest** | [**AggregateTradeStreamsRequest**](AggregateTradeStreamsRequest.md)| | | + +### Return type + +[**AggregateTradeStreamsResponse**](AggregateTradeStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Aggregate Trade Streams | - | + + +# **allMarketLiquidationOrderStreams** +> AllMarketLiquidationOrderStreamsResponse allMarketLiquidationOrderStreams(allMarketLiquidationOrderStreamsRequest) + +All Market Liquidation Order Streams + +The All Liquidation Order Snapshot Streams push force liquidation order information for all symbols in the market. For each symbol,only the latest one liquidation order within 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, no stream will be pushed. Update Speed: 1000ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + AllMarketLiquidationOrderStreamsRequest allMarketLiquidationOrderStreamsRequest = new AllMarketLiquidationOrderStreamsRequest(); // AllMarketLiquidationOrderStreamsRequest | + try { + AllMarketLiquidationOrderStreamsResponse result = apiInstance.allMarketLiquidationOrderStreams(allMarketLiquidationOrderStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#allMarketLiquidationOrderStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **allMarketLiquidationOrderStreamsRequest** | [**AllMarketLiquidationOrderStreamsRequest**](AllMarketLiquidationOrderStreamsRequest.md)| | | + +### Return type + +[**AllMarketLiquidationOrderStreamsResponse**](AllMarketLiquidationOrderStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | All Market Liquidation Order Streams | - | + + +# **allMarketMiniTickersStream** +> AllMarketMiniTickersStreamResponse allMarketMiniTickersStream(allMarketMiniTickersStreamRequest) + +All Market Mini Tickers Stream + +24hr rolling window mini-ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers that have changed will be present in the array. Update Speed: 1000ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + AllMarketMiniTickersStreamRequest allMarketMiniTickersStreamRequest = new AllMarketMiniTickersStreamRequest(); // AllMarketMiniTickersStreamRequest | + try { + AllMarketMiniTickersStreamResponse result = apiInstance.allMarketMiniTickersStream(allMarketMiniTickersStreamRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#allMarketMiniTickersStream"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **allMarketMiniTickersStreamRequest** | [**AllMarketMiniTickersStreamRequest**](AllMarketMiniTickersStreamRequest.md)| | | + +### Return type + +[**AllMarketMiniTickersStreamResponse**](AllMarketMiniTickersStreamResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | All Market Mini Tickers Stream | - | + + +# **allMarketTickersStreams** +> AllMarketTickersStreamsResponse allMarketTickersStreams(allMarketTickersStreamsRequest) + +All Market Tickers Streams + +24hr rolling window ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers that have changed will be present in the array. Update Speed: 1000ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + AllMarketTickersStreamsRequest allMarketTickersStreamsRequest = new AllMarketTickersStreamsRequest(); // AllMarketTickersStreamsRequest | + try { + AllMarketTickersStreamsResponse result = apiInstance.allMarketTickersStreams(allMarketTickersStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#allMarketTickersStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **allMarketTickersStreamsRequest** | [**AllMarketTickersStreamsRequest**](AllMarketTickersStreamsRequest.md)| | | + +### Return type + +[**AllMarketTickersStreamsResponse**](AllMarketTickersStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | All Market Tickers Streams | - | + + +# **compositeIndexSymbolInformationStreams** +> CompositeIndexSymbolInformationStreamsResponse compositeIndexSymbolInformationStreams(compositeIndexSymbolInformationStreamsRequest) + +Composite Index Symbol Information Streams + +Composite index information for index symbols pushed every second. Update Speed: 1000ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + CompositeIndexSymbolInformationStreamsRequest compositeIndexSymbolInformationStreamsRequest = new CompositeIndexSymbolInformationStreamsRequest(); // CompositeIndexSymbolInformationStreamsRequest | + try { + CompositeIndexSymbolInformationStreamsResponse result = apiInstance.compositeIndexSymbolInformationStreams(compositeIndexSymbolInformationStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#compositeIndexSymbolInformationStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **compositeIndexSymbolInformationStreamsRequest** | [**CompositeIndexSymbolInformationStreamsRequest**](CompositeIndexSymbolInformationStreamsRequest.md)| | | + +### Return type + +[**CompositeIndexSymbolInformationStreamsResponse**](CompositeIndexSymbolInformationStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Composite Index Symbol Information Streams | - | + + +# **continuousContractKlineCandlestickStreams** +> ContinuousContractKlineCandlestickStreamsResponse continuousContractKlineCandlestickStreams(continuousContractKlineCandlestickStreamsRequest) + +Continuous Contract Kline/Candlestick Streams + + Update Speed: 250ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + ContinuousContractKlineCandlestickStreamsRequest continuousContractKlineCandlestickStreamsRequest = new ContinuousContractKlineCandlestickStreamsRequest(); // ContinuousContractKlineCandlestickStreamsRequest | + try { + ContinuousContractKlineCandlestickStreamsResponse result = apiInstance.continuousContractKlineCandlestickStreams(continuousContractKlineCandlestickStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#continuousContractKlineCandlestickStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **continuousContractKlineCandlestickStreamsRequest** | [**ContinuousContractKlineCandlestickStreamsRequest**](ContinuousContractKlineCandlestickStreamsRequest.md)| | | + +### Return type + +[**ContinuousContractKlineCandlestickStreamsResponse**](ContinuousContractKlineCandlestickStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Continuous Contract Kline/Candlestick Streams | - | + + +# **contractInfoStream** +> ContractInfoStreamResponse contractInfoStream(contractInfoStreamRequest) + +Contract Info Stream + +ContractInfo stream pushes when contract info updates(listing/settlement/contract bracket update). `bks` field only shows up when bracket gets updated. Update Speed: Real-time + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + ContractInfoStreamRequest contractInfoStreamRequest = new ContractInfoStreamRequest(); // ContractInfoStreamRequest | + try { + ContractInfoStreamResponse result = apiInstance.contractInfoStream(contractInfoStreamRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#contractInfoStream"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **contractInfoStreamRequest** | [**ContractInfoStreamRequest**](ContractInfoStreamRequest.md)| | | + +### Return type + +[**ContractInfoStreamResponse**](ContractInfoStreamResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Contract Info Stream | - | + + +# **individualSymbolMiniTickerStream** +> IndividualSymbolMiniTickerStreamResponse individualSymbolMiniTickerStream(individualSymbolMiniTickerStreamRequest) + +Individual Symbol Mini Ticker Stream + +24hr rolling window mini-ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Update Speed: 2s + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + IndividualSymbolMiniTickerStreamRequest individualSymbolMiniTickerStreamRequest = new IndividualSymbolMiniTickerStreamRequest(); // IndividualSymbolMiniTickerStreamRequest | + try { + IndividualSymbolMiniTickerStreamResponse result = apiInstance.individualSymbolMiniTickerStream(individualSymbolMiniTickerStreamRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#individualSymbolMiniTickerStream"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **individualSymbolMiniTickerStreamRequest** | [**IndividualSymbolMiniTickerStreamRequest**](IndividualSymbolMiniTickerStreamRequest.md)| | | + +### Return type + +[**IndividualSymbolMiniTickerStreamResponse**](IndividualSymbolMiniTickerStreamResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Individual Symbol Mini Ticker Stream | - | + + +# **individualSymbolTickerStreams** +> IndividualSymbolTickerStreamsResponse individualSymbolTickerStreams(individualSymbolTickerStreamsRequest) + +Individual Symbol Ticker Streams + +24hr rolling window ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Update Speed: 2000ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + IndividualSymbolTickerStreamsRequest individualSymbolTickerStreamsRequest = new IndividualSymbolTickerStreamsRequest(); // IndividualSymbolTickerStreamsRequest | + try { + IndividualSymbolTickerStreamsResponse result = apiInstance.individualSymbolTickerStreams(individualSymbolTickerStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#individualSymbolTickerStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **individualSymbolTickerStreamsRequest** | [**IndividualSymbolTickerStreamsRequest**](IndividualSymbolTickerStreamsRequest.md)| | | + +### Return type + +[**IndividualSymbolTickerStreamsResponse**](IndividualSymbolTickerStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Individual Symbol Ticker Streams | - | + + +# **klineCandlestickStreams** +> KlineCandlestickStreamsResponse klineCandlestickStreams(klineCandlestickStreamsRequest) + +Kline/Candlestick Streams + +The Kline/Candlestick Stream push updates to the current klines/candlestick every 250 milliseconds (if existing). Update Speed: 250ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + KlineCandlestickStreamsRequest klineCandlestickStreamsRequest = new KlineCandlestickStreamsRequest(); // KlineCandlestickStreamsRequest | + try { + KlineCandlestickStreamsResponse result = apiInstance.klineCandlestickStreams(klineCandlestickStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#klineCandlestickStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **klineCandlestickStreamsRequest** | [**KlineCandlestickStreamsRequest**](KlineCandlestickStreamsRequest.md)| | | + +### Return type + +[**KlineCandlestickStreamsResponse**](KlineCandlestickStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Kline/Candlestick Streams | - | + + +# **liquidationOrderStreams** +> LiquidationOrderStreamsResponse liquidationOrderStreams(liquidationOrderStreamsRequest) + +Liquidation Order Streams + +The Liquidation Order Snapshot Streams push force liquidation order information for specific symbol. For each symbol,only the latest one liquidation order within 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, no stream will be pushed. Update Speed: 1000ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + LiquidationOrderStreamsRequest liquidationOrderStreamsRequest = new LiquidationOrderStreamsRequest(); // LiquidationOrderStreamsRequest | + try { + LiquidationOrderStreamsResponse result = apiInstance.liquidationOrderStreams(liquidationOrderStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#liquidationOrderStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **liquidationOrderStreamsRequest** | [**LiquidationOrderStreamsRequest**](LiquidationOrderStreamsRequest.md)| | | + +### Return type + +[**LiquidationOrderStreamsResponse**](LiquidationOrderStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Liquidation Order Streams | - | + + +# **markPriceStream** +> MarkPriceStreamResponse markPriceStream(markPriceStreamRequest) + +Mark Price Stream + +Mark price and funding rate for a single symbol pushed every 3 seconds or every second. Update Speed: 3000ms or 1000ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + MarkPriceStreamRequest markPriceStreamRequest = new MarkPriceStreamRequest(); // MarkPriceStreamRequest | + try { + MarkPriceStreamResponse result = apiInstance.markPriceStream(markPriceStreamRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#markPriceStream"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **markPriceStreamRequest** | [**MarkPriceStreamRequest**](MarkPriceStreamRequest.md)| | | + +### Return type + +[**MarkPriceStreamResponse**](MarkPriceStreamResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Mark Price Stream | - | + + +# **markPriceStreamForAllMarket** +> MarkPriceStreamForAllMarketResponse markPriceStreamForAllMarket(markPriceStreamForAllMarketRequest) + +Mark Price Stream for All market + +Mark price and funding rate for all symbols pushed every 3 seconds or every second. **Note**: TradFi symbols will be pushed through a seperate message. Update Speed: 3000ms or 1000ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + MarkPriceStreamForAllMarketRequest markPriceStreamForAllMarketRequest = new MarkPriceStreamForAllMarketRequest(); // MarkPriceStreamForAllMarketRequest | + try { + MarkPriceStreamForAllMarketResponse result = apiInstance.markPriceStreamForAllMarket(markPriceStreamForAllMarketRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#markPriceStreamForAllMarket"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **markPriceStreamForAllMarketRequest** | [**MarkPriceStreamForAllMarketRequest**](MarkPriceStreamForAllMarketRequest.md)| | | + +### Return type + +[**MarkPriceStreamForAllMarketResponse**](MarkPriceStreamForAllMarketResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Mark Price Stream for All market | - | + + +# **multiAssetsModeAssetIndex** +> MultiAssetsModeAssetIndexResponse multiAssetsModeAssetIndex(multiAssetsModeAssetIndexRequest) + +Multi-Assets Mode Asset Index + +Asset index for multi-assets mode user Update Speed: 1s + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + MultiAssetsModeAssetIndexRequest multiAssetsModeAssetIndexRequest = new MultiAssetsModeAssetIndexRequest(); // MultiAssetsModeAssetIndexRequest | + try { + MultiAssetsModeAssetIndexResponse result = apiInstance.multiAssetsModeAssetIndex(multiAssetsModeAssetIndexRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#multiAssetsModeAssetIndex"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **multiAssetsModeAssetIndexRequest** | [**MultiAssetsModeAssetIndexRequest**](MultiAssetsModeAssetIndexRequest.md)| | | + +### Return type + +[**MultiAssetsModeAssetIndexResponse**](MultiAssetsModeAssetIndexResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Multi-Assets Mode Asset Index | - | + + +# **tradingSessionStream** +> TradingSessionStreamResponse tradingSessionStream(tradingSessionStreamRequest) + +Trading Session Stream + +Trading session information for the underlying assets of TradFi Perpetual contracts—covering the U.S. equity market and the commodity market—is updated every second. Trading session information for different underlying markets is pushed in separate messages. Session types for the equity market include \"PRE_MARKET\", \"REGULAR\", \"AFTER_MARKET\", \"OVERNIGHT\", and \"NO_TRADING\". Session types for the commodity market include \"REGULAR\" and \"NO_TRADING\". Update Speed: 1s + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + TradingSessionStreamRequest tradingSessionStreamRequest = new TradingSessionStreamRequest(); // TradingSessionStreamRequest | + try { + TradingSessionStreamResponse result = apiInstance.tradingSessionStream(tradingSessionStreamRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#tradingSessionStream"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tradingSessionStreamRequest** | [**TradingSessionStreamRequest**](TradingSessionStreamRequest.md)| | | + +### Return type + +[**TradingSessionStreamResponse**](TradingSessionStreamResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Trading Session Stream | - | + diff --git a/clients/derivatives-trading-usds-futures/docs/PublicApi.md b/clients/derivatives-trading-usds-futures/docs/PublicApi.md new file mode 100644 index 000000000..cb1b5c6a6 --- /dev/null +++ b/clients/derivatives-trading-usds-futures/docs/PublicApi.md @@ -0,0 +1,323 @@ +# PublicApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**allBookTickersStream**](PublicApi.md#allBookTickersStream) | **POST** /!bookTicker | All Book Tickers Stream | +| [**diffBookDepthStreams**](PublicApi.md#diffBookDepthStreams) | **POST** /<symbol>@depth@<updateSpeed> | Diff. Book Depth Streams | +| [**individualSymbolBookTickerStreams**](PublicApi.md#individualSymbolBookTickerStreams) | **POST** /<symbol>@bookTicker | Individual Symbol Book Ticker Streams | +| [**partialBookDepthStreams**](PublicApi.md#partialBookDepthStreams) | **POST** /<symbol>@depth<levels>@<updateSpeed> | Partial Book Depth Streams | +| [**rpiDiffBookDepthStreams**](PublicApi.md#rpiDiffBookDepthStreams) | **POST** /<symbol>@rpiDepth@500ms | RPI Diff. Book Depth Streams | + + + +# **allBookTickersStream** +> AllBookTickersStreamResponse allBookTickersStream(allBookTickersStreamRequest) + +All Book Tickers Stream + +Pushes any update to the best bid or ask's price or quantity in real-time for all symbols. Retail Price Improvement(RPI) orders are not visible and excluded in the response message. Update Speed: 5s + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.PublicApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + PublicApi apiInstance = new PublicApi(defaultClient); + AllBookTickersStreamRequest allBookTickersStreamRequest = new AllBookTickersStreamRequest(); // AllBookTickersStreamRequest | + try { + AllBookTickersStreamResponse result = apiInstance.allBookTickersStream(allBookTickersStreamRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PublicApi#allBookTickersStream"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **allBookTickersStreamRequest** | [**AllBookTickersStreamRequest**](AllBookTickersStreamRequest.md)| | | + +### Return type + +[**AllBookTickersStreamResponse**](AllBookTickersStreamResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | All Book Tickers Stream | - | + + +# **diffBookDepthStreams** +> DiffBookDepthStreamsResponse diffBookDepthStreams(diffBookDepthStreamsRequest) + +Diff. Book Depth Streams + +Bids and asks, pushed every 250 milliseconds, 500 milliseconds, 100 milliseconds (if existing) Retail Price Improvement(RPI) orders are not visible and excluded in the response message. Update Speed: 250ms, 500ms, 100ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.PublicApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + PublicApi apiInstance = new PublicApi(defaultClient); + DiffBookDepthStreamsRequest diffBookDepthStreamsRequest = new DiffBookDepthStreamsRequest(); // DiffBookDepthStreamsRequest | + try { + DiffBookDepthStreamsResponse result = apiInstance.diffBookDepthStreams(diffBookDepthStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PublicApi#diffBookDepthStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **diffBookDepthStreamsRequest** | [**DiffBookDepthStreamsRequest**](DiffBookDepthStreamsRequest.md)| | | + +### Return type + +[**DiffBookDepthStreamsResponse**](DiffBookDepthStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Diff. Book Depth Streams | - | + + +# **individualSymbolBookTickerStreams** +> IndividualSymbolBookTickerStreamsResponse individualSymbolBookTickerStreams(individualSymbolBookTickerStreamsRequest) + +Individual Symbol Book Ticker Streams + +Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol. Retail Price Improvement(RPI) orders are not visible and excluded in the response message. Update Speed: Real-time + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.PublicApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + PublicApi apiInstance = new PublicApi(defaultClient); + IndividualSymbolBookTickerStreamsRequest individualSymbolBookTickerStreamsRequest = new IndividualSymbolBookTickerStreamsRequest(); // IndividualSymbolBookTickerStreamsRequest | + try { + IndividualSymbolBookTickerStreamsResponse result = apiInstance.individualSymbolBookTickerStreams(individualSymbolBookTickerStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PublicApi#individualSymbolBookTickerStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **individualSymbolBookTickerStreamsRequest** | [**IndividualSymbolBookTickerStreamsRequest**](IndividualSymbolBookTickerStreamsRequest.md)| | | + +### Return type + +[**IndividualSymbolBookTickerStreamsResponse**](IndividualSymbolBookTickerStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Individual Symbol Book Ticker Streams | - | + + +# **partialBookDepthStreams** +> PartialBookDepthStreamsResponse partialBookDepthStreams(partialBookDepthStreamsRequest) + +Partial Book Depth Streams + +Top **<levels\\>** bids and asks, Valid **<levels\\>** are 5, 10, or 20. Retail Price Improvement(RPI) orders are not visible and excluded in the response message. Update Speed: 250ms, 500ms or 100ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.PublicApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + PublicApi apiInstance = new PublicApi(defaultClient); + PartialBookDepthStreamsRequest partialBookDepthStreamsRequest = new PartialBookDepthStreamsRequest(); // PartialBookDepthStreamsRequest | + try { + PartialBookDepthStreamsResponse result = apiInstance.partialBookDepthStreams(partialBookDepthStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PublicApi#partialBookDepthStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **partialBookDepthStreamsRequest** | [**PartialBookDepthStreamsRequest**](PartialBookDepthStreamsRequest.md)| | | + +### Return type + +[**PartialBookDepthStreamsResponse**](PartialBookDepthStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Partial Book Depth Streams | - | + + +# **rpiDiffBookDepthStreams** +> RpiDiffBookDepthStreamsResponse rpiDiffBookDepthStreams(rpiDiffBookDepthStreamsRequest) + +RPI Diff. Book Depth Streams + +Bids and asks including RPI orders, pushed every 500 milliseconds RPI(Retail Price Improvement) orders are included and aggreated in the response message. When the quantity of a price level to be updated is equal to 0, it means either all quotations for this price have been filled/canceled, or the quantity of crossed RPI orders for this price are hidden Update Speed: 500ms + +### Example +```java +// Import classes: +import com.binance.connector.client.derivatives_trading_usds_futures.ApiClient; +import com.binance.connector.client.derivatives_trading_usds_futures.ApiException; +import com.binance.connector.client.derivatives_trading_usds_futures.Configuration; +import com.binance.connector.client.derivatives_trading_usds_futures.models.*; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.PublicApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + PublicApi apiInstance = new PublicApi(defaultClient); + RpiDiffBookDepthStreamsRequest rpiDiffBookDepthStreamsRequest = new RpiDiffBookDepthStreamsRequest(); // RpiDiffBookDepthStreamsRequest | + try { + RpiDiffBookDepthStreamsResponse result = apiInstance.rpiDiffBookDepthStreams(rpiDiffBookDepthStreamsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PublicApi#rpiDiffBookDepthStreams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **rpiDiffBookDepthStreamsRequest** | [**RpiDiffBookDepthStreamsRequest**](RpiDiffBookDepthStreamsRequest.md)| | | + +### Return type + +[**RpiDiffBookDepthStreamsResponse**](RpiDiffBookDepthStreamsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | RPI Diff. Book Depth Streams | - | + diff --git a/clients/derivatives-trading-usds-futures/docs/rest-api/migration-guide.md b/clients/derivatives-trading-usds-futures/docs/rest-api/migration-guide.md index 96a626b8b..a3f7d7f49 100644 --- a/clients/derivatives-trading-usds-futures/docs/rest-api/migration-guide.md +++ b/clients/derivatives-trading-usds-futures/docs/rest-api/migration-guide.md @@ -22,7 +22,7 @@ With the transition to a modularized structure, the Binance Connector has been s io.github.binance binance-derivatives-trading-usds-futures - 9.0.0 + 10.0.0 ``` @@ -91,7 +91,7 @@ by: io.github.binance binance-derivatives-trading-usds-futures - 9.0.0 + 10.0.0 ``` diff --git a/clients/derivatives-trading-usds-futures/example_websocket_stream.md b/clients/derivatives-trading-usds-futures/example_websocket_stream.md index 7c76d8051..ce759a4a9 100644 --- a/clients/derivatives-trading-usds-futures/example_websocket_stream.md +++ b/clients/derivatives-trading-usds-futures/example_websocket_stream.md @@ -1,42 +1,44 @@ -## WebsocketMarketStreams +## Market -[@aggTrade](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Aggregate-Trade-Streams) - aggregateTradeStreams - [AggregateTradeStreamsExample.java:47](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/AggregateTradeStreamsExample.java#L47) +[@aggTrade](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Aggregate-Trade-Streams) - aggregateTradeStreams - [AggregateTradeStreamsExample.java:47](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AggregateTradeStreamsExample.java#L47) -[!bookTicker](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Book-Tickers-Stream) - allBookTickersStream - [AllBookTickersStreamExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/AllBookTickersStreamExample.java#L45) +[!forceOrder@arr](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Market-Liquidation-Order-Streams) - allMarketLiquidationOrderStreams - [AllMarketLiquidationOrderStreamsExample.java:46](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketLiquidationOrderStreamsExample.java#L46) -[!forceOrder@arr](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Market-Liquidation-Order-Streams) - allMarketLiquidationOrderStreams - [AllMarketLiquidationOrderStreamsExample.java:46](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/AllMarketLiquidationOrderStreamsExample.java#L46) +[!miniTicker@arr](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Market-Mini-Tickers-Stream) - allMarketMiniTickersStream - [AllMarketMiniTickersStreamExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketMiniTickersStreamExample.java#L45) -[!miniTicker@arr](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Market-Mini-Tickers-Stream) - allMarketMiniTickersStream - [AllMarketMiniTickersStreamExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/AllMarketMiniTickersStreamExample.java#L45) +[!ticker@arr](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Market-Tickers-Streams) - allMarketTickersStreams - [AllMarketTickersStreamsExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketTickersStreamsExample.java#L45) -[!ticker@arr](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Market-Tickers-Streams) - allMarketTickersStreams - [AllMarketTickersStreamsExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/AllMarketTickersStreamsExample.java#L45) +[@compositeIndex](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Composite-Index-Symbol-Information-Streams) - compositeIndexSymbolInformationStreams - [CompositeIndexSymbolInformationStreamsExample.java:43](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/CompositeIndexSymbolInformationStreamsExample.java#L43) -[@compositeIndex](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Composite-Index-Symbol-Information-Streams) - compositeIndexSymbolInformationStreams - [CompositeIndexSymbolInformationStreamsExample.java:43](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/CompositeIndexSymbolInformationStreamsExample.java#L43) +[_@continuousKline_](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Continuous-Contract-Kline-Candlestick-Streams) - continuousContractKlineCandlestickStreams - [ContinuousContractKlineCandlestickStreamsExample.java:43](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/ContinuousContractKlineCandlestickStreamsExample.java#L43) -[_@continuousKline_](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Continuous-Contract-Kline-Candlestick-Streams) - continuousContractKlineCandlestickStreams - [ContinuousContractKlineCandlestickStreamsExample.java:43](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/ContinuousContractKlineCandlestickStreamsExample.java#L43) +[!contractInfo](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Contract-Info-Stream) - contractInfoStream - [ContractInfoStreamExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/ContractInfoStreamExample.java#L45) -[!contractInfo](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Contract-Info-Stream) - contractInfoStream - [ContractInfoStreamExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/ContractInfoStreamExample.java#L45) +[@miniTicker](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Individual-Symbol-Mini-Ticker-Stream) - individualSymbolMiniTickerStream - [IndividualSymbolMiniTickerStreamExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/IndividualSymbolMiniTickerStreamExample.java#L45) -[@depth@](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Diff-Book-Depth-Streams) - diffBookDepthStreams - [DiffBookDepthStreamsExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/DiffBookDepthStreamsExample.java#L45) +[@ticker](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Individual-Symbol-Ticker-Streams) - individualSymbolTickerStreams - [IndividualSymbolTickerStreamsExample.java:44](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/IndividualSymbolTickerStreamsExample.java#L44) -[@bookTicker](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Individual-Symbol-Book-Ticker-Streams) - individualSymbolBookTickerStreams - [IndividualSymbolBookTickerStreamsExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/IndividualSymbolBookTickerStreamsExample.java#L45) +[@kline_](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Kline-Candlestick-Streams) - klineCandlestickStreams - [KlineCandlestickStreamsExample.java:44](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/KlineCandlestickStreamsExample.java#L44) -[@miniTicker](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Individual-Symbol-Mini-Ticker-Stream) - individualSymbolMiniTickerStream - [IndividualSymbolMiniTickerStreamExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/IndividualSymbolMiniTickerStreamExample.java#L45) +[@forceOrder](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Liquidation-Order-Streams) - liquidationOrderStreams - [LiquidationOrderStreamsExample.java:46](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/LiquidationOrderStreamsExample.java#L46) -[@ticker](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Individual-Symbol-Ticker-Streams) - individualSymbolTickerStreams - [IndividualSymbolTickerStreamsExample.java:44](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/IndividualSymbolTickerStreamsExample.java#L44) +[@markPrice@](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Mark-Price-Stream) - markPriceStream - [MarkPriceStreamExample.java:44](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamExample.java#L44) -[@kline_](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Kline-Candlestick-Streams) - klineCandlestickStreams - [KlineCandlestickStreamsExample.java:44](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/KlineCandlestickStreamsExample.java#L44) +[!markPrice@arr@](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Mark-Price-Stream-for-All-market) - markPriceStreamForAllMarket - [MarkPriceStreamForAllMarketExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamForAllMarketExample.java#L45) -[@forceOrder](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Liquidation-Order-Streams) - liquidationOrderStreams - [LiquidationOrderStreamsExample.java:46](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/LiquidationOrderStreamsExample.java#L46) +[!assetIndex@arr](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Multi-Assets-Mode-Asset-Index) - multiAssetsModeAssetIndex - [MultiAssetsModeAssetIndexExample.java:43](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MultiAssetsModeAssetIndexExample.java#L43) -[@markPrice@](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Mark-Price-Stream) - markPriceStream - [MarkPriceStreamExample.java:44](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/MarkPriceStreamExample.java#L44) +[tradingSession](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Trading-Session-Stream) - tradingSessionStream - [TradingSessionStreamExample.java:49](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/TradingSessionStreamExample.java#L49) -[!markPrice@arr@](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Mark-Price-Stream-for-All-market) - markPriceStreamForAllMarket - [MarkPriceStreamForAllMarketExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/MarkPriceStreamForAllMarketExample.java#L45) +## Public -[!assetIndex@arr](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Multi-Assets-Mode-Asset-Index) - multiAssetsModeAssetIndex - [MultiAssetsModeAssetIndexExample.java:43](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/MultiAssetsModeAssetIndexExample.java#L43) +[!bookTicker](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Book-Tickers-Stream) - allBookTickersStream - [AllBookTickersStreamExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/AllBookTickersStreamExample.java#L45) -[@depth@](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Partial-Book-Depth-Streams) - partialBookDepthStreams - [PartialBookDepthStreamsExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/PartialBookDepthStreamsExample.java#L45) +[@depth@](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Diff-Book-Depth-Streams) - diffBookDepthStreams - [DiffBookDepthStreamsExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/DiffBookDepthStreamsExample.java#L45) -[@rpiDepth@500ms](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Diff-Book-Depth-Streams-RPI) - rpiDiffBookDepthStreams - [RpiDiffBookDepthStreamsExample.java:47](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/RpiDiffBookDepthStreamsExample.java#L47) +[@bookTicker](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Individual-Symbol-Book-Ticker-Streams) - individualSymbolBookTickerStreams - [IndividualSymbolBookTickerStreamsExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/IndividualSymbolBookTickerStreamsExample.java#L45) -[tradingSession](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Trading-Session-Stream) - tradingSessionStream - [TradingSessionStreamExample.java:49](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/websocketmarketstreams/TradingSessionStreamExample.java#L49) +[@depth@](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Partial-Book-Depth-Streams) - partialBookDepthStreams - [PartialBookDepthStreamsExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/PartialBookDepthStreamsExample.java#L45) + +[@rpiDepth@500ms](https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Diff-Book-Depth-Streams-RPI) - rpiDiffBookDepthStreams - [RpiDiffBookDepthStreamsExample.java:47](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/RpiDiffBookDepthStreamsExample.java#L47) diff --git a/clients/derivatives-trading-usds-futures/pom.xml b/clients/derivatives-trading-usds-futures/pom.xml index 17d835c56..87d8d08d6 100644 --- a/clients/derivatives-trading-usds-futures/pom.xml +++ b/clients/derivatives-trading-usds-futures/pom.xml @@ -5,7 +5,7 @@ 4.0.0 binance-derivatives-trading-usds-futures derivatives-trading-usds-futures - 9.0.0 + 10.0.0 jar @@ -31,7 +31,7 @@ io.github.binance binance-common - 2.3.1 + 2.4.1 \ No newline at end of file diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/JSON.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/JSON.java index 7e91da3ab..3cf467ca2 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/JSON.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/JSON.java @@ -627,9 +627,6 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.derivatives_trading_usds_futures.rest.model .QueryOrderResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.binance.connector.client.derivatives_trading_usds_futures.rest.model - .QueryOrderResponseResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.derivatives_trading_usds_futures.rest.model .QueryUserRateLimitResponse.CustomTypeAdapterFactory()); diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/AccountApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/AccountApi.java index 967c5dddc..be818150f 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/AccountApi.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/AccountApi.java @@ -64,7 +64,7 @@ public class AccountApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/9.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/ConvertApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/ConvertApi.java index 1132f782b..a82611cf9 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/ConvertApi.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/ConvertApi.java @@ -49,7 +49,7 @@ public class ConvertApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/9.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/MarketDataApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/MarketDataApi.java index 043bfea0c..5a2740290 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/MarketDataApi.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/MarketDataApi.java @@ -77,7 +77,7 @@ public class MarketDataApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/9.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/PortfolioMarginEndpointsApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/PortfolioMarginEndpointsApi.java index 4216f89fd..f7e232319 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/PortfolioMarginEndpointsApi.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/PortfolioMarginEndpointsApi.java @@ -42,7 +42,7 @@ public class PortfolioMarginEndpointsApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/9.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/TradeApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/TradeApi.java index 3790e7854..8f4aa5654 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/TradeApi.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/TradeApi.java @@ -92,7 +92,7 @@ public class TradeApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/9.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/UserDataStreamsApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/UserDataStreamsApi.java index efd794060..a1ae77c15 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/UserDataStreamsApi.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/UserDataStreamsApi.java @@ -43,7 +43,7 @@ public class UserDataStreamsApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/9.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/CancelOrderResponse.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/CancelOrderResponse.java index ad4aa79d0..37837cc6f 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/CancelOrderResponse.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/CancelOrderResponse.java @@ -84,6 +84,12 @@ public class CancelOrderResponse { @jakarta.annotation.Nullable private String price; + public static final String SERIALIZED_NAME_AVG_PRICE = "avgPrice"; + + @SerializedName(SERIALIZED_NAME_AVG_PRICE) + @jakarta.annotation.Nullable + private String avgPrice; + public static final String SERIALIZED_NAME_REDUCE_ONLY = "reduceOnly"; @SerializedName(SERIALIZED_NAME_REDUCE_ONLY) @@ -341,6 +347,25 @@ public void setPrice(@jakarta.annotation.Nullable String price) { this.price = price; } + public CancelOrderResponse avgPrice(@jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + return this; + } + + /** + * Get avgPrice + * + * @return avgPrice + */ + @jakarta.annotation.Nullable + public String getAvgPrice() { + return avgPrice; + } + + public void setAvgPrice(@jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + } + public CancelOrderResponse reduceOnly(@jakarta.annotation.Nullable Boolean reduceOnly) { this.reduceOnly = reduceOnly; return this; @@ -683,6 +708,7 @@ public boolean equals(Object o) { && Objects.equals(this.origQty, cancelOrderResponse.origQty) && Objects.equals(this.origType, cancelOrderResponse.origType) && Objects.equals(this.price, cancelOrderResponse.price) + && Objects.equals(this.avgPrice, cancelOrderResponse.avgPrice) && Objects.equals(this.reduceOnly, cancelOrderResponse.reduceOnly) && Objects.equals(this.side, cancelOrderResponse.side) && Objects.equals(this.positionSide, cancelOrderResponse.positionSide) @@ -714,6 +740,7 @@ public int hashCode() { origQty, origType, price, + avgPrice, reduceOnly, side, positionSide, @@ -745,6 +772,7 @@ public String toString() { sb.append(" origQty: ").append(toIndentedString(origQty)).append("\n"); sb.append(" origType: ").append(toIndentedString(origType)).append("\n"); sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" avgPrice: ").append(toIndentedString(avgPrice)).append("\n"); sb.append(" reduceOnly: ").append(toIndentedString(reduceOnly)).append("\n"); sb.append(" side: ").append(toIndentedString(side)).append("\n"); sb.append(" positionSide: ").append(toIndentedString(positionSide)).append("\n"); @@ -803,6 +831,10 @@ public String toUrlQueryString() { String priceValueAsString = ""; priceValueAsString = priceValue.toString(); sb.append("price=").append(urlEncode(priceValueAsString)).append(""); + Object avgPriceValue = getAvgPrice(); + String avgPriceValueAsString = ""; + avgPriceValueAsString = avgPriceValue.toString(); + sb.append("avgPrice=").append(urlEncode(avgPriceValueAsString)).append(""); Object reduceOnlyValue = getReduceOnly(); String reduceOnlyValueAsString = ""; reduceOnlyValueAsString = reduceOnlyValue.toString(); @@ -909,6 +941,7 @@ private String toIndentedString(Object o) { openapiFields.add("origQty"); openapiFields.add("origType"); openapiFields.add("price"); + openapiFields.add("avgPrice"); openapiFields.add("reduceOnly"); openapiFields.add("side"); openapiFields.add("positionSide"); @@ -1005,6 +1038,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti + " but got `%s`", jsonObj.get("price").toString())); } + if ((jsonObj.get("avgPrice") != null && !jsonObj.get("avgPrice").isJsonNull()) + && !jsonObj.get("avgPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `avgPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("avgPrice").toString())); + } if ((jsonObj.get("side") != null && !jsonObj.get("side").isJsonNull()) && !jsonObj.get("side").isJsonPrimitive()) { throw new IllegalArgumentException( diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/ExchangeInformationResponseSymbolsInner.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/ExchangeInformationResponseSymbolsInner.java index 999a6bedd..6826df205 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/ExchangeInformationResponseSymbolsInner.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/ExchangeInformationResponseSymbolsInner.java @@ -162,11 +162,11 @@ public class ExchangeInformationResponseSymbolsInner { @jakarta.annotation.Nullable private List<@Valid ExchangeInformationResponseSymbolsInnerFiltersInner> filters; - public static final String SERIALIZED_NAME_ORDER_TYPE = "OrderType"; + public static final String SERIALIZED_NAME_ORDER_TYPES = "orderTypes"; - @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + @SerializedName(SERIALIZED_NAME_ORDER_TYPES) @jakarta.annotation.Nullable - private List orderType; + private List orderTypes; public static final String SERIALIZED_NAME_TIME_IN_FORCE = "timeInForce"; @@ -610,32 +610,32 @@ public void setFilters( this.filters = filters; } - public ExchangeInformationResponseSymbolsInner orderType( - @jakarta.annotation.Nullable List orderType) { - this.orderType = orderType; + public ExchangeInformationResponseSymbolsInner orderTypes( + @jakarta.annotation.Nullable List orderTypes) { + this.orderTypes = orderTypes; return this; } - public ExchangeInformationResponseSymbolsInner addOrderTypeItem(String orderTypeItem) { - if (this.orderType == null) { - this.orderType = new ArrayList<>(); + public ExchangeInformationResponseSymbolsInner addOrderTypesItem(String orderTypesItem) { + if (this.orderTypes == null) { + this.orderTypes = new ArrayList<>(); } - this.orderType.add(orderTypeItem); + this.orderTypes.add(orderTypesItem); return this; } /** - * Get orderType + * Get orderTypes * - * @return orderType + * @return orderTypes */ @jakarta.annotation.Nullable - public List getOrderType() { - return orderType; + public List getOrderTypes() { + return orderTypes; } - public void setOrderType(@jakarta.annotation.Nullable List orderType) { - this.orderType = orderType; + public void setOrderTypes(@jakarta.annotation.Nullable List orderTypes) { + this.orderTypes = orderTypes; } public ExchangeInformationResponseSymbolsInner timeInForce( @@ -756,7 +756,8 @@ public boolean equals(Object o) { && Objects.equals( this.triggerProtect, exchangeInformationResponseSymbolsInner.triggerProtect) && Objects.equals(this.filters, exchangeInformationResponseSymbolsInner.filters) - && Objects.equals(this.orderType, exchangeInformationResponseSymbolsInner.orderType) + && Objects.equals( + this.orderTypes, exchangeInformationResponseSymbolsInner.orderTypes) && Objects.equals( this.timeInForce, exchangeInformationResponseSymbolsInner.timeInForce) && Objects.equals( @@ -789,7 +790,7 @@ public int hashCode() { settlePlan, triggerProtect, filters, - orderType, + orderTypes, timeInForce, liquidationFee, marketTakeBound); @@ -825,7 +826,7 @@ public String toString() { sb.append(" settlePlan: ").append(toIndentedString(settlePlan)).append("\n"); sb.append(" triggerProtect: ").append(toIndentedString(triggerProtect)).append("\n"); sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" orderTypes: ").append(toIndentedString(orderTypes)).append("\n"); sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n"); sb.append(" liquidationFee: ").append(toIndentedString(liquidationFee)).append("\n"); sb.append(" marketTakeBound: ").append(toIndentedString(marketTakeBound)).append("\n"); @@ -932,13 +933,13 @@ public String toUrlQueryString() { ((Collection) filtersValue) .stream().map(Object::toString).collect(Collectors.joining(",")); sb.append("filters=").append(urlEncode(filtersValueAsString)).append(""); - Object orderTypeValue = getOrderType(); - String orderTypeValueAsString = ""; - orderTypeValueAsString = + Object orderTypesValue = getOrderTypes(); + String orderTypesValueAsString = ""; + orderTypesValueAsString = (String) - ((Collection) orderTypeValue) + ((Collection) orderTypesValue) .stream().map(Object::toString).collect(Collectors.joining(",")); - sb.append("orderType=").append(urlEncode(orderTypeValueAsString)).append(""); + sb.append("orderTypes=").append(urlEncode(orderTypesValueAsString)).append(""); Object timeInForceValue = getTimeInForce(); String timeInForceValueAsString = ""; timeInForceValueAsString = @@ -1002,7 +1003,7 @@ private String toIndentedString(Object o) { openapiFields.add("settlePlan"); openapiFields.add("triggerProtect"); openapiFields.add("filters"); - openapiFields.add("OrderType"); + openapiFields.add("orderTypes"); openapiFields.add("timeInForce"); openapiFields.add("liquidationFee"); openapiFields.add("marketTakeBound"); @@ -1153,14 +1154,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } // ensure the optional json data is an array if present - if (jsonObj.get("OrderType") != null - && !jsonObj.get("OrderType").isJsonNull() - && !jsonObj.get("OrderType").isJsonArray()) { + if (jsonObj.get("orderTypes") != null + && !jsonObj.get("orderTypes").isJsonNull() + && !jsonObj.get("orderTypes").isJsonArray()) { throw new IllegalArgumentException( String.format( - "Expected the field `OrderType` to be an array in the JSON string but" + "Expected the field `orderTypes` to be an array in the JSON string but" + " got `%s`", - jsonObj.get("OrderType").toString())); + jsonObj.get("orderTypes").toString())); } // ensure the optional json data is an array if present if (jsonObj.get("timeInForce") != null diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/QueryOrderResponse.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/QueryOrderResponse.java index 590ba48cc..a4596b307 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/QueryOrderResponse.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/QueryOrderResponse.java @@ -22,7 +22,6 @@ import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import jakarta.validation.Valid; import jakarta.validation.constraints.*; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -37,46 +36,356 @@ value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0") public class QueryOrderResponse { - public static final String SERIALIZED_NAME_ID = "id"; + public static final String SERIALIZED_NAME_AVG_PRICE = "avgPrice"; - @SerializedName(SERIALIZED_NAME_ID) + @SerializedName(SERIALIZED_NAME_AVG_PRICE) @jakarta.annotation.Nullable - private String id; + private String avgPrice; + + public static final String SERIALIZED_NAME_CLIENT_ORDER_ID = "clientOrderId"; + + @SerializedName(SERIALIZED_NAME_CLIENT_ORDER_ID) + @jakarta.annotation.Nullable + private String clientOrderId; + + public static final String SERIALIZED_NAME_CUM_QUOTE = "cumQuote"; + + @SerializedName(SERIALIZED_NAME_CUM_QUOTE) + @jakarta.annotation.Nullable + private String cumQuote; + + public static final String SERIALIZED_NAME_EXECUTED_QTY = "executedQty"; + + @SerializedName(SERIALIZED_NAME_EXECUTED_QTY) + @jakarta.annotation.Nullable + private String executedQty; + + public static final String SERIALIZED_NAME_ORDER_ID = "orderId"; + + @SerializedName(SERIALIZED_NAME_ORDER_ID) + @jakarta.annotation.Nullable + private Long orderId; + + public static final String SERIALIZED_NAME_ORIG_QTY = "origQty"; + + @SerializedName(SERIALIZED_NAME_ORIG_QTY) + @jakarta.annotation.Nullable + private String origQty; + + public static final String SERIALIZED_NAME_ORIG_TYPE = "origType"; + + @SerializedName(SERIALIZED_NAME_ORIG_TYPE) + @jakarta.annotation.Nullable + private String origType; + + public static final String SERIALIZED_NAME_PRICE = "price"; + + @SerializedName(SERIALIZED_NAME_PRICE) + @jakarta.annotation.Nullable + private String price; + + public static final String SERIALIZED_NAME_REDUCE_ONLY = "reduceOnly"; + + @SerializedName(SERIALIZED_NAME_REDUCE_ONLY) + @jakarta.annotation.Nullable + private Boolean reduceOnly; + + public static final String SERIALIZED_NAME_SIDE = "side"; + + @SerializedName(SERIALIZED_NAME_SIDE) + @jakarta.annotation.Nullable + private String side; + + public static final String SERIALIZED_NAME_POSITION_SIDE = "positionSide"; + + @SerializedName(SERIALIZED_NAME_POSITION_SIDE) + @jakarta.annotation.Nullable + private String positionSide; public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) @jakarta.annotation.Nullable - private Long status; + private String status; + + public static final String SERIALIZED_NAME_STOP_PRICE = "stopPrice"; + + @SerializedName(SERIALIZED_NAME_STOP_PRICE) + @jakarta.annotation.Nullable + private String stopPrice; + + public static final String SERIALIZED_NAME_CLOSE_POSITION = "closePosition"; + + @SerializedName(SERIALIZED_NAME_CLOSE_POSITION) + @jakarta.annotation.Nullable + private Boolean closePosition; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_TIME = "time"; + + @SerializedName(SERIALIZED_NAME_TIME) + @jakarta.annotation.Nullable + private Long time; + + public static final String SERIALIZED_NAME_TIME_IN_FORCE = "timeInForce"; + + @SerializedName(SERIALIZED_NAME_TIME_IN_FORCE) + @jakarta.annotation.Nullable + private String timeInForce; - public static final String SERIALIZED_NAME_RESULT = "result"; + public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_RESULT) + @SerializedName(SERIALIZED_NAME_TYPE) @jakarta.annotation.Nullable - private QueryOrderResponseResult result; + private String type; + + public static final String SERIALIZED_NAME_ACTIVATE_PRICE = "activatePrice"; + + @SerializedName(SERIALIZED_NAME_ACTIVATE_PRICE) + @jakarta.annotation.Nullable + private String activatePrice; + + public static final String SERIALIZED_NAME_PRICE_RATE = "priceRate"; + + @SerializedName(SERIALIZED_NAME_PRICE_RATE) + @jakarta.annotation.Nullable + private String priceRate; + + public static final String SERIALIZED_NAME_UPDATE_TIME = "updateTime"; + + @SerializedName(SERIALIZED_NAME_UPDATE_TIME) + @jakarta.annotation.Nullable + private Long updateTime; + + public static final String SERIALIZED_NAME_WORKING_TYPE = "workingType"; + + @SerializedName(SERIALIZED_NAME_WORKING_TYPE) + @jakarta.annotation.Nullable + private String workingType; + + public static final String SERIALIZED_NAME_PRICE_PROTECT = "priceProtect"; + + @SerializedName(SERIALIZED_NAME_PRICE_PROTECT) + @jakarta.annotation.Nullable + private Boolean priceProtect; public QueryOrderResponse() {} - public QueryOrderResponse id(@jakarta.annotation.Nullable String id) { - this.id = id; + public QueryOrderResponse avgPrice(@jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + return this; + } + + /** + * Get avgPrice + * + * @return avgPrice + */ + @jakarta.annotation.Nullable + public String getAvgPrice() { + return avgPrice; + } + + public void setAvgPrice(@jakarta.annotation.Nullable String avgPrice) { + this.avgPrice = avgPrice; + } + + public QueryOrderResponse clientOrderId(@jakarta.annotation.Nullable String clientOrderId) { + this.clientOrderId = clientOrderId; + return this; + } + + /** + * Get clientOrderId + * + * @return clientOrderId + */ + @jakarta.annotation.Nullable + public String getClientOrderId() { + return clientOrderId; + } + + public void setClientOrderId(@jakarta.annotation.Nullable String clientOrderId) { + this.clientOrderId = clientOrderId; + } + + public QueryOrderResponse cumQuote(@jakarta.annotation.Nullable String cumQuote) { + this.cumQuote = cumQuote; return this; } /** - * Get id + * Get cumQuote * - * @return id + * @return cumQuote */ @jakarta.annotation.Nullable - public String getId() { - return id; + public String getCumQuote() { + return cumQuote; } - public void setId(@jakarta.annotation.Nullable String id) { - this.id = id; + public void setCumQuote(@jakarta.annotation.Nullable String cumQuote) { + this.cumQuote = cumQuote; } - public QueryOrderResponse status(@jakarta.annotation.Nullable Long status) { + public QueryOrderResponse executedQty(@jakarta.annotation.Nullable String executedQty) { + this.executedQty = executedQty; + return this; + } + + /** + * Get executedQty + * + * @return executedQty + */ + @jakarta.annotation.Nullable + public String getExecutedQty() { + return executedQty; + } + + public void setExecutedQty(@jakarta.annotation.Nullable String executedQty) { + this.executedQty = executedQty; + } + + public QueryOrderResponse orderId(@jakarta.annotation.Nullable Long orderId) { + this.orderId = orderId; + return this; + } + + /** + * Get orderId + * + * @return orderId + */ + @jakarta.annotation.Nullable + public Long getOrderId() { + return orderId; + } + + public void setOrderId(@jakarta.annotation.Nullable Long orderId) { + this.orderId = orderId; + } + + public QueryOrderResponse origQty(@jakarta.annotation.Nullable String origQty) { + this.origQty = origQty; + return this; + } + + /** + * Get origQty + * + * @return origQty + */ + @jakarta.annotation.Nullable + public String getOrigQty() { + return origQty; + } + + public void setOrigQty(@jakarta.annotation.Nullable String origQty) { + this.origQty = origQty; + } + + public QueryOrderResponse origType(@jakarta.annotation.Nullable String origType) { + this.origType = origType; + return this; + } + + /** + * Get origType + * + * @return origType + */ + @jakarta.annotation.Nullable + public String getOrigType() { + return origType; + } + + public void setOrigType(@jakarta.annotation.Nullable String origType) { + this.origType = origType; + } + + public QueryOrderResponse price(@jakarta.annotation.Nullable String price) { + this.price = price; + return this; + } + + /** + * Get price + * + * @return price + */ + @jakarta.annotation.Nullable + public String getPrice() { + return price; + } + + public void setPrice(@jakarta.annotation.Nullable String price) { + this.price = price; + } + + public QueryOrderResponse reduceOnly(@jakarta.annotation.Nullable Boolean reduceOnly) { + this.reduceOnly = reduceOnly; + return this; + } + + /** + * Get reduceOnly + * + * @return reduceOnly + */ + @jakarta.annotation.Nullable + public Boolean getReduceOnly() { + return reduceOnly; + } + + public void setReduceOnly(@jakarta.annotation.Nullable Boolean reduceOnly) { + this.reduceOnly = reduceOnly; + } + + public QueryOrderResponse side(@jakarta.annotation.Nullable String side) { + this.side = side; + return this; + } + + /** + * Get side + * + * @return side + */ + @jakarta.annotation.Nullable + public String getSide() { + return side; + } + + public void setSide(@jakarta.annotation.Nullable String side) { + this.side = side; + } + + public QueryOrderResponse positionSide(@jakarta.annotation.Nullable String positionSide) { + this.positionSide = positionSide; + return this; + } + + /** + * Get positionSide + * + * @return positionSide + */ + @jakarta.annotation.Nullable + public String getPositionSide() { + return positionSide; + } + + public void setPositionSide(@jakarta.annotation.Nullable String positionSide) { + this.positionSide = positionSide; + } + + public QueryOrderResponse status(@jakarta.annotation.Nullable String status) { this.status = status; return this; } @@ -87,32 +396,221 @@ public QueryOrderResponse status(@jakarta.annotation.Nullable Long status) { * @return status */ @jakarta.annotation.Nullable - public Long getStatus() { + public String getStatus() { return status; } - public void setStatus(@jakarta.annotation.Nullable Long status) { + public void setStatus(@jakarta.annotation.Nullable String status) { this.status = status; } - public QueryOrderResponse result(@jakarta.annotation.Nullable QueryOrderResponseResult result) { - this.result = result; + public QueryOrderResponse stopPrice(@jakarta.annotation.Nullable String stopPrice) { + this.stopPrice = stopPrice; + return this; + } + + /** + * Get stopPrice + * + * @return stopPrice + */ + @jakarta.annotation.Nullable + public String getStopPrice() { + return stopPrice; + } + + public void setStopPrice(@jakarta.annotation.Nullable String stopPrice) { + this.stopPrice = stopPrice; + } + + public QueryOrderResponse closePosition(@jakarta.annotation.Nullable Boolean closePosition) { + this.closePosition = closePosition; + return this; + } + + /** + * Get closePosition + * + * @return closePosition + */ + @jakarta.annotation.Nullable + public Boolean getClosePosition() { + return closePosition; + } + + public void setClosePosition(@jakarta.annotation.Nullable Boolean closePosition) { + this.closePosition = closePosition; + } + + public QueryOrderResponse symbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public QueryOrderResponse time(@jakarta.annotation.Nullable Long time) { + this.time = time; + return this; + } + + /** + * Get time + * + * @return time + */ + @jakarta.annotation.Nullable + public Long getTime() { + return time; + } + + public void setTime(@jakarta.annotation.Nullable Long time) { + this.time = time; + } + + public QueryOrderResponse timeInForce(@jakarta.annotation.Nullable String timeInForce) { + this.timeInForce = timeInForce; return this; } /** - * Get result + * Get timeInForce * - * @return result + * @return timeInForce */ @jakarta.annotation.Nullable - @Valid - public QueryOrderResponseResult getResult() { - return result; + public String getTimeInForce() { + return timeInForce; } - public void setResult(@jakarta.annotation.Nullable QueryOrderResponseResult result) { - this.result = result; + public void setTimeInForce(@jakarta.annotation.Nullable String timeInForce) { + this.timeInForce = timeInForce; + } + + public QueryOrderResponse type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @jakarta.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + public QueryOrderResponse activatePrice(@jakarta.annotation.Nullable String activatePrice) { + this.activatePrice = activatePrice; + return this; + } + + /** + * Get activatePrice + * + * @return activatePrice + */ + @jakarta.annotation.Nullable + public String getActivatePrice() { + return activatePrice; + } + + public void setActivatePrice(@jakarta.annotation.Nullable String activatePrice) { + this.activatePrice = activatePrice; + } + + public QueryOrderResponse priceRate(@jakarta.annotation.Nullable String priceRate) { + this.priceRate = priceRate; + return this; + } + + /** + * Get priceRate + * + * @return priceRate + */ + @jakarta.annotation.Nullable + public String getPriceRate() { + return priceRate; + } + + public void setPriceRate(@jakarta.annotation.Nullable String priceRate) { + this.priceRate = priceRate; + } + + public QueryOrderResponse updateTime(@jakarta.annotation.Nullable Long updateTime) { + this.updateTime = updateTime; + return this; + } + + /** + * Get updateTime + * + * @return updateTime + */ + @jakarta.annotation.Nullable + public Long getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(@jakarta.annotation.Nullable Long updateTime) { + this.updateTime = updateTime; + } + + public QueryOrderResponse workingType(@jakarta.annotation.Nullable String workingType) { + this.workingType = workingType; + return this; + } + + /** + * Get workingType + * + * @return workingType + */ + @jakarta.annotation.Nullable + public String getWorkingType() { + return workingType; + } + + public void setWorkingType(@jakarta.annotation.Nullable String workingType) { + this.workingType = workingType; + } + + public QueryOrderResponse priceProtect(@jakarta.annotation.Nullable Boolean priceProtect) { + this.priceProtect = priceProtect; + return this; + } + + /** + * Get priceProtect + * + * @return priceProtect + */ + @jakarta.annotation.Nullable + public Boolean getPriceProtect() { + return priceProtect; + } + + public void setPriceProtect(@jakarta.annotation.Nullable Boolean priceProtect) { + this.priceProtect = priceProtect; } @Override @@ -124,23 +622,86 @@ public boolean equals(Object o) { return false; } QueryOrderResponse queryOrderResponse = (QueryOrderResponse) o; - return Objects.equals(this.id, queryOrderResponse.id) + return Objects.equals(this.avgPrice, queryOrderResponse.avgPrice) + && Objects.equals(this.clientOrderId, queryOrderResponse.clientOrderId) + && Objects.equals(this.cumQuote, queryOrderResponse.cumQuote) + && Objects.equals(this.executedQty, queryOrderResponse.executedQty) + && Objects.equals(this.orderId, queryOrderResponse.orderId) + && Objects.equals(this.origQty, queryOrderResponse.origQty) + && Objects.equals(this.origType, queryOrderResponse.origType) + && Objects.equals(this.price, queryOrderResponse.price) + && Objects.equals(this.reduceOnly, queryOrderResponse.reduceOnly) + && Objects.equals(this.side, queryOrderResponse.side) + && Objects.equals(this.positionSide, queryOrderResponse.positionSide) && Objects.equals(this.status, queryOrderResponse.status) - && Objects.equals(this.result, queryOrderResponse.result); + && Objects.equals(this.stopPrice, queryOrderResponse.stopPrice) + && Objects.equals(this.closePosition, queryOrderResponse.closePosition) + && Objects.equals(this.symbol, queryOrderResponse.symbol) + && Objects.equals(this.time, queryOrderResponse.time) + && Objects.equals(this.timeInForce, queryOrderResponse.timeInForce) + && Objects.equals(this.type, queryOrderResponse.type) + && Objects.equals(this.activatePrice, queryOrderResponse.activatePrice) + && Objects.equals(this.priceRate, queryOrderResponse.priceRate) + && Objects.equals(this.updateTime, queryOrderResponse.updateTime) + && Objects.equals(this.workingType, queryOrderResponse.workingType) + && Objects.equals(this.priceProtect, queryOrderResponse.priceProtect); } @Override public int hashCode() { - return Objects.hash(id, status, result); + return Objects.hash( + avgPrice, + clientOrderId, + cumQuote, + executedQty, + orderId, + origQty, + origType, + price, + reduceOnly, + side, + positionSide, + status, + stopPrice, + closePosition, + symbol, + time, + timeInForce, + type, + activatePrice, + priceRate, + updateTime, + workingType, + priceProtect); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class QueryOrderResponse {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" avgPrice: ").append(toIndentedString(avgPrice)).append("\n"); + sb.append(" clientOrderId: ").append(toIndentedString(clientOrderId)).append("\n"); + sb.append(" cumQuote: ").append(toIndentedString(cumQuote)).append("\n"); + sb.append(" executedQty: ").append(toIndentedString(executedQty)).append("\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append(" origQty: ").append(toIndentedString(origQty)).append("\n"); + sb.append(" origType: ").append(toIndentedString(origType)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" reduceOnly: ").append(toIndentedString(reduceOnly)).append("\n"); + sb.append(" side: ").append(toIndentedString(side)).append("\n"); + sb.append(" positionSide: ").append(toIndentedString(positionSide)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append(" stopPrice: ").append(toIndentedString(stopPrice)).append("\n"); + sb.append(" closePosition: ").append(toIndentedString(closePosition)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" activatePrice: ").append(toIndentedString(activatePrice)).append("\n"); + sb.append(" priceRate: ").append(toIndentedString(priceRate)).append("\n"); + sb.append(" updateTime: ").append(toIndentedString(updateTime)).append("\n"); + sb.append(" workingType: ").append(toIndentedString(workingType)).append("\n"); + sb.append(" priceProtect: ").append(toIndentedString(priceProtect)).append("\n"); sb.append("}"); return sb.toString(); } @@ -148,18 +709,98 @@ public String toString() { public String toUrlQueryString() { StringBuilder sb = new StringBuilder(); - Object idValue = getId(); - String idValueAsString = ""; - idValueAsString = idValue.toString(); - sb.append("id=").append(urlEncode(idValueAsString)).append(""); + Object avgPriceValue = getAvgPrice(); + String avgPriceValueAsString = ""; + avgPriceValueAsString = avgPriceValue.toString(); + sb.append("avgPrice=").append(urlEncode(avgPriceValueAsString)).append(""); + Object clientOrderIdValue = getClientOrderId(); + String clientOrderIdValueAsString = ""; + clientOrderIdValueAsString = clientOrderIdValue.toString(); + sb.append("clientOrderId=").append(urlEncode(clientOrderIdValueAsString)).append(""); + Object cumQuoteValue = getCumQuote(); + String cumQuoteValueAsString = ""; + cumQuoteValueAsString = cumQuoteValue.toString(); + sb.append("cumQuote=").append(urlEncode(cumQuoteValueAsString)).append(""); + Object executedQtyValue = getExecutedQty(); + String executedQtyValueAsString = ""; + executedQtyValueAsString = executedQtyValue.toString(); + sb.append("executedQty=").append(urlEncode(executedQtyValueAsString)).append(""); + Object orderIdValue = getOrderId(); + String orderIdValueAsString = ""; + orderIdValueAsString = orderIdValue.toString(); + sb.append("orderId=").append(urlEncode(orderIdValueAsString)).append(""); + Object origQtyValue = getOrigQty(); + String origQtyValueAsString = ""; + origQtyValueAsString = origQtyValue.toString(); + sb.append("origQty=").append(urlEncode(origQtyValueAsString)).append(""); + Object origTypeValue = getOrigType(); + String origTypeValueAsString = ""; + origTypeValueAsString = origTypeValue.toString(); + sb.append("origType=").append(urlEncode(origTypeValueAsString)).append(""); + Object priceValue = getPrice(); + String priceValueAsString = ""; + priceValueAsString = priceValue.toString(); + sb.append("price=").append(urlEncode(priceValueAsString)).append(""); + Object reduceOnlyValue = getReduceOnly(); + String reduceOnlyValueAsString = ""; + reduceOnlyValueAsString = reduceOnlyValue.toString(); + sb.append("reduceOnly=").append(urlEncode(reduceOnlyValueAsString)).append(""); + Object sideValue = getSide(); + String sideValueAsString = ""; + sideValueAsString = sideValue.toString(); + sb.append("side=").append(urlEncode(sideValueAsString)).append(""); + Object positionSideValue = getPositionSide(); + String positionSideValueAsString = ""; + positionSideValueAsString = positionSideValue.toString(); + sb.append("positionSide=").append(urlEncode(positionSideValueAsString)).append(""); Object statusValue = getStatus(); String statusValueAsString = ""; statusValueAsString = statusValue.toString(); sb.append("status=").append(urlEncode(statusValueAsString)).append(""); - Object resultValue = getResult(); - String resultValueAsString = ""; - resultValueAsString = resultValue.toString(); - sb.append("result=").append(urlEncode(resultValueAsString)).append(""); + Object stopPriceValue = getStopPrice(); + String stopPriceValueAsString = ""; + stopPriceValueAsString = stopPriceValue.toString(); + sb.append("stopPrice=").append(urlEncode(stopPriceValueAsString)).append(""); + Object closePositionValue = getClosePosition(); + String closePositionValueAsString = ""; + closePositionValueAsString = closePositionValue.toString(); + sb.append("closePosition=").append(urlEncode(closePositionValueAsString)).append(""); + Object symbolValue = getSymbol(); + String symbolValueAsString = ""; + symbolValueAsString = symbolValue.toString(); + sb.append("symbol=").append(urlEncode(symbolValueAsString)).append(""); + Object timeValue = getTime(); + String timeValueAsString = ""; + timeValueAsString = timeValue.toString(); + sb.append("time=").append(urlEncode(timeValueAsString)).append(""); + Object timeInForceValue = getTimeInForce(); + String timeInForceValueAsString = ""; + timeInForceValueAsString = timeInForceValue.toString(); + sb.append("timeInForce=").append(urlEncode(timeInForceValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).append(""); + Object activatePriceValue = getActivatePrice(); + String activatePriceValueAsString = ""; + activatePriceValueAsString = activatePriceValue.toString(); + sb.append("activatePrice=").append(urlEncode(activatePriceValueAsString)).append(""); + Object priceRateValue = getPriceRate(); + String priceRateValueAsString = ""; + priceRateValueAsString = priceRateValue.toString(); + sb.append("priceRate=").append(urlEncode(priceRateValueAsString)).append(""); + Object updateTimeValue = getUpdateTime(); + String updateTimeValueAsString = ""; + updateTimeValueAsString = updateTimeValue.toString(); + sb.append("updateTime=").append(urlEncode(updateTimeValueAsString)).append(""); + Object workingTypeValue = getWorkingType(); + String workingTypeValueAsString = ""; + workingTypeValueAsString = workingTypeValue.toString(); + sb.append("workingType=").append(urlEncode(workingTypeValueAsString)).append(""); + Object priceProtectValue = getPriceProtect(); + String priceProtectValueAsString = ""; + priceProtectValueAsString = priceProtectValue.toString(); + sb.append("priceProtect=").append(urlEncode(priceProtectValueAsString)).append(""); return sb.toString(); } @@ -188,9 +829,29 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); - openapiFields.add("id"); + openapiFields.add("avgPrice"); + openapiFields.add("clientOrderId"); + openapiFields.add("cumQuote"); + openapiFields.add("executedQty"); + openapiFields.add("orderId"); + openapiFields.add("origQty"); + openapiFields.add("origType"); + openapiFields.add("price"); + openapiFields.add("reduceOnly"); + openapiFields.add("side"); + openapiFields.add("positionSide"); openapiFields.add("status"); - openapiFields.add("result"); + openapiFields.add("stopPrice"); + openapiFields.add("closePosition"); + openapiFields.add("symbol"); + openapiFields.add("time"); + openapiFields.add("timeInForce"); + openapiFields.add("type"); + openapiFields.add("activatePrice"); + openapiFields.add("priceRate"); + openapiFields.add("updateTime"); + openapiFields.add("workingType"); + openapiFields.add("priceProtect"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -214,17 +875,141 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) - && !jsonObj.get("id").isJsonPrimitive()) { + if ((jsonObj.get("avgPrice") != null && !jsonObj.get("avgPrice").isJsonNull()) + && !jsonObj.get("avgPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `avgPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("avgPrice").toString())); + } + if ((jsonObj.get("clientOrderId") != null && !jsonObj.get("clientOrderId").isJsonNull()) + && !jsonObj.get("clientOrderId").isJsonPrimitive()) { throw new IllegalArgumentException( String.format( - "Expected the field `id` to be a primitive type in the JSON string but" - + " got `%s`", - jsonObj.get("id").toString())); + "Expected the field `clientOrderId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("clientOrderId").toString())); } - // validate the optional field `result` - if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { - QueryOrderResponseResult.validateJsonElement(jsonObj.get("result")); + if ((jsonObj.get("cumQuote") != null && !jsonObj.get("cumQuote").isJsonNull()) + && !jsonObj.get("cumQuote").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `cumQuote` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("cumQuote").toString())); + } + if ((jsonObj.get("executedQty") != null && !jsonObj.get("executedQty").isJsonNull()) + && !jsonObj.get("executedQty").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `executedQty` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("executedQty").toString())); + } + if ((jsonObj.get("origQty") != null && !jsonObj.get("origQty").isJsonNull()) + && !jsonObj.get("origQty").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `origQty` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("origQty").toString())); + } + if ((jsonObj.get("origType") != null && !jsonObj.get("origType").isJsonNull()) + && !jsonObj.get("origType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `origType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("origType").toString())); + } + if ((jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) + && !jsonObj.get("price").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `price` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("price").toString())); + } + if ((jsonObj.get("side") != null && !jsonObj.get("side").isJsonNull()) + && !jsonObj.get("side").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `side` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("side").toString())); + } + if ((jsonObj.get("positionSide") != null && !jsonObj.get("positionSide").isJsonNull()) + && !jsonObj.get("positionSide").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `positionSide` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("positionSide").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `status` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("stopPrice") != null && !jsonObj.get("stopPrice").isJsonNull()) + && !jsonObj.get("stopPrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `stopPrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("stopPrice").toString())); + } + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("timeInForce") != null && !jsonObj.get("timeInForce").isJsonNull()) + && !jsonObj.get("timeInForce").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timeInForce` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timeInForce").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `type` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("type").toString())); + } + if ((jsonObj.get("activatePrice") != null && !jsonObj.get("activatePrice").isJsonNull()) + && !jsonObj.get("activatePrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `activatePrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("activatePrice").toString())); + } + if ((jsonObj.get("priceRate") != null && !jsonObj.get("priceRate").isJsonNull()) + && !jsonObj.get("priceRate").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `priceRate` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("priceRate").toString())); + } + if ((jsonObj.get("workingType") != null && !jsonObj.get("workingType").isJsonNull()) + && !jsonObj.get("workingType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `workingType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("workingType").toString())); } } diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/api/DerivativesTradingUsdsFuturesWebSocketApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/api/DerivativesTradingUsdsFuturesWebSocketApi.java index 105df89be..3d2e7e850 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/api/DerivativesTradingUsdsFuturesWebSocketApi.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/api/DerivativesTradingUsdsFuturesWebSocketApi.java @@ -50,7 +50,7 @@ public class DerivativesTradingUsdsFuturesWebSocketApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/9.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private AccountApi accountApi; diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/DerivativesTradingUsdsFuturesWebSocketStreams.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/DerivativesTradingUsdsFuturesWebSocketStreams.java index d277946db..640a90f8f 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/DerivativesTradingUsdsFuturesWebSocketStreams.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/DerivativesTradingUsdsFuturesWebSocketStreams.java @@ -60,60 +60,85 @@ public class DerivativesTradingUsdsFuturesWebSocketStreams { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/9.0.0 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); - private final StreamConnectionInterface connection; + private WebSocketClientConfiguration clientConfiguration; + private StreamConnectionInterface connection; - private WebsocketMarketStreamsApi websocketMarketStreamsApi; + private MarketApi marketApi; + private PublicApi publicApi; public DerivativesTradingUsdsFuturesWebSocketStreams( WebSocketClientConfiguration configuration) { - this( - configuration.getUsePool() - ? new StreamConnectionPoolWrapper(configuration, JSON.getGson()) - : new StreamConnectionWrapper(configuration, JSON.getGson())); + this.clientConfiguration = configuration; } - public DerivativesTradingUsdsFuturesWebSocketStreams(StreamConnectionInterface connection) { - connection.setUserAgent(USER_AGENT); - if (!connection.isConnected()) { - connection.connect(); + public StreamConnectionInterface getConnection() { + if (connection == null) { + WebSocketClientConfiguration configuration = + (WebSocketClientConfiguration) clientConfiguration.clone(); + if (configuration.getUrl().endsWith("/stream") + && !configuration.getUrl().endsWith("/private/stream")) { + configuration.setUrl(configuration.getUrl().replace("/stream", "/private/stream")); + } + connection = + clientConfiguration.getUsePool() + ? new StreamConnectionPoolWrapper(clientConfiguration, JSON.getGson()) + : new StreamConnectionWrapper(clientConfiguration, JSON.getGson()); } - this.connection = connection; + return connection; + } - this.websocketMarketStreamsApi = new WebsocketMarketStreamsApi(connection); + public MarketApi getMarketApi() { + if (marketApi == null) { + WebSocketClientConfiguration configuration = + (WebSocketClientConfiguration) clientConfiguration.clone(); + if (configuration.getUrl().endsWith("/stream") + && !configuration.getUrl().endsWith("/market/stream")) { + configuration.setUrl(configuration.getUrl().replace("/stream", "/market/stream")); + } + marketApi = new MarketApi(configuration); + } + return marketApi; } - public StreamBlockingQueueWrapper aggregateTradeStreams( - AggregateTradeStreamsRequest aggregateTradeStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.aggregateTradeStreams(aggregateTradeStreamsRequest); + public PublicApi getPublicApi() { + if (publicApi == null) { + WebSocketClientConfiguration configuration = + (WebSocketClientConfiguration) clientConfiguration.clone(); + if (configuration.getUrl().endsWith("/stream") + && !configuration.getUrl().endsWith("/public/stream")) { + configuration.setUrl(configuration.getUrl().replace("/stream", "/public/stream")); + } + publicApi = new PublicApi(configuration); + } + return publicApi; } - public StreamBlockingQueueWrapper allBookTickersStream( - AllBookTickersStreamRequest allBookTickersStreamRequest) throws ApiException { - return websocketMarketStreamsApi.allBookTickersStream(allBookTickersStreamRequest); + public StreamBlockingQueueWrapper aggregateTradeStreams( + AggregateTradeStreamsRequest aggregateTradeStreamsRequest) throws ApiException { + return getMarketApi().aggregateTradeStreams(aggregateTradeStreamsRequest); } public StreamBlockingQueueWrapper allMarketLiquidationOrderStreams( AllMarketLiquidationOrderStreamsRequest allMarketLiquidationOrderStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.allMarketLiquidationOrderStreams( - allMarketLiquidationOrderStreamsRequest); + return getMarketApi() + .allMarketLiquidationOrderStreams(allMarketLiquidationOrderStreamsRequest); } public StreamBlockingQueueWrapper allMarketMiniTickersStream( AllMarketMiniTickersStreamRequest allMarketMiniTickersStreamRequest) throws ApiException { - return websocketMarketStreamsApi.allMarketMiniTickersStream( - allMarketMiniTickersStreamRequest); + return getMarketApi().allMarketMiniTickersStream(allMarketMiniTickersStreamRequest); } public StreamBlockingQueueWrapper allMarketTickersStreams( AllMarketTickersStreamsRequest allMarketTickersStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.allMarketTickersStreams(allMarketTickersStreamsRequest); + return getMarketApi().allMarketTickersStreams(allMarketTickersStreamsRequest); } public StreamBlockingQueueWrapper @@ -121,8 +146,9 @@ public StreamBlockingQueueWrapper allMarketTick CompositeIndexSymbolInformationStreamsRequest compositeIndexSymbolInformationStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.compositeIndexSymbolInformationStreams( - compositeIndexSymbolInformationStreamsRequest); + return getMarketApi() + .compositeIndexSymbolInformationStreams( + compositeIndexSymbolInformationStreamsRequest); } public StreamBlockingQueueWrapper @@ -130,87 +156,90 @@ public StreamBlockingQueueWrapper allMarketTick ContinuousContractKlineCandlestickStreamsRequest continuousContractKlineCandlestickStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.continuousContractKlineCandlestickStreams( - continuousContractKlineCandlestickStreamsRequest); + return getMarketApi() + .continuousContractKlineCandlestickStreams( + continuousContractKlineCandlestickStreamsRequest); } public StreamBlockingQueueWrapper contractInfoStream( ContractInfoStreamRequest contractInfoStreamRequest) throws ApiException { - return websocketMarketStreamsApi.contractInfoStream(contractInfoStreamRequest); - } - - public StreamBlockingQueueWrapper diffBookDepthStreams( - DiffBookDepthStreamsRequest diffBookDepthStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.diffBookDepthStreams(diffBookDepthStreamsRequest); - } - - public StreamBlockingQueueWrapper - individualSymbolBookTickerStreams( - IndividualSymbolBookTickerStreamsRequest - individualSymbolBookTickerStreamsRequest) - throws ApiException { - return websocketMarketStreamsApi.individualSymbolBookTickerStreams( - individualSymbolBookTickerStreamsRequest); + return getMarketApi().contractInfoStream(contractInfoStreamRequest); } public StreamBlockingQueueWrapper individualSymbolMiniTickerStream( IndividualSymbolMiniTickerStreamRequest individualSymbolMiniTickerStreamRequest) throws ApiException { - return websocketMarketStreamsApi.individualSymbolMiniTickerStream( - individualSymbolMiniTickerStreamRequest); + return getMarketApi() + .individualSymbolMiniTickerStream(individualSymbolMiniTickerStreamRequest); } public StreamBlockingQueueWrapper individualSymbolTickerStreams( IndividualSymbolTickerStreamsRequest individualSymbolTickerStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.individualSymbolTickerStreams( - individualSymbolTickerStreamsRequest); + return getMarketApi().individualSymbolTickerStreams(individualSymbolTickerStreamsRequest); } public StreamBlockingQueueWrapper klineCandlestickStreams( KlineCandlestickStreamsRequest klineCandlestickStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.klineCandlestickStreams(klineCandlestickStreamsRequest); + return getMarketApi().klineCandlestickStreams(klineCandlestickStreamsRequest); } public StreamBlockingQueueWrapper liquidationOrderStreams( LiquidationOrderStreamsRequest liquidationOrderStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.liquidationOrderStreams(liquidationOrderStreamsRequest); + return getMarketApi().liquidationOrderStreams(liquidationOrderStreamsRequest); } public StreamBlockingQueueWrapper markPriceStream( MarkPriceStreamRequest markPriceStreamRequest) throws ApiException { - return websocketMarketStreamsApi.markPriceStream(markPriceStreamRequest); + return getMarketApi().markPriceStream(markPriceStreamRequest); } public StreamBlockingQueueWrapper markPriceStreamForAllMarket( MarkPriceStreamForAllMarketRequest markPriceStreamForAllMarketRequest) throws ApiException { - return websocketMarketStreamsApi.markPriceStreamForAllMarket( - markPriceStreamForAllMarketRequest); + return getMarketApi().markPriceStreamForAllMarket(markPriceStreamForAllMarketRequest); } public StreamBlockingQueueWrapper multiAssetsModeAssetIndex( MultiAssetsModeAssetIndexRequest multiAssetsModeAssetIndexRequest) throws ApiException { - return websocketMarketStreamsApi.multiAssetsModeAssetIndex( - multiAssetsModeAssetIndexRequest); + return getMarketApi().multiAssetsModeAssetIndex(multiAssetsModeAssetIndexRequest); + } + + public StreamBlockingQueueWrapper tradingSessionStream( + TradingSessionStreamRequest tradingSessionStreamRequest) throws ApiException { + return getMarketApi().tradingSessionStream(tradingSessionStreamRequest); + } + + public StreamBlockingQueueWrapper allBookTickersStream( + AllBookTickersStreamRequest allBookTickersStreamRequest) throws ApiException { + return getPublicApi().allBookTickersStream(allBookTickersStreamRequest); + } + + public StreamBlockingQueueWrapper diffBookDepthStreams( + DiffBookDepthStreamsRequest diffBookDepthStreamsRequest) throws ApiException { + return getPublicApi().diffBookDepthStreams(diffBookDepthStreamsRequest); + } + + public StreamBlockingQueueWrapper + individualSymbolBookTickerStreams( + IndividualSymbolBookTickerStreamsRequest + individualSymbolBookTickerStreamsRequest) + throws ApiException { + return getPublicApi() + .individualSymbolBookTickerStreams(individualSymbolBookTickerStreamsRequest); } public StreamBlockingQueueWrapper partialBookDepthStreams( PartialBookDepthStreamsRequest partialBookDepthStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.partialBookDepthStreams(partialBookDepthStreamsRequest); + return getPublicApi().partialBookDepthStreams(partialBookDepthStreamsRequest); } public StreamBlockingQueueWrapper rpiDiffBookDepthStreams( RpiDiffBookDepthStreamsRequest rpiDiffBookDepthStreamsRequest) throws ApiException { - return websocketMarketStreamsApi.rpiDiffBookDepthStreams(rpiDiffBookDepthStreamsRequest); - } - - public StreamBlockingQueueWrapper tradingSessionStream( - TradingSessionStreamRequest tradingSessionStreamRequest) throws ApiException { - return websocketMarketStreamsApi.tradingSessionStream(tradingSessionStreamRequest); + return getPublicApi().rpiDiffBookDepthStreams(rpiDiffBookDepthStreamsRequest); } /** @@ -227,7 +256,7 @@ public StreamBlockingQueueWrapper userData(String .params(Collections.singleton(listenKey)) .build(); Map> queuesMap = - connection.subscribe(requestWrapperDTO); + getConnection().subscribe(requestWrapperDTO); TypeToken typeToken = new TypeToken<>() {}; StreamBlockingQueue queue = queuesMap.get(listenKey); diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/MarketApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/MarketApi.java new file mode 100644 index 000000000..ec166bac7 --- /dev/null +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/MarketApi.java @@ -0,0 +1,1431 @@ +/* + * Binance Derivatives Trading USDS Futures WebSocket Market Streams + * OpenAPI Specification for the Binance Derivatives Trading USDS Futures WebSocket Market Streams + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.SystemUtil; +import com.binance.connector.client.common.exception.ConstraintViolationException; +import com.binance.connector.client.common.websocket.adapter.stream.StreamConnectionInterface; +import com.binance.connector.client.common.websocket.adapter.stream.StreamConnectionPoolWrapper; +import com.binance.connector.client.common.websocket.adapter.stream.StreamConnectionWrapper; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.dtos.RequestWrapperDTO; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueue; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.JSON; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AggregateTradeStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AggregateTradeStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketLiquidationOrderStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketLiquidationOrderStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketMiniTickersStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketMiniTickersStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketTickersStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketTickersStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.CompositeIndexSymbolInformationStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.CompositeIndexSymbolInformationStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContinuousContractKlineCandlestickStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContinuousContractKlineCandlestickStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContractInfoStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContractInfoStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolMiniTickerStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolMiniTickerStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolTickerStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolTickerStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.KlineCandlestickStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.KlineCandlestickStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.LiquidationOrderStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.LiquidationOrderStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamForAllMarketRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamForAllMarketResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MultiAssetsModeAssetIndexRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MultiAssetsModeAssetIndexResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.TradingSessionStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.TradingSessionStreamResponse; +import com.google.gson.reflect.TypeToken; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.constraints.*; +import java.util.Collections; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; + +public class MarketApi { + private static final String USER_AGENT = + String.format( + "binance-derivatives-trading-usds-futures/10.0.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + + private StreamConnectionInterface connection; + + public MarketApi() {} + + public MarketApi(WebSocketClientConfiguration configuration) { + this( + configuration.getUsePool() + ? new StreamConnectionPoolWrapper(configuration, JSON.getGson()) + : new StreamConnectionWrapper(configuration, JSON.getGson())); + } + + public MarketApi(StreamConnectionInterface connection) { + connection.setUserAgent(USER_AGENT); + if (!connection.isConnected()) { + connection.connect(); + } + this.connection = connection; + } + + /** + * Aggregate Trade Streams The Aggregate Trade Streams push market trade information that is + * aggregated for fills with same price and taking side every 100 milliseconds. Only market + * trades will be aggregated, which means the insurance fund trades and ADL trades won't be + * aggregated. Retail Price Improvement(RPI) orders are aggregated into field `q` and + * without special tags to be distinguished. Update Speed: 100ms + * + * @param aggregateTradeStreamsRequest (required) + * @return AggregateTradeStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Aggregate Trade Streams -
+ * + * @see Aggregate + * Trade Streams Documentation + */ + public StreamBlockingQueueWrapper aggregateTradeStreams( + AggregateTradeStreamsRequest aggregateTradeStreamsRequest) throws ApiException { + StreamBlockingQueue queue = aggregateTradeStreamsRaw(aggregateTradeStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue aggregateTradeStreamsRaw( + AggregateTradeStreamsRequest aggregateTradeStreamsRequest) throws ApiException { + aggregateTradeStreamsValidateBeforeCall(aggregateTradeStreamsRequest); + + String methodName = + "/@aggTrade" + .substring(1) + .replace( + "", + aggregateTradeStreamsRequest.getId() != null + ? aggregateTradeStreamsRequest.getId().toString() + : "") + .replace( + "", + aggregateTradeStreamsRequest.getSymbol() != null + ? aggregateTradeStreamsRequest.getSymbol().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void aggregateTradeStreamsValidateBeforeCall( + AggregateTradeStreamsRequest aggregateTradeStreamsRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(aggregateTradeStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * All Market Liquidation Order Streams The All Liquidation Order Snapshot Streams push force + * liquidation order information for all symbols in the market. For each symbol,only the latest + * one liquidation order within 1000ms will be pushed as the snapshot. If no liquidation happens + * in the interval of 1000ms, no stream will be pushed. Update Speed: 1000ms + * + * @param allMarketLiquidationOrderStreamsRequest (required) + * @return AllMarketLiquidationOrderStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 All Market Liquidation Order Streams -
+ * + * @see All + * Market Liquidation Order Streams Documentation + */ + public StreamBlockingQueueWrapper + allMarketLiquidationOrderStreams( + AllMarketLiquidationOrderStreamsRequest allMarketLiquidationOrderStreamsRequest) + throws ApiException { + StreamBlockingQueue queue = + allMarketLiquidationOrderStreamsRaw(allMarketLiquidationOrderStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue allMarketLiquidationOrderStreamsRaw( + AllMarketLiquidationOrderStreamsRequest allMarketLiquidationOrderStreamsRequest) + throws ApiException { + allMarketLiquidationOrderStreamsValidateBeforeCall(allMarketLiquidationOrderStreamsRequest); + + String methodName = + "/!forceOrder@arr" + .substring(1) + .replace( + "", + allMarketLiquidationOrderStreamsRequest.getId() != null + ? allMarketLiquidationOrderStreamsRequest.getId().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void allMarketLiquidationOrderStreamsValidateBeforeCall( + AllMarketLiquidationOrderStreamsRequest allMarketLiquidationOrderStreamsRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(allMarketLiquidationOrderStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * All Market Mini Tickers Stream 24hr rolling window mini-ticker statistics for all symbols. + * These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to + * 24hrs before. Note that only tickers that have changed will be present in the array. Update + * Speed: 1000ms + * + * @param allMarketMiniTickersStreamRequest (required) + * @return AllMarketMiniTickersStreamResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 All Market Mini Tickers Stream -
+ * + * @see All + * Market Mini Tickers Stream Documentation + */ + public StreamBlockingQueueWrapper + allMarketMiniTickersStream( + AllMarketMiniTickersStreamRequest allMarketMiniTickersStreamRequest) + throws ApiException { + StreamBlockingQueue queue = + allMarketMiniTickersStreamRaw(allMarketMiniTickersStreamRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue allMarketMiniTickersStreamRaw( + AllMarketMiniTickersStreamRequest allMarketMiniTickersStreamRequest) + throws ApiException { + allMarketMiniTickersStreamValidateBeforeCall(allMarketMiniTickersStreamRequest); + + String methodName = + "/!miniTicker@arr" + .substring(1) + .replace( + "", + allMarketMiniTickersStreamRequest.getId() != null + ? allMarketMiniTickersStreamRequest.getId().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void allMarketMiniTickersStreamValidateBeforeCall( + AllMarketMiniTickersStreamRequest allMarketMiniTickersStreamRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(allMarketMiniTickersStreamRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * All Market Tickers Streams 24hr rolling window ticker statistics for all symbols. These are + * NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs + * before. Note that only tickers that have changed will be present in the array. Update Speed: + * 1000ms + * + * @param allMarketTickersStreamsRequest (required) + * @return AllMarketTickersStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 All Market Tickers Streams -
+ * + * @see All + * Market Tickers Streams Documentation + */ + public StreamBlockingQueueWrapper allMarketTickersStreams( + AllMarketTickersStreamsRequest allMarketTickersStreamsRequest) throws ApiException { + StreamBlockingQueue queue = + allMarketTickersStreamsRaw(allMarketTickersStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue allMarketTickersStreamsRaw( + AllMarketTickersStreamsRequest allMarketTickersStreamsRequest) throws ApiException { + allMarketTickersStreamsValidateBeforeCall(allMarketTickersStreamsRequest); + + String methodName = + "/!ticker@arr" + .substring(1) + .replace( + "", + allMarketTickersStreamsRequest.getId() != null + ? allMarketTickersStreamsRequest.getId().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void allMarketTickersStreamsValidateBeforeCall( + AllMarketTickersStreamsRequest allMarketTickersStreamsRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(allMarketTickersStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Composite Index Symbol Information Streams Composite index information for index symbols + * pushed every second. Update Speed: 1000ms + * + * @param compositeIndexSymbolInformationStreamsRequest (required) + * @return CompositeIndexSymbolInformationStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Composite Index Symbol Information Streams -
+ * + * @see Composite + * Index Symbol Information Streams Documentation + */ + public StreamBlockingQueueWrapper + compositeIndexSymbolInformationStreams( + CompositeIndexSymbolInformationStreamsRequest + compositeIndexSymbolInformationStreamsRequest) + throws ApiException { + StreamBlockingQueue queue = + compositeIndexSymbolInformationStreamsRaw( + compositeIndexSymbolInformationStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue compositeIndexSymbolInformationStreamsRaw( + CompositeIndexSymbolInformationStreamsRequest + compositeIndexSymbolInformationStreamsRequest) + throws ApiException { + compositeIndexSymbolInformationStreamsValidateBeforeCall( + compositeIndexSymbolInformationStreamsRequest); + + String methodName = + "/@compositeIndex" + .substring(1) + .replace( + "", + compositeIndexSymbolInformationStreamsRequest.getId() != null + ? compositeIndexSymbolInformationStreamsRequest + .getId() + .toString() + : "") + .replace( + "", + compositeIndexSymbolInformationStreamsRequest.getSymbol() != null + ? compositeIndexSymbolInformationStreamsRequest + .getSymbol() + .toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void compositeIndexSymbolInformationStreamsValidateBeforeCall( + CompositeIndexSymbolInformationStreamsRequest + compositeIndexSymbolInformationStreamsRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(compositeIndexSymbolInformationStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Continuous Contract Kline/Candlestick Streams Update Speed: 250ms + * + * @param continuousContractKlineCandlestickStreamsRequest (required) + * @return ContinuousContractKlineCandlestickStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Continuous Contract Kline/Candlestick Streams -
+ * + * @see Continuous + * Contract Kline/Candlestick Streams Documentation + */ + public StreamBlockingQueueWrapper + continuousContractKlineCandlestickStreams( + ContinuousContractKlineCandlestickStreamsRequest + continuousContractKlineCandlestickStreamsRequest) + throws ApiException { + StreamBlockingQueue queue = + continuousContractKlineCandlestickStreamsRaw( + continuousContractKlineCandlestickStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue continuousContractKlineCandlestickStreamsRaw( + ContinuousContractKlineCandlestickStreamsRequest + continuousContractKlineCandlestickStreamsRequest) + throws ApiException { + continuousContractKlineCandlestickStreamsValidateBeforeCall( + continuousContractKlineCandlestickStreamsRequest); + + String methodName = + "/_@continuousKline_" + .substring(1) + .replace( + "", + continuousContractKlineCandlestickStreamsRequest.getId() != null + ? continuousContractKlineCandlestickStreamsRequest + .getId() + .toString() + : "") + .replace( + "", + continuousContractKlineCandlestickStreamsRequest.getPair() != null + ? continuousContractKlineCandlestickStreamsRequest + .getPair() + .toString() + : "") + .replace( + "", + continuousContractKlineCandlestickStreamsRequest.getContractType() + != null + ? continuousContractKlineCandlestickStreamsRequest + .getContractType() + .toString() + : "") + .replace( + "", + continuousContractKlineCandlestickStreamsRequest.getInterval() + != null + ? continuousContractKlineCandlestickStreamsRequest + .getInterval() + .toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void continuousContractKlineCandlestickStreamsValidateBeforeCall( + ContinuousContractKlineCandlestickStreamsRequest + continuousContractKlineCandlestickStreamsRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(continuousContractKlineCandlestickStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Contract Info Stream ContractInfo stream pushes when contract info + * updates(listing/settlement/contract bracket update). `bks` field only shows up when + * bracket gets updated. Update Speed: Real-time + * + * @param contractInfoStreamRequest (required) + * @return ContractInfoStreamResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Contract Info Stream -
+ * + * @see Contract + * Info Stream Documentation + */ + public StreamBlockingQueueWrapper contractInfoStream( + ContractInfoStreamRequest contractInfoStreamRequest) throws ApiException { + StreamBlockingQueue queue = contractInfoStreamRaw(contractInfoStreamRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue contractInfoStreamRaw( + ContractInfoStreamRequest contractInfoStreamRequest) throws ApiException { + contractInfoStreamValidateBeforeCall(contractInfoStreamRequest); + + String methodName = + "/!contractInfo" + .substring(1) + .replace( + "", + contractInfoStreamRequest.getId() != null + ? contractInfoStreamRequest.getId().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void contractInfoStreamValidateBeforeCall( + ContractInfoStreamRequest contractInfoStreamRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(contractInfoStreamRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Individual Symbol Mini Ticker Stream 24hr rolling window mini-ticker statistics for a single + * symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from + * requestTime to 24hrs before. Update Speed: 2s + * + * @param individualSymbolMiniTickerStreamRequest (required) + * @return IndividualSymbolMiniTickerStreamResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Individual Symbol Mini Ticker Stream -
+ * + * @see Individual + * Symbol Mini Ticker Stream Documentation + */ + public StreamBlockingQueueWrapper + individualSymbolMiniTickerStream( + IndividualSymbolMiniTickerStreamRequest individualSymbolMiniTickerStreamRequest) + throws ApiException { + StreamBlockingQueue queue = + individualSymbolMiniTickerStreamRaw(individualSymbolMiniTickerStreamRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue individualSymbolMiniTickerStreamRaw( + IndividualSymbolMiniTickerStreamRequest individualSymbolMiniTickerStreamRequest) + throws ApiException { + individualSymbolMiniTickerStreamValidateBeforeCall(individualSymbolMiniTickerStreamRequest); + + String methodName = + "/@miniTicker" + .substring(1) + .replace( + "", + individualSymbolMiniTickerStreamRequest.getId() != null + ? individualSymbolMiniTickerStreamRequest.getId().toString() + : "") + .replace( + "", + individualSymbolMiniTickerStreamRequest.getSymbol() != null + ? individualSymbolMiniTickerStreamRequest + .getSymbol() + .toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void individualSymbolMiniTickerStreamValidateBeforeCall( + IndividualSymbolMiniTickerStreamRequest individualSymbolMiniTickerStreamRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(individualSymbolMiniTickerStreamRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Individual Symbol Ticker Streams 24hr rolling window ticker statistics for a single symbol. + * These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to + * 24hrs before. Update Speed: 2000ms + * + * @param individualSymbolTickerStreamsRequest (required) + * @return IndividualSymbolTickerStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Individual Symbol Ticker Streams -
+ * + * @see Individual + * Symbol Ticker Streams Documentation + */ + public StreamBlockingQueueWrapper + individualSymbolTickerStreams( + IndividualSymbolTickerStreamsRequest individualSymbolTickerStreamsRequest) + throws ApiException { + StreamBlockingQueue queue = + individualSymbolTickerStreamsRaw(individualSymbolTickerStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue individualSymbolTickerStreamsRaw( + IndividualSymbolTickerStreamsRequest individualSymbolTickerStreamsRequest) + throws ApiException { + individualSymbolTickerStreamsValidateBeforeCall(individualSymbolTickerStreamsRequest); + + String methodName = + "/@ticker" + .substring(1) + .replace( + "", + individualSymbolTickerStreamsRequest.getId() != null + ? individualSymbolTickerStreamsRequest.getId().toString() + : "") + .replace( + "", + individualSymbolTickerStreamsRequest.getSymbol() != null + ? individualSymbolTickerStreamsRequest + .getSymbol() + .toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void individualSymbolTickerStreamsValidateBeforeCall( + IndividualSymbolTickerStreamsRequest individualSymbolTickerStreamsRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(individualSymbolTickerStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Kline/Candlestick Streams The Kline/Candlestick Stream push updates to the current + * klines/candlestick every 250 milliseconds (if existing). Update Speed: 250ms + * + * @param klineCandlestickStreamsRequest (required) + * @return KlineCandlestickStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Kline/Candlestick Streams -
+ * + * @see Kline/Candlestick + * Streams Documentation + */ + public StreamBlockingQueueWrapper klineCandlestickStreams( + KlineCandlestickStreamsRequest klineCandlestickStreamsRequest) throws ApiException { + StreamBlockingQueue queue = + klineCandlestickStreamsRaw(klineCandlestickStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue klineCandlestickStreamsRaw( + KlineCandlestickStreamsRequest klineCandlestickStreamsRequest) throws ApiException { + klineCandlestickStreamsValidateBeforeCall(klineCandlestickStreamsRequest); + + String methodName = + "/@kline_" + .substring(1) + .replace( + "", + klineCandlestickStreamsRequest.getId() != null + ? klineCandlestickStreamsRequest.getId().toString() + : "") + .replace( + "", + klineCandlestickStreamsRequest.getSymbol() != null + ? klineCandlestickStreamsRequest.getSymbol().toString() + : "") + .replace( + "", + klineCandlestickStreamsRequest.getInterval() != null + ? klineCandlestickStreamsRequest.getInterval().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void klineCandlestickStreamsValidateBeforeCall( + KlineCandlestickStreamsRequest klineCandlestickStreamsRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(klineCandlestickStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Liquidation Order Streams The Liquidation Order Snapshot Streams push force liquidation order + * information for specific symbol. For each symbol,only the latest one liquidation order within + * 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, + * no stream will be pushed. Update Speed: 1000ms + * + * @param liquidationOrderStreamsRequest (required) + * @return LiquidationOrderStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Liquidation Order Streams -
+ * + * @see Liquidation + * Order Streams Documentation + */ + public StreamBlockingQueueWrapper liquidationOrderStreams( + LiquidationOrderStreamsRequest liquidationOrderStreamsRequest) throws ApiException { + StreamBlockingQueue queue = + liquidationOrderStreamsRaw(liquidationOrderStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue liquidationOrderStreamsRaw( + LiquidationOrderStreamsRequest liquidationOrderStreamsRequest) throws ApiException { + liquidationOrderStreamsValidateBeforeCall(liquidationOrderStreamsRequest); + + String methodName = + "/@forceOrder" + .substring(1) + .replace( + "", + liquidationOrderStreamsRequest.getId() != null + ? liquidationOrderStreamsRequest.getId().toString() + : "") + .replace( + "", + liquidationOrderStreamsRequest.getSymbol() != null + ? liquidationOrderStreamsRequest.getSymbol().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void liquidationOrderStreamsValidateBeforeCall( + LiquidationOrderStreamsRequest liquidationOrderStreamsRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(liquidationOrderStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Mark Price Stream Mark price and funding rate for a single symbol pushed every 3 seconds or + * every second. Update Speed: 3000ms or 1000ms + * + * @param markPriceStreamRequest (required) + * @return MarkPriceStreamResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Mark Price Stream -
+ * + * @see Mark + * Price Stream Documentation + */ + public StreamBlockingQueueWrapper markPriceStream( + MarkPriceStreamRequest markPriceStreamRequest) throws ApiException { + StreamBlockingQueue queue = markPriceStreamRaw(markPriceStreamRequest); + + TypeToken typeToken = new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue markPriceStreamRaw( + MarkPriceStreamRequest markPriceStreamRequest) throws ApiException { + markPriceStreamValidateBeforeCall(markPriceStreamRequest); + + String methodName = + "/@markPrice@" + .substring(1) + .replace( + "", + markPriceStreamRequest.getId() != null + ? markPriceStreamRequest.getId().toString() + : "") + .replace( + "", + markPriceStreamRequest.getSymbol() != null + ? markPriceStreamRequest.getSymbol().toString() + : "") + .replace( + "", + markPriceStreamRequest.getUpdateSpeed() != null + ? markPriceStreamRequest.getUpdateSpeed().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void markPriceStreamValidateBeforeCall(MarkPriceStreamRequest markPriceStreamRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(markPriceStreamRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Mark Price Stream for All market Mark price and funding rate for all symbols pushed every 3 + * seconds or every second. **Note**: TradFi symbols will be pushed through a seperate message. + * Update Speed: 3000ms or 1000ms + * + * @param markPriceStreamForAllMarketRequest (required) + * @return MarkPriceStreamForAllMarketResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Mark Price Stream for All market -
+ * + * @see Mark + * Price Stream for All market Documentation + */ + public StreamBlockingQueueWrapper + markPriceStreamForAllMarket( + MarkPriceStreamForAllMarketRequest markPriceStreamForAllMarketRequest) + throws ApiException { + StreamBlockingQueue queue = + markPriceStreamForAllMarketRaw(markPriceStreamForAllMarketRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue markPriceStreamForAllMarketRaw( + MarkPriceStreamForAllMarketRequest markPriceStreamForAllMarketRequest) + throws ApiException { + markPriceStreamForAllMarketValidateBeforeCall(markPriceStreamForAllMarketRequest); + + String methodName = + "/!markPrice@arr@" + .substring(1) + .replace( + "", + markPriceStreamForAllMarketRequest.getId() != null + ? markPriceStreamForAllMarketRequest.getId().toString() + : "") + .replace( + "", + markPriceStreamForAllMarketRequest.getUpdateSpeed() != null + ? markPriceStreamForAllMarketRequest + .getUpdateSpeed() + .toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void markPriceStreamForAllMarketValidateBeforeCall( + MarkPriceStreamForAllMarketRequest markPriceStreamForAllMarketRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(markPriceStreamForAllMarketRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Multi-Assets Mode Asset Index Asset index for multi-assets mode user Update Speed: 1s + * + * @param multiAssetsModeAssetIndexRequest (required) + * @return MultiAssetsModeAssetIndexResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Multi-Assets Mode Asset Index -
+ * + * @see Multi-Assets + * Mode Asset Index Documentation + */ + public StreamBlockingQueueWrapper multiAssetsModeAssetIndex( + MultiAssetsModeAssetIndexRequest multiAssetsModeAssetIndexRequest) throws ApiException { + StreamBlockingQueue queue = + multiAssetsModeAssetIndexRaw(multiAssetsModeAssetIndexRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue multiAssetsModeAssetIndexRaw( + MultiAssetsModeAssetIndexRequest multiAssetsModeAssetIndexRequest) throws ApiException { + multiAssetsModeAssetIndexValidateBeforeCall(multiAssetsModeAssetIndexRequest); + + String methodName = + "/!assetIndex@arr" + .substring(1) + .replace( + "", + multiAssetsModeAssetIndexRequest.getId() != null + ? multiAssetsModeAssetIndexRequest.getId().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void multiAssetsModeAssetIndexValidateBeforeCall( + MultiAssetsModeAssetIndexRequest multiAssetsModeAssetIndexRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(multiAssetsModeAssetIndexRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Trading Session Stream Trading session information for the underlying assets of TradFi + * Perpetual contracts—covering the U.S. equity market and the commodity market—is updated every + * second. Trading session information for different underlying markets is pushed in separate + * messages. Session types for the equity market include \"PRE_MARKET\", + * \"REGULAR\", \"AFTER_MARKET\", \"OVERNIGHT\", and + * \"NO_TRADING\". Session types for the commodity market include + * \"REGULAR\" and \"NO_TRADING\". Update Speed: 1s + * + * @param tradingSessionStreamRequest (required) + * @return TradingSessionStreamResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Trading Session Stream -
+ * + * @see Trading + * Session Stream Documentation + */ + public StreamBlockingQueueWrapper tradingSessionStream( + TradingSessionStreamRequest tradingSessionStreamRequest) throws ApiException { + StreamBlockingQueue queue = tradingSessionStreamRaw(tradingSessionStreamRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue tradingSessionStreamRaw( + TradingSessionStreamRequest tradingSessionStreamRequest) throws ApiException { + tradingSessionStreamValidateBeforeCall(tradingSessionStreamRequest); + + String methodName = + "/tradingSession" + .substring(1) + .replace( + "", + tradingSessionStreamRequest.getId() != null + ? tradingSessionStreamRequest.getId().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void tradingSessionStreamValidateBeforeCall( + TradingSessionStreamRequest tradingSessionStreamRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(tradingSessionStreamRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public String getRequestID() { + return UUID.randomUUID().toString(); + } +} diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/PublicApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/PublicApi.java new file mode 100644 index 000000000..e3206077a --- /dev/null +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/PublicApi.java @@ -0,0 +1,525 @@ +/* + * Binance Derivatives Trading USDS Futures WebSocket Market Streams + * OpenAPI Specification for the Binance Derivatives Trading USDS Futures WebSocket Market Streams + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.SystemUtil; +import com.binance.connector.client.common.exception.ConstraintViolationException; +import com.binance.connector.client.common.websocket.adapter.stream.StreamConnectionInterface; +import com.binance.connector.client.common.websocket.adapter.stream.StreamConnectionPoolWrapper; +import com.binance.connector.client.common.websocket.adapter.stream.StreamConnectionWrapper; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.dtos.RequestWrapperDTO; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueue; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.JSON; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllBookTickersStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllBookTickersStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.DiffBookDepthStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.DiffBookDepthStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolBookTickerStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolBookTickerStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.PartialBookDepthStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.PartialBookDepthStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.RpiDiffBookDepthStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.RpiDiffBookDepthStreamsResponse; +import com.google.gson.reflect.TypeToken; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.constraints.*; +import java.util.Collections; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator; + +public class PublicApi { + private static final String USER_AGENT = + String.format( + "binance-derivatives-trading-usds-futures/10.0.0 (Java/%s; %s; %s)", + SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); + + private StreamConnectionInterface connection; + + public PublicApi() {} + + public PublicApi(WebSocketClientConfiguration configuration) { + this( + configuration.getUsePool() + ? new StreamConnectionPoolWrapper(configuration, JSON.getGson()) + : new StreamConnectionWrapper(configuration, JSON.getGson())); + } + + public PublicApi(StreamConnectionInterface connection) { + connection.setUserAgent(USER_AGENT); + if (!connection.isConnected()) { + connection.connect(); + } + this.connection = connection; + } + + /** + * All Book Tickers Stream Pushes any update to the best bid or ask's price or quantity in + * real-time for all symbols. Retail Price Improvement(RPI) orders are not visible and excluded + * in the response message. Update Speed: 5s + * + * @param allBookTickersStreamRequest (required) + * @return AllBookTickersStreamResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 All Book Tickers Stream -
+ * + * @see All + * Book Tickers Stream Documentation + */ + public StreamBlockingQueueWrapper allBookTickersStream( + AllBookTickersStreamRequest allBookTickersStreamRequest) throws ApiException { + StreamBlockingQueue queue = allBookTickersStreamRaw(allBookTickersStreamRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue allBookTickersStreamRaw( + AllBookTickersStreamRequest allBookTickersStreamRequest) throws ApiException { + allBookTickersStreamValidateBeforeCall(allBookTickersStreamRequest); + + String methodName = + "/!bookTicker" + .substring(1) + .replace( + "", + allBookTickersStreamRequest.getId() != null + ? allBookTickersStreamRequest.getId().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void allBookTickersStreamValidateBeforeCall( + AllBookTickersStreamRequest allBookTickersStreamRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(allBookTickersStreamRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Diff. Book Depth Streams Bids and asks, pushed every 250 milliseconds, 500 milliseconds, 100 + * milliseconds (if existing) Retail Price Improvement(RPI) orders are not visible and excluded + * in the response message. Update Speed: 250ms, 500ms, 100ms + * + * @param diffBookDepthStreamsRequest (required) + * @return DiffBookDepthStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Diff. Book Depth Streams -
+ * + * @see Diff. + * Book Depth Streams Documentation + */ + public StreamBlockingQueueWrapper diffBookDepthStreams( + DiffBookDepthStreamsRequest diffBookDepthStreamsRequest) throws ApiException { + StreamBlockingQueue queue = diffBookDepthStreamsRaw(diffBookDepthStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue diffBookDepthStreamsRaw( + DiffBookDepthStreamsRequest diffBookDepthStreamsRequest) throws ApiException { + diffBookDepthStreamsValidateBeforeCall(diffBookDepthStreamsRequest); + + String methodName = + "/@depth@" + .substring(1) + .replace( + "", + diffBookDepthStreamsRequest.getId() != null + ? diffBookDepthStreamsRequest.getId().toString() + : "") + .replace( + "", + diffBookDepthStreamsRequest.getSymbol() != null + ? diffBookDepthStreamsRequest.getSymbol().toString() + : "") + .replace( + "", + diffBookDepthStreamsRequest.getUpdateSpeed() != null + ? diffBookDepthStreamsRequest.getUpdateSpeed().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void diffBookDepthStreamsValidateBeforeCall( + DiffBookDepthStreamsRequest diffBookDepthStreamsRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(diffBookDepthStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Individual Symbol Book Ticker Streams Pushes any update to the best bid or ask's price or + * quantity in real-time for a specified symbol. Retail Price Improvement(RPI) orders are not + * visible and excluded in the response message. Update Speed: Real-time + * + * @param individualSymbolBookTickerStreamsRequest (required) + * @return IndividualSymbolBookTickerStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Individual Symbol Book Ticker Streams -
+ * + * @see Individual + * Symbol Book Ticker Streams Documentation + */ + public StreamBlockingQueueWrapper + individualSymbolBookTickerStreams( + IndividualSymbolBookTickerStreamsRequest + individualSymbolBookTickerStreamsRequest) + throws ApiException { + StreamBlockingQueue queue = + individualSymbolBookTickerStreamsRaw(individualSymbolBookTickerStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue individualSymbolBookTickerStreamsRaw( + IndividualSymbolBookTickerStreamsRequest individualSymbolBookTickerStreamsRequest) + throws ApiException { + individualSymbolBookTickerStreamsValidateBeforeCall( + individualSymbolBookTickerStreamsRequest); + + String methodName = + "/@bookTicker" + .substring(1) + .replace( + "", + individualSymbolBookTickerStreamsRequest.getId() != null + ? individualSymbolBookTickerStreamsRequest + .getId() + .toString() + : "") + .replace( + "", + individualSymbolBookTickerStreamsRequest.getSymbol() != null + ? individualSymbolBookTickerStreamsRequest + .getSymbol() + .toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void individualSymbolBookTickerStreamsValidateBeforeCall( + IndividualSymbolBookTickerStreamsRequest individualSymbolBookTickerStreamsRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(individualSymbolBookTickerStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Partial Book Depth Streams Top **<levels\\>** bids and asks, Valid **<levels\\>** + * are 5, 10, or 20. Retail Price Improvement(RPI) orders are not visible and excluded in the + * response message. Update Speed: 250ms, 500ms or 100ms + * + * @param partialBookDepthStreamsRequest (required) + * @return PartialBookDepthStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Partial Book Depth Streams -
+ * + * @see Partial + * Book Depth Streams Documentation + */ + public StreamBlockingQueueWrapper partialBookDepthStreams( + PartialBookDepthStreamsRequest partialBookDepthStreamsRequest) throws ApiException { + StreamBlockingQueue queue = + partialBookDepthStreamsRaw(partialBookDepthStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue partialBookDepthStreamsRaw( + PartialBookDepthStreamsRequest partialBookDepthStreamsRequest) throws ApiException { + partialBookDepthStreamsValidateBeforeCall(partialBookDepthStreamsRequest); + + String methodName = + "/@depth@" + .substring(1) + .replace( + "", + partialBookDepthStreamsRequest.getId() != null + ? partialBookDepthStreamsRequest.getId().toString() + : "") + .replace( + "", + partialBookDepthStreamsRequest.getSymbol() != null + ? partialBookDepthStreamsRequest.getSymbol().toString() + : "") + .replace( + "", + partialBookDepthStreamsRequest.getLevels() != null + ? partialBookDepthStreamsRequest.getLevels().toString() + : "") + .replace( + "", + partialBookDepthStreamsRequest.getUpdateSpeed() != null + ? partialBookDepthStreamsRequest.getUpdateSpeed().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void partialBookDepthStreamsValidateBeforeCall( + PartialBookDepthStreamsRequest partialBookDepthStreamsRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(partialBookDepthStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * RPI Diff. Book Depth Streams Bids and asks including RPI orders, pushed every 500 + * milliseconds RPI(Retail Price Improvement) orders are included and aggreated in the response + * message. When the quantity of a price level to be updated is equal to 0, it means either all + * quotations for this price have been filled/canceled, or the quantity of crossed RPI orders + * for this price are hidden Update Speed: 500ms + * + * @param rpiDiffBookDepthStreamsRequest (required) + * @return RpiDiffBookDepthStreamsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 RPI Diff. Book Depth Streams -
+ * + * @see RPI + * Diff. Book Depth Streams Documentation + */ + public StreamBlockingQueueWrapper rpiDiffBookDepthStreams( + RpiDiffBookDepthStreamsRequest rpiDiffBookDepthStreamsRequest) throws ApiException { + StreamBlockingQueue queue = + rpiDiffBookDepthStreamsRaw(rpiDiffBookDepthStreamsRequest); + + TypeToken typeToken = + new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue rpiDiffBookDepthStreamsRaw( + RpiDiffBookDepthStreamsRequest rpiDiffBookDepthStreamsRequest) throws ApiException { + rpiDiffBookDepthStreamsValidateBeforeCall(rpiDiffBookDepthStreamsRequest); + + String methodName = + "/@rpiDepth@500ms" + .substring(1) + .replace( + "", + rpiDiffBookDepthStreamsRequest.getId() != null + ? rpiDiffBookDepthStreamsRequest.getId().toString() + : "") + .replace( + "", + rpiDiffBookDepthStreamsRequest.getSymbol() != null + ? rpiDiffBookDepthStreamsRequest.getSymbol().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void rpiDiffBookDepthStreamsValidateBeforeCall( + RpiDiffBookDepthStreamsRequest rpiDiffBookDepthStreamsRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(rpiDiffBookDepthStreamsRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + public String getRequestID() { + return UUID.randomUUID().toString(); + } +} diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/MarkPriceStreamForAllMarketResponseInner.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/MarkPriceStreamForAllMarketResponseInner.java index 226cc236a..5c5ff09ec 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/MarkPriceStreamForAllMarketResponseInner.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/MarkPriceStreamForAllMarketResponseInner.java @@ -63,6 +63,12 @@ public class MarkPriceStreamForAllMarketResponseInner extends BaseDTO { @jakarta.annotation.Nullable private String pLowerCase; + public static final String SERIALIZED_NAME_AP = "ap"; + + @SerializedName(SERIALIZED_NAME_AP) + @jakarta.annotation.Nullable + private String ap; + public static final String SERIALIZED_NAME_I_LOWER_CASE = "i"; @SerializedName(SERIALIZED_NAME_I_LOWER_CASE) @@ -168,6 +174,25 @@ public void setpLowerCase(@jakarta.annotation.Nullable String pLowerCase) { this.pLowerCase = pLowerCase; } + public MarkPriceStreamForAllMarketResponseInner ap(@jakarta.annotation.Nullable String ap) { + this.ap = ap; + return this; + } + + /** + * Get ap + * + * @return ap + */ + @jakarta.annotation.Nullable + public String getAp() { + return ap; + } + + public void setAp(@jakarta.annotation.Nullable String ap) { + this.ap = ap; + } + public MarkPriceStreamForAllMarketResponseInner iLowerCase( @jakarta.annotation.Nullable String iLowerCase) { this.iLowerCase = iLowerCase; @@ -262,6 +287,7 @@ public boolean equals(Object o) { this.sLowerCase, markPriceStreamForAllMarketResponseInner.sLowerCase) && Objects.equals( this.pLowerCase, markPriceStreamForAllMarketResponseInner.pLowerCase) + && Objects.equals(this.ap, markPriceStreamForAllMarketResponseInner.ap) && Objects.equals( this.iLowerCase, markPriceStreamForAllMarketResponseInner.iLowerCase) && Objects.equals(this.P, markPriceStreamForAllMarketResponseInner.P) @@ -272,7 +298,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(eLowerCase, E, sLowerCase, pLowerCase, iLowerCase, P, rLowerCase, T); + return Objects.hash( + eLowerCase, E, sLowerCase, pLowerCase, ap, iLowerCase, P, rLowerCase, T); } @Override @@ -283,6 +310,7 @@ public String toString() { sb.append(" E: ").append(toIndentedString(E)).append("\n"); sb.append(" sLowerCase: ").append(toIndentedString(sLowerCase)).append("\n"); sb.append(" pLowerCase: ").append(toIndentedString(pLowerCase)).append("\n"); + sb.append(" ap: ").append(toIndentedString(ap)).append("\n"); sb.append(" iLowerCase: ").append(toIndentedString(iLowerCase)).append("\n"); sb.append(" P: ").append(toIndentedString(P)).append("\n"); sb.append(" rLowerCase: ").append(toIndentedString(rLowerCase)).append("\n"); @@ -315,6 +343,11 @@ public String toUrlQueryString() { String pLowerCaseValueAsString = pLowerCaseValue.toString(); valMap.put("pLowerCase", pLowerCaseValueAsString); } + String apValue = getAp(); + if (apValue != null) { + String apValueAsString = apValue.toString(); + valMap.put("ap", apValueAsString); + } String iLowerCaseValue = getiLowerCase(); if (iLowerCaseValue != null) { String iLowerCaseValueAsString = iLowerCaseValue.toString(); @@ -362,6 +395,10 @@ public Map toMap() { if (pLowerCaseValue != null) { valMap.put("pLowerCase", pLowerCaseValue); } + Object apValue = getAp(); + if (apValue != null) { + valMap.put("ap", apValue); + } Object iLowerCaseValue = getiLowerCase(); if (iLowerCaseValue != null) { valMap.put("iLowerCase", iLowerCaseValue); @@ -408,6 +445,7 @@ private String toIndentedString(Object o) { openapiFields.add("E"); openapiFields.add("s"); openapiFields.add("p"); + openapiFields.add("ap"); openapiFields.add("i"); openapiFields.add("P"); openapiFields.add("r"); @@ -475,6 +513,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti + " got `%s`", jsonObj.get("p").toString())); } + if ((jsonObj.get("ap") != null && !jsonObj.get("ap").isJsonNull()) + && !jsonObj.get("ap").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `ap` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("ap").toString())); + } if ((jsonObj.get("i") != null && !jsonObj.get("i").isJsonNull()) && !jsonObj.get("i").isJsonPrimitive()) { throw new IllegalArgumentException( diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/MarkPriceStreamResponse.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/MarkPriceStreamResponse.java index e9eea3b8e..ec3e7cd8b 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/MarkPriceStreamResponse.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/MarkPriceStreamResponse.java @@ -63,6 +63,12 @@ public class MarkPriceStreamResponse extends BaseDTO { @jakarta.annotation.Nullable private String pLowerCase; + public static final String SERIALIZED_NAME_AP = "ap"; + + @SerializedName(SERIALIZED_NAME_AP) + @jakarta.annotation.Nullable + private String ap; + public static final String SERIALIZED_NAME_I_LOWER_CASE = "i"; @SerializedName(SERIALIZED_NAME_I_LOWER_CASE) @@ -165,6 +171,25 @@ public void setpLowerCase(@jakarta.annotation.Nullable String pLowerCase) { this.pLowerCase = pLowerCase; } + public MarkPriceStreamResponse ap(@jakarta.annotation.Nullable String ap) { + this.ap = ap; + return this; + } + + /** + * Get ap + * + * @return ap + */ + @jakarta.annotation.Nullable + public String getAp() { + return ap; + } + + public void setAp(@jakarta.annotation.Nullable String ap) { + this.ap = ap; + } + public MarkPriceStreamResponse iLowerCase(@jakarta.annotation.Nullable String iLowerCase) { this.iLowerCase = iLowerCase; return this; @@ -254,6 +279,7 @@ public boolean equals(Object o) { && Objects.equals(this.E, markPriceStreamResponse.E) && Objects.equals(this.sLowerCase, markPriceStreamResponse.sLowerCase) && Objects.equals(this.pLowerCase, markPriceStreamResponse.pLowerCase) + && Objects.equals(this.ap, markPriceStreamResponse.ap) && Objects.equals(this.iLowerCase, markPriceStreamResponse.iLowerCase) && Objects.equals(this.P, markPriceStreamResponse.P) && Objects.equals(this.rLowerCase, markPriceStreamResponse.rLowerCase) @@ -262,7 +288,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(eLowerCase, E, sLowerCase, pLowerCase, iLowerCase, P, rLowerCase, T); + return Objects.hash( + eLowerCase, E, sLowerCase, pLowerCase, ap, iLowerCase, P, rLowerCase, T); } @Override @@ -273,6 +300,7 @@ public String toString() { sb.append(" E: ").append(toIndentedString(E)).append("\n"); sb.append(" sLowerCase: ").append(toIndentedString(sLowerCase)).append("\n"); sb.append(" pLowerCase: ").append(toIndentedString(pLowerCase)).append("\n"); + sb.append(" ap: ").append(toIndentedString(ap)).append("\n"); sb.append(" iLowerCase: ").append(toIndentedString(iLowerCase)).append("\n"); sb.append(" P: ").append(toIndentedString(P)).append("\n"); sb.append(" rLowerCase: ").append(toIndentedString(rLowerCase)).append("\n"); @@ -305,6 +333,11 @@ public String toUrlQueryString() { String pLowerCaseValueAsString = pLowerCaseValue.toString(); valMap.put("pLowerCase", pLowerCaseValueAsString); } + String apValue = getAp(); + if (apValue != null) { + String apValueAsString = apValue.toString(); + valMap.put("ap", apValueAsString); + } String iLowerCaseValue = getiLowerCase(); if (iLowerCaseValue != null) { String iLowerCaseValueAsString = iLowerCaseValue.toString(); @@ -352,6 +385,10 @@ public Map toMap() { if (pLowerCaseValue != null) { valMap.put("pLowerCase", pLowerCaseValue); } + Object apValue = getAp(); + if (apValue != null) { + valMap.put("ap", apValue); + } Object iLowerCaseValue = getiLowerCase(); if (iLowerCaseValue != null) { valMap.put("iLowerCase", iLowerCaseValue); @@ -398,6 +435,7 @@ private String toIndentedString(Object o) { openapiFields.add("E"); openapiFields.add("s"); openapiFields.add("p"); + openapiFields.add("ap"); openapiFields.add("i"); openapiFields.add("P"); openapiFields.add("r"); @@ -461,6 +499,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti + " got `%s`", jsonObj.get("p").toString())); } + if ((jsonObj.get("ap") != null && !jsonObj.get("ap").isJsonNull()) + && !jsonObj.get("ap").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `ap` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("ap").toString())); + } if ((jsonObj.get("i") != null && !jsonObj.get("i").isJsonNull()) && !jsonObj.get("i").isJsonPrimitive()) { throw new IllegalArgumentException( diff --git a/clients/derivatives-trading-usds-futures/src/test/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/MarketApiTest.java b/clients/derivatives-trading-usds-futures/src/test/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/MarketApiTest.java new file mode 100644 index 000000000..6465b3693 --- /dev/null +++ b/clients/derivatives-trading-usds-futures/src/test/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/MarketApiTest.java @@ -0,0 +1,633 @@ +/* + * Binance Derivatives Trading USDS Futures WebSocket Market Streams + * OpenAPI Specification for the Binance Derivatives Trading USDS Futures WebSocket Market Streams + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.common.websocket.adapter.stream.StreamConnectionWrapper; + +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.dtos.RequestWrapperDTO; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AggregateTradeStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AggregateTradeStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllBookTickersStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllBookTickersStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketLiquidationOrderStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketLiquidationOrderStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketMiniTickersStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketMiniTickersStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketTickersStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketTickersStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.CompositeIndexSymbolInformationStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.CompositeIndexSymbolInformationStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContinuousContractKlineCandlestickStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContinuousContractKlineCandlestickStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContractInfoStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContractInfoStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.DiffBookDepthStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.DiffBookDepthStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolBookTickerStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolBookTickerStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolMiniTickerStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolMiniTickerStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolTickerStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolTickerStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.KlineCandlestickStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.KlineCandlestickStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.LiquidationOrderStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.LiquidationOrderStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamForAllMarketRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamForAllMarketResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MultiAssetsModeAssetIndexRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MultiAssetsModeAssetIndexResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.PartialBookDepthStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.PartialBookDepthStreamsResponse; +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Set; +import java.util.concurrent.CompletableFuture; + +import org.eclipse.jetty.websocket.api.RemoteEndpoint; +import org.eclipse.jetty.websocket.api.Session; +import org.eclipse.jetty.websocket.client.WebSocketClient; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import org.skyscreamer.jsonassert.JSONAssert; + +/** API tests for MarketApi */ +public class MarketApiTest { + + private MarketApi api; + private StreamConnectionWrapper connectionSpy; + private Session sessionMock; + + @BeforeEach + public void initApiClient() throws Exception { + URL resource = MarketApi.class.getResource("/test-ed25519-prv-key.pem"); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + File file = new File(resource.toURI()); + signatureConfiguration.setPrivateKey(file.getAbsolutePath()); + WebSocketClientConfiguration clientConfiguration = new WebSocketClientConfiguration(); + // @TODO: run tests for LOGON as well + clientConfiguration.setAutoLogon(false); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + clientConfiguration.setUrl("wss://localhost:8080"); + + WebSocketClient webSocketClient = Mockito.mock(WebSocketClient.class); + CompletableFuture sessionCompletableFuture = new CompletableFuture<>(); + Mockito.doReturn(sessionCompletableFuture) + .when(webSocketClient) + .connect(Mockito.any(), Mockito.any(), Mockito.any()); + sessionMock = Mockito.mock(Session.class); + + RemoteEndpoint remoteEndpointMock = Mockito.mock(RemoteEndpoint.class); + Mockito.doReturn(remoteEndpointMock).when(sessionMock).getRemote(); + + sessionCompletableFuture.complete(sessionMock); + StreamConnectionWrapper connectionWrapper = + new StreamConnectionWrapper(clientConfiguration, webSocketClient); + connectionSpy = Mockito.spy(connectionWrapper); + Mockito.doNothing().when(connectionSpy).setUserAgent(Mockito.anyString()); + Mockito.doReturn(1736393892000L).when(connectionSpy).getTimestamp(); + connectionSpy.connect(); + MarketApi accountApi = new MarketApi(connectionSpy); + api = Mockito.spy(accountApi); + Mockito.doReturn("eaf3292c-64b6-4c04-ad4f-4ca2608b42b4").when(api).getRequestID(); + } + + /** + * Aggregate Trade Streams + * + *

The Aggregate Trade Streams push market trade information that is aggregated for fills + * with same price and taking side every 100 milliseconds. Only market trades will be + * aggregated, which means the insurance fund trades and ADL trades won't be aggregated. + * Update Speed: 100ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void aggregateTradeStreamsTest() throws ApiException, URISyntaxException, IOException { + AggregateTradeStreamsRequest aggregateTradeStreamsRequest = + new AggregateTradeStreamsRequest(); + + aggregateTradeStreamsRequest.symbol("btcusdt"); + + StreamBlockingQueueWrapper response = + api.aggregateTradeStreams(aggregateTradeStreamsRequest); + ArgumentCaptor, AggregateTradeStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, AggregateTradeStreamsResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/symbol@aggTrade-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * All Market Liquidation Order Streams + * + *

The All Liquidation Order Snapshot Streams push force liquidation order information for + * all symbols in the market. For each symbol,only the latest one liquidation order within + * 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, + * no stream will be pushed. Update Speed: 1000ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void allMarketLiquidationOrderStreamsTest() + throws ApiException, URISyntaxException, IOException { + AllMarketLiquidationOrderStreamsRequest allMarketLiquidationOrderStreamsRequest = + new AllMarketLiquidationOrderStreamsRequest(); + + StreamBlockingQueueWrapper response = + api.allMarketLiquidationOrderStreams(allMarketLiquidationOrderStreamsRequest); + ArgumentCaptor, AllMarketLiquidationOrderStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, AllMarketLiquidationOrderStreamsResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/!forceOrder@arr-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * All Market Mini Tickers Stream + * + *

24hr rolling window mini-ticker statistics for all symbols. These are NOT the statistics + * of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only + * tickers that have changed will be present in the array. Update Speed: 1000ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void allMarketMiniTickersStreamTest() + throws ApiException, URISyntaxException, IOException { + AllMarketMiniTickersStreamRequest allMarketMiniTickersStreamRequest = + new AllMarketMiniTickersStreamRequest(); + + StreamBlockingQueueWrapper response = + api.allMarketMiniTickersStream(allMarketMiniTickersStreamRequest); + ArgumentCaptor, AllMarketMiniTickersStreamResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, AllMarketMiniTickersStreamResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/!miniTicker@arr-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * All Market Tickers Streams + * + *

24hr rolling window ticker statistics for all symbols. These are NOT the statistics of the + * UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers + * that have changed will be present in the array. Update Speed: 1000ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void allMarketTickersStreamsTest() throws ApiException, URISyntaxException, IOException { + AllMarketTickersStreamsRequest allMarketTickersStreamsRequest = + new AllMarketTickersStreamsRequest(); + + StreamBlockingQueueWrapper response = + api.allMarketTickersStreams(allMarketTickersStreamsRequest); + ArgumentCaptor, AllMarketTickersStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, AllMarketTickersStreamsResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/!ticker@arr-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Composite Index Symbol Information Streams + * + *

Composite index information for index symbols pushed every second. Update Speed: 1000ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void compositeIndexSymbolInformationStreamsTest() + throws ApiException, URISyntaxException, IOException { + CompositeIndexSymbolInformationStreamsRequest + compositeIndexSymbolInformationStreamsRequest = + new CompositeIndexSymbolInformationStreamsRequest(); + + compositeIndexSymbolInformationStreamsRequest.symbol("btcusdt"); + + StreamBlockingQueueWrapper response = + api.compositeIndexSymbolInformationStreams( + compositeIndexSymbolInformationStreamsRequest); + ArgumentCaptor< + RequestWrapperDTO< + Set, CompositeIndexSymbolInformationStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, CompositeIndexSymbolInformationStreamsResponse> + requestWrapperDTO = callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/symbol@compositeIndex-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Continuous Contract Kline/Candlestick Streams + * + *

Update Speed: 250ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void continuousContractKlineCandlestickStreamsTest() + throws ApiException, URISyntaxException, IOException { + ContinuousContractKlineCandlestickStreamsRequest + continuousContractKlineCandlestickStreamsRequest = + new ContinuousContractKlineCandlestickStreamsRequest(); + + continuousContractKlineCandlestickStreamsRequest.pair("btcusdt"); + continuousContractKlineCandlestickStreamsRequest.contractType("next_quarter"); + continuousContractKlineCandlestickStreamsRequest.interval("1m"); + + StreamBlockingQueueWrapper response = + api.continuousContractKlineCandlestickStreams( + continuousContractKlineCandlestickStreamsRequest); + ArgumentCaptor< + RequestWrapperDTO< + Set, ContinuousContractKlineCandlestickStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, ContinuousContractKlineCandlestickStreamsResponse> + requestWrapperDTO = callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/pair_contractType@continuousKline_interval-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Contract Info Stream + * + *

ContractInfo stream pushes when contract info updates(listing/settlement/contract bracket + * update). `bks` field only shows up when bracket gets updated. Update Speed: + * Real-time + * + * @throws ApiException if the Api call fails + */ + @Test + public void contractInfoStreamTest() throws ApiException, URISyntaxException, IOException { + ContractInfoStreamRequest contractInfoStreamRequest = new ContractInfoStreamRequest(); + + StreamBlockingQueueWrapper response = + api.contractInfoStream(contractInfoStreamRequest); + ArgumentCaptor, ContractInfoStreamResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, ContractInfoStreamResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/!contractInfo-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Individual Symbol Mini Ticker Stream + * + *

24hr rolling window mini-ticker statistics for a single symbol. These are NOT the + * statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Update + * Speed: 2s + * + * @throws ApiException if the Api call fails + */ + @Test + public void individualSymbolMiniTickerStreamTest() + throws ApiException, URISyntaxException, IOException { + IndividualSymbolMiniTickerStreamRequest individualSymbolMiniTickerStreamRequest = + new IndividualSymbolMiniTickerStreamRequest(); + + individualSymbolMiniTickerStreamRequest.symbol("btcusdt"); + + StreamBlockingQueueWrapper response = + api.individualSymbolMiniTickerStream(individualSymbolMiniTickerStreamRequest); + ArgumentCaptor, IndividualSymbolMiniTickerStreamResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, IndividualSymbolMiniTickerStreamResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/symbol@miniTicker-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Individual Symbol Ticker Streams + * + *

24hr rolling window ticker statistics for a single symbol. These are NOT the statistics of + * the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Update Speed: 2000ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void individualSymbolTickerStreamsTest() + throws ApiException, URISyntaxException, IOException { + IndividualSymbolTickerStreamsRequest individualSymbolTickerStreamsRequest = + new IndividualSymbolTickerStreamsRequest(); + + individualSymbolTickerStreamsRequest.symbol("btcusdt"); + + StreamBlockingQueueWrapper response = + api.individualSymbolTickerStreams(individualSymbolTickerStreamsRequest); + ArgumentCaptor, IndividualSymbolTickerStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, IndividualSymbolTickerStreamsResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/symbol@ticker-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Kline/Candlestick Streams + * + *

The Kline/Candlestick Stream push updates to the current klines/candlestick every 250 + * milliseconds (if existing). Update Speed: 250ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void klineCandlestickStreamsTest() throws ApiException, URISyntaxException, IOException { + KlineCandlestickStreamsRequest klineCandlestickStreamsRequest = + new KlineCandlestickStreamsRequest(); + + klineCandlestickStreamsRequest.symbol("btcusdt"); + klineCandlestickStreamsRequest.interval("1m"); + + StreamBlockingQueueWrapper response = + api.klineCandlestickStreams(klineCandlestickStreamsRequest); + ArgumentCaptor, KlineCandlestickStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, KlineCandlestickStreamsResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/symbol@kline_interval-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Liquidation Order Streams + * + *

The Liquidation Order Snapshot Streams push force liquidation order information for + * specific symbol. For each symbol,only the latest one liquidation order within 1000ms will be + * pushed as the snapshot. If no liquidation happens in the interval of 1000ms, no stream will + * be pushed. Update Speed: 1000ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void liquidationOrderStreamsTest() throws ApiException, URISyntaxException, IOException { + LiquidationOrderStreamsRequest liquidationOrderStreamsRequest = + new LiquidationOrderStreamsRequest(); + + liquidationOrderStreamsRequest.symbol("btcusdt"); + + StreamBlockingQueueWrapper response = + api.liquidationOrderStreams(liquidationOrderStreamsRequest); + ArgumentCaptor, LiquidationOrderStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, LiquidationOrderStreamsResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/symbol@forceOrder-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Mark Price Stream + * + *

Mark price and funding rate for a single symbol pushed every 3 seconds or every second. + * Update Speed: 3000ms or 1000ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void markPriceStreamTest() throws ApiException, URISyntaxException, IOException { + MarkPriceStreamRequest markPriceStreamRequest = new MarkPriceStreamRequest(); + + markPriceStreamRequest.symbol("btcusdt"); + + StreamBlockingQueueWrapper response = + api.markPriceStream(markPriceStreamRequest); + ArgumentCaptor, MarkPriceStreamResponse>> callArgumentCaptor = + ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, MarkPriceStreamResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/symbol@markPriceupdateSpeed-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Mark Price Stream for All market + * + *

Mark price and funding rate for all symbols pushed every 3 seconds or every second. Update + * Speed: 3000ms or 1000ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void markPriceStreamForAllMarketTest() + throws ApiException, URISyntaxException, IOException { + MarkPriceStreamForAllMarketRequest markPriceStreamForAllMarketRequest = + new MarkPriceStreamForAllMarketRequest(); + + StreamBlockingQueueWrapper response = + api.markPriceStreamForAllMarket(markPriceStreamForAllMarketRequest); + ArgumentCaptor, MarkPriceStreamForAllMarketResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, MarkPriceStreamForAllMarketResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/markPrice@arrupdateSpeed-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Multi-Assets Mode Asset Index + * + *

Asset index for multi-assets mode user Update Speed: 1s + * + * @throws ApiException if the Api call fails + */ + @Test + public void multiAssetsModeAssetIndexTest() + throws ApiException, URISyntaxException, IOException { + MultiAssetsModeAssetIndexRequest multiAssetsModeAssetIndexRequest = + new MultiAssetsModeAssetIndexRequest(); + + StreamBlockingQueueWrapper response = + api.multiAssetsModeAssetIndex(multiAssetsModeAssetIndexRequest); + ArgumentCaptor, MultiAssetsModeAssetIndexResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, MultiAssetsModeAssetIndexResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + MarketApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/!assetIndex@arr-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } +} diff --git a/clients/derivatives-trading-usds-futures/src/test/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/PublicApiTest.java b/clients/derivatives-trading-usds-futures/src/test/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/PublicApiTest.java new file mode 100644 index 000000000..d63cc923e --- /dev/null +++ b/clients/derivatives-trading-usds-futures/src/test/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/api/PublicApiTest.java @@ -0,0 +1,259 @@ +/* + * Binance Derivatives Trading USDS Futures WebSocket Market Streams + * OpenAPI Specification for the Binance Derivatives Trading USDS Futures WebSocket Market Streams + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.common.websocket.adapter.stream.StreamConnectionWrapper; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.dtos.RequestWrapperDTO; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AggregateTradeStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AggregateTradeStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllBookTickersStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllBookTickersStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketLiquidationOrderStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketLiquidationOrderStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketMiniTickersStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketMiniTickersStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketTickersStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketTickersStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.CompositeIndexSymbolInformationStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.CompositeIndexSymbolInformationStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContinuousContractKlineCandlestickStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContinuousContractKlineCandlestickStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContractInfoStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContractInfoStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.DiffBookDepthStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.DiffBookDepthStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolBookTickerStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolBookTickerStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolMiniTickerStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolMiniTickerStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolTickerStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolTickerStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.KlineCandlestickStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.KlineCandlestickStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.LiquidationOrderStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.LiquidationOrderStreamsResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamForAllMarketRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamForAllMarketResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MultiAssetsModeAssetIndexRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MultiAssetsModeAssetIndexResponse; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.PartialBookDepthStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.PartialBookDepthStreamsResponse; +import org.eclipse.jetty.websocket.api.RemoteEndpoint; +import org.eclipse.jetty.websocket.api.Session; +import org.eclipse.jetty.websocket.client.WebSocketClient; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import org.skyscreamer.jsonassert.JSONAssert; + +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Set; +import java.util.concurrent.CompletableFuture; + +/** API tests for MarketApi */ +public class PublicApiTest { + + private PublicApi api; + private StreamConnectionWrapper connectionSpy; + private Session sessionMock; + + @BeforeEach + public void initApiClient() throws Exception { + URL resource = MarketApi.class.getResource("/test-ed25519-prv-key.pem"); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + File file = new File(resource.toURI()); + signatureConfiguration.setPrivateKey(file.getAbsolutePath()); + WebSocketClientConfiguration clientConfiguration = new WebSocketClientConfiguration(); + // @TODO: run tests for LOGON as well + clientConfiguration.setAutoLogon(false); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + clientConfiguration.setUrl("wss://localhost:8080"); + + WebSocketClient webSocketClient = Mockito.mock(WebSocketClient.class); + CompletableFuture sessionCompletableFuture = new CompletableFuture<>(); + Mockito.doReturn(sessionCompletableFuture) + .when(webSocketClient) + .connect(Mockito.any(), Mockito.any(), Mockito.any()); + sessionMock = Mockito.mock(Session.class); + + RemoteEndpoint remoteEndpointMock = Mockito.mock(RemoteEndpoint.class); + Mockito.doReturn(remoteEndpointMock).when(sessionMock).getRemote(); + + sessionCompletableFuture.complete(sessionMock); + StreamConnectionWrapper connectionWrapper = + new StreamConnectionWrapper(clientConfiguration, webSocketClient); + connectionSpy = Mockito.spy(connectionWrapper); + Mockito.doNothing().when(connectionSpy).setUserAgent(Mockito.anyString()); + Mockito.doReturn(1736393892000L).when(connectionSpy).getTimestamp(); + connectionSpy.connect(); + PublicApi accountApi = new PublicApi(connectionSpy); + api = Mockito.spy(accountApi); + Mockito.doReturn("eaf3292c-64b6-4c04-ad4f-4ca2608b42b4").when(api).getRequestID(); + } + + /** + * All Book Tickers Stream + * + *

Pushes any update to the best bid or ask's price or quantity in real-time for all + * symbols. Update Speed: 5s + * + * @throws ApiException if the Api call fails + */ + @Test + public void allBookTickersStreamTest() throws ApiException, URISyntaxException, IOException { + AllBookTickersStreamRequest allBookTickersStreamRequest = new AllBookTickersStreamRequest(); + + StreamBlockingQueueWrapper response = + api.allBookTickersStream(allBookTickersStreamRequest); + ArgumentCaptor, AllBookTickersStreamResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, AllBookTickersStreamResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + PublicApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/!bookTicker-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Diff. Book Depth Streams + * + *

Bids and asks, pushed every 250 milliseconds, 500 milliseconds, 100 milliseconds (if + * existing) Update Speed: 250ms, 500ms, 100ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void diffBookDepthStreamsTest() throws ApiException, URISyntaxException, IOException { + DiffBookDepthStreamsRequest diffBookDepthStreamsRequest = new DiffBookDepthStreamsRequest(); + + diffBookDepthStreamsRequest.symbol("btcusdt"); + + StreamBlockingQueueWrapper response = + api.diffBookDepthStreams(diffBookDepthStreamsRequest); + ArgumentCaptor, DiffBookDepthStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, DiffBookDepthStreamsResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + PublicApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/symbol@depthupdateSpeed-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Individual Symbol Book Ticker Streams + * + *

Pushes any update to the best bid or ask's price or quantity in real-time for a + * specified symbol. Update Speed: Real-time + * + * @throws ApiException if the Api call fails + */ + @Test + public void individualSymbolBookTickerStreamsTest() + throws ApiException, URISyntaxException, IOException { + IndividualSymbolBookTickerStreamsRequest individualSymbolBookTickerStreamsRequest = + new IndividualSymbolBookTickerStreamsRequest(); + + individualSymbolBookTickerStreamsRequest.symbol("btcusdt"); + + StreamBlockingQueueWrapper response = + api.individualSymbolBookTickerStreams(individualSymbolBookTickerStreamsRequest); + ArgumentCaptor, IndividualSymbolBookTickerStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, IndividualSymbolBookTickerStreamsResponse> + requestWrapperDTO = callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + PublicApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/symbol@bookTicker-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } + + /** + * Partial Book Depth Streams + * + *

Top **<levels\\>** bids and asks, Valid **<levels\\>** are 5, 10, or 20. + * Update Speed: 250ms, 500ms or 100ms + * + * @throws ApiException if the Api call fails + */ + @Test + public void partialBookDepthStreamsTest() throws ApiException, URISyntaxException, IOException { + PartialBookDepthStreamsRequest partialBookDepthStreamsRequest = + new PartialBookDepthStreamsRequest(); + + partialBookDepthStreamsRequest.symbol("btcusdt"); + partialBookDepthStreamsRequest.levels(10L); + partialBookDepthStreamsRequest.setUpdateSpeed("100ms"); + + StreamBlockingQueueWrapper response = + api.partialBookDepthStreams(partialBookDepthStreamsRequest); + ArgumentCaptor, PartialBookDepthStreamsResponse>> + callArgumentCaptor = ArgumentCaptor.forClass(RequestWrapperDTO.class); + Mockito.verify(connectionSpy).innerSend(callArgumentCaptor.capture()); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + RemoteEndpoint remote = sessionMock.getRemote(); + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), Mockito.any()); + RequestWrapperDTO, PartialBookDepthStreamsResponse> requestWrapperDTO = + callArgumentCaptor.getValue(); + Set params = requestWrapperDTO.getParams(); + // TODO: test validations + String sentPayload = sendArgumentCaptor.getValue(); + + URL resource = + PublicApiTest.class.getResource( + "/expected/stream/WebsocketMarketStreamsApi/symbol@depthlevelsupdateSpeed-test.json"); + String expectedJson = Files.readString(Paths.get(resource.toURI())); + JSONAssert.assertEquals(expectedJson, sentPayload, true); + } +} diff --git a/clients/simple-earn/CHANGELOG.md b/clients/simple-earn/CHANGELOG.md index eec2cb95b..549189fd7 100644 --- a/clients/simple-earn/CHANGELOG.md +++ b/clients/simple-earn/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 6.0.0 - 2026-03-18 + +### Changed (1) + +- Modified response for `getBfusdQuotaDetails()` (`GET /sapi/v1/bfusd/quota`): + - property `subscriptionQuota` added + ## 5.0.0 - 2026-02-12 ### Changed (1) diff --git a/clients/simple-earn/docs/BfusdApi.md b/clients/simple-earn/docs/BfusdApi.md index f58465a7b..c9f04e0fb 100644 --- a/clients/simple-earn/docs/BfusdApi.md +++ b/clients/simple-earn/docs/BfusdApi.md @@ -82,7 +82,7 @@ No authorization required Get BFUSD Quota Details (USER_DATA) -Get BFUSD quota details including fast redemption quota and standard redemption quota. Weight: 150 +Get BFUSD quota details including subscription quota, fast redemption quota and standard redemption quota. Weight: 150 ### Example ```java diff --git a/clients/simple-earn/docs/FlexibleLockedApi.md b/clients/simple-earn/docs/FlexibleLockedApi.md index 26795d553..2651947cf 100644 --- a/clients/simple-earn/docs/FlexibleLockedApi.md +++ b/clients/simple-earn/docs/FlexibleLockedApi.md @@ -242,7 +242,7 @@ No authorization required Get Flexible Redemption Record(USER_DATA) -Get Flexible Redemption Record * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 +Get Flexible Redemption Record * The time between `startTime` and `endTime` cannot be longer than 30 days. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 ### Example ```java @@ -318,7 +318,7 @@ No authorization required Get Flexible Rewards History(USER_DATA) -Get Flexible Rewards History * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 +Get Flexible Rewards History * The time between `startTime` and `endTime` cannot be longer than 30 days. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 ### Example ```java @@ -460,7 +460,7 @@ No authorization required Get Flexible Subscription Record(USER_DATA) -Get Flexible Subscription Record * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 +Get Flexible Subscription Record * The time between `startTime` and `endTime` cannot be longer than 30 days. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 ### Example ```java @@ -672,7 +672,7 @@ No authorization required Get Locked Redemption Record(USER_DATA) -Get Locked Redemption Record * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 +Get Locked Redemption Record * The time between `startTime` and `endTime` cannot be longer than 30 days. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 ### Example ```java @@ -748,7 +748,7 @@ No authorization required Get Locked Rewards History(USER_DATA) -Get Locked Rewards History * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 +Get Locked Rewards History * The time between `startTime` and `endTime` cannot be longer than 30 days. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 ### Example ```java @@ -890,7 +890,7 @@ No authorization required Get Locked Subscription Record(USER_DATA) -Get Locked Subscription Record * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 +Get Locked Subscription Record * The time between `startTime` and `endTime` cannot be longer than 30 days. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. Weight: 150 ### Example ```java diff --git a/clients/simple-earn/docs/GetBfusdQuotaDetailsResponse.md b/clients/simple-earn/docs/GetBfusdQuotaDetailsResponse.md index 3eb684ac9..051e0bd75 100644 --- a/clients/simple-earn/docs/GetBfusdQuotaDetailsResponse.md +++ b/clients/simple-earn/docs/GetBfusdQuotaDetailsResponse.md @@ -7,6 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| +|**subscriptionQuota** | [**GetBfusdQuotaDetailsResponseSubscriptionQuota**](GetBfusdQuotaDetailsResponseSubscriptionQuota.md) | | [optional] | |**fastRedemptionQuota** | [**GetBfusdQuotaDetailsResponseFastRedemptionQuota**](GetBfusdQuotaDetailsResponseFastRedemptionQuota.md) | | [optional] | |**standardRedemptionQuota** | [**GetBfusdQuotaDetailsResponseStandardRedemptionQuota**](GetBfusdQuotaDetailsResponseStandardRedemptionQuota.md) | | [optional] | diff --git a/clients/simple-earn/docs/GetBfusdQuotaDetailsResponseSubscriptionQuota.md b/clients/simple-earn/docs/GetBfusdQuotaDetailsResponseSubscriptionQuota.md new file mode 100644 index 000000000..042eceb81 --- /dev/null +++ b/clients/simple-earn/docs/GetBfusdQuotaDetailsResponseSubscriptionQuota.md @@ -0,0 +1,13 @@ + + +# GetBfusdQuotaDetailsResponseSubscriptionQuota + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**leftQuota** | **String** | | [optional] | + + + diff --git a/clients/simple-earn/docs/rest-api/migration-guide.md b/clients/simple-earn/docs/rest-api/migration-guide.md index e2bd5dcf1..852cd5c7c 100644 --- a/clients/simple-earn/docs/rest-api/migration-guide.md +++ b/clients/simple-earn/docs/rest-api/migration-guide.md @@ -22,7 +22,7 @@ With the transition to a modularized structure, the Binance Connector has been s io.github.binance binance-simple-earn - 5.0.0 + 6.0.0 ``` @@ -91,7 +91,7 @@ by: io.github.binance binance-simple-earn - 5.0.0 + 6.0.0 ``` diff --git a/clients/simple-earn/pom.xml b/clients/simple-earn/pom.xml index 76e72c81d..82362f180 100644 --- a/clients/simple-earn/pom.xml +++ b/clients/simple-earn/pom.xml @@ -5,7 +5,7 @@ 4.0.0 binance-simple-earn simple-earn - 5.0.0 + 6.0.0 jar @@ -31,7 +31,7 @@ io.github.binance binance-common - 2.3.1 + 2.4.1 \ No newline at end of file diff --git a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/JSON.java b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/JSON.java index 1cd9c0966..5be3f6e5b 100644 --- a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/JSON.java +++ b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/JSON.java @@ -122,6 +122,9 @@ private static Class getClassByDiscriminator( new com.binance.connector.client.simple_earn.rest.model .GetBfusdQuotaDetailsResponseStandardRedemptionQuota .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.simple_earn.rest.model + .GetBfusdQuotaDetailsResponseSubscriptionQuota.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.simple_earn.rest.model.GetBfusdRateHistoryResponse .CustomTypeAdapterFactory()); diff --git a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/BfusdApi.java b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/BfusdApi.java index d62f75cd3..794f88c77 100644 --- a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/BfusdApi.java +++ b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/BfusdApi.java @@ -53,7 +53,7 @@ public class BfusdApi { private static final String USER_AGENT = String.format( - "binance-simple-earn/5.0.0 (Java/%s; %s; %s)", + "binance-simple-earn/6.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; @@ -328,8 +328,8 @@ private okhttp3.Call getBfusdQuotaDetailsValidateBeforeCall(Long recvWindow) } /** - * Get BFUSD Quota Details (USER_DATA) Get BFUSD quota details including fast redemption quota - * and standard redemption quota. Weight: 150 + * Get BFUSD Quota Details (USER_DATA) Get BFUSD quota details including subscription quota, + * fast redemption quota and standard redemption quota. Weight: 150 * * @param recvWindow The value cannot be greater than 60000 (ms) (optional) * @return ApiResponse<GetBfusdQuotaDetailsResponse> diff --git a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/FlexibleLockedApi.java b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/FlexibleLockedApi.java index 501608bd9..603a52b4c 100644 --- a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/FlexibleLockedApi.java +++ b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/FlexibleLockedApi.java @@ -74,7 +74,7 @@ public class FlexibleLockedApi { private static final String USER_AGENT = String.format( - "binance-simple-earn/5.0.0 (Java/%s; %s; %s)", + "binance-simple-earn/6.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; @@ -800,7 +800,7 @@ private okhttp3.Call getFlexibleRedemptionRecordValidateBeforeCall( /** * Get Flexible Redemption Record(USER_DATA) Get Flexible Redemption Record * The time between - * `startTime` and `endTime` cannot be longer than 3 months. * If + * `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If @@ -1023,7 +1023,7 @@ private okhttp3.Call getFlexibleRewardsHistoryValidateBeforeCall( /** * Get Flexible Rewards History(USER_DATA) Get Flexible Rewards History * The time between - * `startTime` and `endTime` cannot be longer than 3 months. * If + * `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If @@ -1409,7 +1409,7 @@ private okhttp3.Call getFlexibleSubscriptionRecordValidateBeforeCall( /** * Get Flexible Subscription Record(USER_DATA) Get Flexible Subscription Record * The time - * between `startTime` and `endTime` cannot be longer than 3 months. * If + * between `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If @@ -1975,7 +1975,7 @@ private okhttp3.Call getLockedRedemptionRecordValidateBeforeCall( /** * Get Locked Redemption Record(USER_DATA) Get Locked Redemption Record * The time between - * `startTime` and `endTime` cannot be longer than 3 months. * If + * `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If @@ -2189,7 +2189,7 @@ private okhttp3.Call getLockedRewardsHistoryValidateBeforeCall( /** * Get Locked Rewards History(USER_DATA) Get Locked Rewards History * The time between - * `startTime` and `endTime` cannot be longer than 3 months. * If + * `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If @@ -2572,7 +2572,7 @@ private okhttp3.Call getLockedSubscriptionRecordValidateBeforeCall( /** * Get Locked Subscription Record(USER_DATA) Get Locked Subscription Record * The time between - * `startTime` and `endTime` cannot be longer than 3 months. * If + * `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If diff --git a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/RwusdApi.java b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/RwusdApi.java index 84db97889..73c400b8d 100644 --- a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/RwusdApi.java +++ b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/RwusdApi.java @@ -53,7 +53,7 @@ public class RwusdApi { private static final String USER_AGENT = String.format( - "binance-simple-earn/5.0.0 (Java/%s; %s; %s)", + "binance-simple-earn/6.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; diff --git a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/SimpleEarnRestApi.java b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/SimpleEarnRestApi.java index e498a863f..15751280a 100644 --- a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/SimpleEarnRestApi.java +++ b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/api/SimpleEarnRestApi.java @@ -96,8 +96,8 @@ public ApiResponse getBfusdAccount(Long recvWindow) } /** - * Get BFUSD Quota Details (USER_DATA) Get BFUSD quota details including fast redemption quota - * and standard redemption quota. Weight: 150 + * Get BFUSD Quota Details (USER_DATA) Get BFUSD quota details including subscription quota, + * fast redemption quota and standard redemption quota. Weight: 150 * * @param recvWindow The value cannot be greater than 60000 (ms) (optional) * @return ApiResponse<GetBfusdQuotaDetailsResponse> @@ -408,7 +408,7 @@ public ApiResponse getFlexibleProductPositio /** * Get Flexible Redemption Record(USER_DATA) Get Flexible Redemption Record * The time between - * `startTime` and `endTime` cannot be longer than 3 months. * If + * `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If @@ -453,7 +453,7 @@ public ApiResponse getFlexibleRedemptionRec /** * Get Flexible Rewards History(USER_DATA) Get Flexible Rewards History * The time between - * `startTime` and `endTime` cannot be longer than 3 months. * If + * `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If @@ -524,7 +524,7 @@ public ApiResponse getFlexibleSubscripti /** * Get Flexible Subscription Record(USER_DATA) Get Flexible Subscription Record * The time - * between `startTime` and `endTime` cannot be longer than 3 months. * If + * between `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If @@ -628,7 +628,7 @@ public ApiResponse getLockedProductPosition( /** * Get Locked Redemption Record(USER_DATA) Get Locked Redemption Record * The time between - * `startTime` and `endTime` cannot be longer than 3 months. * If + * `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If @@ -673,7 +673,7 @@ public ApiResponse getLockedRedemptionRecord( /** * Get Locked Rewards History(USER_DATA) Get Locked Rewards History * The time between - * `startTime` and `endTime` cannot be longer than 3 months. * If + * `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If @@ -744,7 +744,7 @@ public ApiResponse getLockedSubscriptionPr /** * Get Locked Subscription Record(USER_DATA) Get Locked Subscription Record * The time between - * `startTime` and `endTime` cannot be longer than 3 months. * If + * `startTime` and `endTime` cannot be longer than 30 days. * If * `startTime` and `endTime` are both not sent, then the last 30 days' * data will be returned. * If `startTime` is sent but `endTime` is not * sent, the next 30 days' data beginning from `startTime` will be returned. * If diff --git a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/model/GetBfusdQuotaDetailsResponse.java b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/model/GetBfusdQuotaDetailsResponse.java index f8d60f3ac..baf25514b 100644 --- a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/model/GetBfusdQuotaDetailsResponse.java +++ b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/model/GetBfusdQuotaDetailsResponse.java @@ -37,6 +37,12 @@ value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0") public class GetBfusdQuotaDetailsResponse { + public static final String SERIALIZED_NAME_SUBSCRIPTION_QUOTA = "subscriptionQuota"; + + @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_QUOTA) + @jakarta.annotation.Nullable + private GetBfusdQuotaDetailsResponseSubscriptionQuota subscriptionQuota; + public static final String SERIALIZED_NAME_FAST_REDEMPTION_QUOTA = "fastRedemptionQuota"; @SerializedName(SERIALIZED_NAME_FAST_REDEMPTION_QUOTA) @@ -52,6 +58,30 @@ public class GetBfusdQuotaDetailsResponse { public GetBfusdQuotaDetailsResponse() {} + public GetBfusdQuotaDetailsResponse subscriptionQuota( + @jakarta.annotation.Nullable + GetBfusdQuotaDetailsResponseSubscriptionQuota subscriptionQuota) { + this.subscriptionQuota = subscriptionQuota; + return this; + } + + /** + * Get subscriptionQuota + * + * @return subscriptionQuota + */ + @jakarta.annotation.Nullable + @Valid + public GetBfusdQuotaDetailsResponseSubscriptionQuota getSubscriptionQuota() { + return subscriptionQuota; + } + + public void setSubscriptionQuota( + @jakarta.annotation.Nullable + GetBfusdQuotaDetailsResponseSubscriptionQuota subscriptionQuota) { + this.subscriptionQuota = subscriptionQuota; + } + public GetBfusdQuotaDetailsResponse fastRedemptionQuota( @jakarta.annotation.Nullable GetBfusdQuotaDetailsResponseFastRedemptionQuota fastRedemptionQuota) { @@ -111,6 +141,8 @@ public boolean equals(Object o) { GetBfusdQuotaDetailsResponse getBfusdQuotaDetailsResponse = (GetBfusdQuotaDetailsResponse) o; return Objects.equals( + this.subscriptionQuota, getBfusdQuotaDetailsResponse.subscriptionQuota) + && Objects.equals( this.fastRedemptionQuota, getBfusdQuotaDetailsResponse.fastRedemptionQuota) && Objects.equals( this.standardRedemptionQuota, @@ -119,13 +151,14 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(fastRedemptionQuota, standardRedemptionQuota); + return Objects.hash(subscriptionQuota, fastRedemptionQuota, standardRedemptionQuota); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GetBfusdQuotaDetailsResponse {\n"); + sb.append(" subscriptionQuota: ").append(toIndentedString(subscriptionQuota)).append("\n"); sb.append(" fastRedemptionQuota: ") .append(toIndentedString(fastRedemptionQuota)) .append("\n"); @@ -139,6 +172,12 @@ public String toString() { public String toUrlQueryString() { StringBuilder sb = new StringBuilder(); + Object subscriptionQuotaValue = getSubscriptionQuota(); + String subscriptionQuotaValueAsString = ""; + subscriptionQuotaValueAsString = subscriptionQuotaValue.toString(); + sb.append("subscriptionQuota=") + .append(urlEncode(subscriptionQuotaValueAsString)) + .append(""); Object fastRedemptionQuotaValue = getFastRedemptionQuota(); String fastRedemptionQuotaValueAsString = ""; fastRedemptionQuotaValueAsString = fastRedemptionQuotaValue.toString(); @@ -179,6 +218,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); + openapiFields.add("subscriptionQuota"); openapiFields.add("fastRedemptionQuota"); openapiFields.add("standardRedemptionQuota"); @@ -205,6 +245,12 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `subscriptionQuota` + if (jsonObj.get("subscriptionQuota") != null + && !jsonObj.get("subscriptionQuota").isJsonNull()) { + GetBfusdQuotaDetailsResponseSubscriptionQuota.validateJsonElement( + jsonObj.get("subscriptionQuota")); + } // validate the optional field `fastRedemptionQuota` if (jsonObj.get("fastRedemptionQuota") != null && !jsonObj.get("fastRedemptionQuota").isJsonNull()) { diff --git a/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/model/GetBfusdQuotaDetailsResponseSubscriptionQuota.java b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/model/GetBfusdQuotaDetailsResponseSubscriptionQuota.java new file mode 100644 index 000000000..00a0c211b --- /dev/null +++ b/clients/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/model/GetBfusdQuotaDetailsResponseSubscriptionQuota.java @@ -0,0 +1,226 @@ +/* + * Binance Simple Earn REST API + * OpenAPI Specification for the Binance Simple Earn REST API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.simple_earn.rest.model; + +import com.binance.connector.client.simple_earn.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** GetBfusdQuotaDetailsResponseSubscriptionQuota */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class GetBfusdQuotaDetailsResponseSubscriptionQuota { + public static final String SERIALIZED_NAME_LEFT_QUOTA = "leftQuota"; + + @SerializedName(SERIALIZED_NAME_LEFT_QUOTA) + @jakarta.annotation.Nullable + private String leftQuota; + + public GetBfusdQuotaDetailsResponseSubscriptionQuota() {} + + public GetBfusdQuotaDetailsResponseSubscriptionQuota leftQuota( + @jakarta.annotation.Nullable String leftQuota) { + this.leftQuota = leftQuota; + return this; + } + + /** + * Get leftQuota + * + * @return leftQuota + */ + @jakarta.annotation.Nullable + public String getLeftQuota() { + return leftQuota; + } + + public void setLeftQuota(@jakarta.annotation.Nullable String leftQuota) { + this.leftQuota = leftQuota; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetBfusdQuotaDetailsResponseSubscriptionQuota + getBfusdQuotaDetailsResponseSubscriptionQuota = + (GetBfusdQuotaDetailsResponseSubscriptionQuota) o; + return Objects.equals( + this.leftQuota, getBfusdQuotaDetailsResponseSubscriptionQuota.leftQuota); + } + + @Override + public int hashCode() { + return Objects.hash(leftQuota); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetBfusdQuotaDetailsResponseSubscriptionQuota {\n"); + sb.append(" leftQuota: ").append(toIndentedString(leftQuota)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object leftQuotaValue = getLeftQuota(); + String leftQuotaValueAsString = ""; + leftQuotaValueAsString = leftQuotaValue.toString(); + sb.append("leftQuota=").append(urlEncode(leftQuotaValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("leftQuota"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetBfusdQuotaDetailsResponseSubscriptionQuota + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetBfusdQuotaDetailsResponseSubscriptionQuota.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetBfusdQuotaDetailsResponseSubscriptionQuota is not found" + + " in the empty JSON string", + GetBfusdQuotaDetailsResponseSubscriptionQuota.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("leftQuota") != null && !jsonObj.get("leftQuota").isJsonNull()) + && !jsonObj.get("leftQuota").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `leftQuota` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("leftQuota").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetBfusdQuotaDetailsResponseSubscriptionQuota.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetBfusdQuotaDetailsResponseSubscriptionQuota' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(GetBfusdQuotaDetailsResponseSubscriptionQuota.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetBfusdQuotaDetailsResponseSubscriptionQuota value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetBfusdQuotaDetailsResponseSubscriptionQuota read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetBfusdQuotaDetailsResponseSubscriptionQuota given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetBfusdQuotaDetailsResponseSubscriptionQuota + * @throws IOException if the JSON string is invalid with respect to + * GetBfusdQuotaDetailsResponseSubscriptionQuota + */ + public static GetBfusdQuotaDetailsResponseSubscriptionQuota fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetBfusdQuotaDetailsResponseSubscriptionQuota.class); + } + + /** + * Convert an instance of GetBfusdQuotaDetailsResponseSubscriptionQuota to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/CHANGELOG.md b/clients/spot/CHANGELOG.md index 4b58dfba3..55aa851e8 100644 --- a/clients/spot/CHANGELOG.md +++ b/clients/spot/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 10.0.0 - 2026-03-18 + +### Added (7) + +#### REST API + +- `executionRules()` (`GET /api/v3/executionRules`) +- `referencePrice()` (`GET /api/v3/referencePrice`) +- `referencePriceCalculation()` (`GET /api/v3/referencePrice/calculation`) + +#### WebSocket API + +- `executionRules()` (`executionRules` method) +- `referencePrice()` (`referencePrice` method) +- `referencePriceCalculation()` (`referencePrice.calculation` method) + +#### WebSocket Streams + +- `referencePrice()` (`@referencePrice` stream) + ## 9.0.0 - 2026-02-12 ### Added (1) diff --git a/clients/spot/docs/ExecutionReport.md b/clients/spot/docs/ExecutionReport.md index 080a9b48b..02ce47d44 100644 --- a/clients/spot/docs/ExecutionReport.md +++ b/clients/spot/docs/ExecutionReport.md @@ -61,6 +61,7 @@ |**gOT** | **String** | | [optional] | |**gOV** | **Long** | | [optional] | |**gp** | **String** | | [optional] | +|**eR** | **String** | | [optional] | diff --git a/clients/spot/docs/ExecutionRulesRequest.md b/clients/spot/docs/ExecutionRulesRequest.md new file mode 100644 index 000000000..51c2a7595 --- /dev/null +++ b/clients/spot/docs/ExecutionRulesRequest.md @@ -0,0 +1,15 @@ + + +# ExecutionRulesRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | **String** | | [optional] | +|**symbols** | **Symbols** | | [optional] | +|**symbolStatus** | **SymbolStatus** | | [optional] | + + + diff --git a/clients/spot/docs/ExecutionRulesResponse.md b/clients/spot/docs/ExecutionRulesResponse.md new file mode 100644 index 000000000..1903f8b8e --- /dev/null +++ b/clients/spot/docs/ExecutionRulesResponse.md @@ -0,0 +1,15 @@ + + +# ExecutionRulesResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | [optional] | +|**status** | **Long** | | [optional] | +|**result** | [**ExecutionRulesResponseResult**](ExecutionRulesResponseResult.md) | | [optional] | + + + diff --git a/clients/spot/docs/ExecutionRulesResponseResult.md b/clients/spot/docs/ExecutionRulesResponseResult.md new file mode 100644 index 000000000..9f65ec03a --- /dev/null +++ b/clients/spot/docs/ExecutionRulesResponseResult.md @@ -0,0 +1,13 @@ + + +# ExecutionRulesResponseResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbolRules** | [**List<ExecutionRulesResponseResultSymbolRulesInner>**](ExecutionRulesResponseResultSymbolRulesInner.md) | | [optional] | + + + diff --git a/clients/spot/docs/ExecutionRulesResponseResultSymbolRulesInner.md b/clients/spot/docs/ExecutionRulesResponseResultSymbolRulesInner.md new file mode 100644 index 000000000..464f95712 --- /dev/null +++ b/clients/spot/docs/ExecutionRulesResponseResultSymbolRulesInner.md @@ -0,0 +1,14 @@ + + +# ExecutionRulesResponseResultSymbolRulesInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | **String** | | [optional] | +|**rules** | [**List<ExecutionRulesResponseResultSymbolRulesInnerRulesInner>**](ExecutionRulesResponseResultSymbolRulesInnerRulesInner.md) | | [optional] | + + + diff --git a/clients/spot/docs/ExecutionRulesResponseResultSymbolRulesInnerRulesInner.md b/clients/spot/docs/ExecutionRulesResponseResultSymbolRulesInnerRulesInner.md new file mode 100644 index 000000000..40cab55bd --- /dev/null +++ b/clients/spot/docs/ExecutionRulesResponseResultSymbolRulesInnerRulesInner.md @@ -0,0 +1,17 @@ + + +# ExecutionRulesResponseResultSymbolRulesInnerRulesInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**ruleType** | **String** | | [optional] | +|**bidLimitMultUp** | **String** | | [optional] | +|**bidLimitMultDown** | **String** | | [optional] | +|**askLimitMultUp** | **String** | | [optional] | +|**askLimitMultDown** | **String** | | [optional] | + + + diff --git a/clients/spot/docs/ExecutionRulesResponseSymbolRulesInner.md b/clients/spot/docs/ExecutionRulesResponseSymbolRulesInner.md new file mode 100644 index 000000000..9d6bfe8c2 --- /dev/null +++ b/clients/spot/docs/ExecutionRulesResponseSymbolRulesInner.md @@ -0,0 +1,14 @@ + + +# ExecutionRulesResponseSymbolRulesInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | **String** | | [optional] | +|**rules** | [**List<ExecutionRulesResponseSymbolRulesInnerRulesInner>**](ExecutionRulesResponseSymbolRulesInnerRulesInner.md) | | [optional] | + + + diff --git a/clients/spot/docs/ExecutionRulesResponseSymbolRulesInnerRulesInner.md b/clients/spot/docs/ExecutionRulesResponseSymbolRulesInnerRulesInner.md new file mode 100644 index 000000000..9ce34d266 --- /dev/null +++ b/clients/spot/docs/ExecutionRulesResponseSymbolRulesInnerRulesInner.md @@ -0,0 +1,17 @@ + + +# ExecutionRulesResponseSymbolRulesInnerRulesInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**ruleType** | **String** | | [optional] | +|**bidLimitMultUp** | **String** | | [optional] | +|**bidLimitMultDown** | **String** | | [optional] | +|**askLimitMultUp** | **String** | | [optional] | +|**askLimitMultDown** | **String** | | [optional] | + + + diff --git a/clients/spot/docs/GeneralApi.md b/clients/spot/docs/GeneralApi.md index 6543cc258..fc59fc17d 100644 --- a/clients/spot/docs/GeneralApi.md +++ b/clients/spot/docs/GeneralApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| | [**exchangeInfo**](GeneralApi.md#exchangeInfo) | **POST** /exchangeInfo | WebSocket Exchange information | +| [**executionRules**](GeneralApi.md#executionRules) | **POST** /executionRules | WebSocket Query Execution Rules | | [**ping**](GeneralApi.md#ping) | **POST** /ping | WebSocket Test connectivity | | [**time**](GeneralApi.md#time) | **POST** /time | WebSocket Check server time | @@ -71,6 +72,68 @@ No authorization required |-------------|-------------|------------------| | **200** | Exchange information | - | + +# **executionRules** +> ExecutionRulesResponse executionRules(executionRulesRequest) + +WebSocket Query Execution Rules + + Weight: Parameter | Weight| --- | --- `symbol` | 2 `symbols` | 2 for each `symbol`, capped at a max of 40| `symbolStatus` |40| None |40| + +### Example +```java +// Import classes: +import com.binance.connector.client.spot.ApiClient; +import com.binance.connector.client.spot.ApiException; +import com.binance.connector.client.spot.Configuration; +import com.binance.connector.client.spot.models.*; +import com.binance.connector.client.spot.websocket.api.api.GeneralApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + GeneralApi apiInstance = new GeneralApi(defaultClient); + ExecutionRulesRequest executionRulesRequest = new ExecutionRulesRequest(); // ExecutionRulesRequest | + try { + ExecutionRulesResponse result = apiInstance.executionRules(executionRulesRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GeneralApi#executionRules"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **executionRulesRequest** | [**ExecutionRulesRequest**](ExecutionRulesRequest.md)| | [optional] | + +### Return type + +[**ExecutionRulesResponse**](ExecutionRulesResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Query Execution Rules | - | + # **ping** > PingResponse ping() diff --git a/clients/spot/docs/MarketApi.md b/clients/spot/docs/MarketApi.md index 81df1316f..20a07c40c 100644 --- a/clients/spot/docs/MarketApi.md +++ b/clients/spot/docs/MarketApi.md @@ -7,6 +7,8 @@ All URIs are relative to *http://localhost* | [**avgPrice**](MarketApi.md#avgPrice) | **POST** /avgPrice | WebSocket Current average price | | [**depth**](MarketApi.md#depth) | **POST** /depth | WebSocket Order book | | [**klines**](MarketApi.md#klines) | **POST** /klines | WebSocket Klines | +| [**referencePrice**](MarketApi.md#referencePrice) | **POST** /referencePrice | WebSocket Query Reference Price | +| [**referencePriceCalculation**](MarketApi.md#referencePriceCalculation) | **POST** /referencePrice.calculation | WebSocket Query Reference Price Calculation | | [**ticker**](MarketApi.md#ticker) | **POST** /ticker | WebSocket Rolling window price change statistics | | [**ticker24hr**](MarketApi.md#ticker24hr) | **POST** /ticker.24hr | WebSocket 24hr ticker price change statistics | | [**tickerBook**](MarketApi.md#tickerBook) | **POST** /ticker.book | WebSocket Symbol order book ticker | @@ -204,6 +206,130 @@ No authorization required |-------------|-------------|------------------| | **200** | Klines | - | + +# **referencePrice** +> ReferencePriceResponse referencePrice(referencePriceRequest) + +WebSocket Query Reference Price + + Weight: 2 + +### Example +```java +// Import classes: +import com.binance.connector.client.spot.ApiClient; +import com.binance.connector.client.spot.ApiException; +import com.binance.connector.client.spot.Configuration; +import com.binance.connector.client.spot.models.*; +import com.binance.connector.client.spot.websocket.api.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + ReferencePriceRequest referencePriceRequest = new ReferencePriceRequest(); // ReferencePriceRequest | + try { + ReferencePriceResponse result = apiInstance.referencePrice(referencePriceRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#referencePrice"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **referencePriceRequest** | [**ReferencePriceRequest**](ReferencePriceRequest.md)| | | + +### Return type + +[**ReferencePriceResponse**](ReferencePriceResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Query Reference Price | - | + + +# **referencePriceCalculation** +> ReferencePriceCalculationResponse referencePriceCalculation(referencePriceCalculationRequest) + +WebSocket Query Reference Price Calculation + +Describes how reference price is calculated for a given symbol. Weight: 2 + +### Example +```java +// Import classes: +import com.binance.connector.client.spot.ApiClient; +import com.binance.connector.client.spot.ApiException; +import com.binance.connector.client.spot.Configuration; +import com.binance.connector.client.spot.models.*; +import com.binance.connector.client.spot.websocket.api.api.MarketApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + MarketApi apiInstance = new MarketApi(defaultClient); + ReferencePriceCalculationRequest referencePriceCalculationRequest = new ReferencePriceCalculationRequest(); // ReferencePriceCalculationRequest | + try { + ReferencePriceCalculationResponse result = apiInstance.referencePriceCalculation(referencePriceCalculationRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MarketApi#referencePriceCalculation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **referencePriceCalculationRequest** | [**ReferencePriceCalculationRequest**](ReferencePriceCalculationRequest.md)| | | + +### Return type + +[**ReferencePriceCalculationResponse**](ReferencePriceCalculationResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Query Reference Price Calculation | - | + # **ticker** > TickerResponse ticker(tickerRequest) diff --git a/clients/spot/docs/ReferencePriceCalculationRequest.md b/clients/spot/docs/ReferencePriceCalculationRequest.md new file mode 100644 index 000000000..42da0e7d2 --- /dev/null +++ b/clients/spot/docs/ReferencePriceCalculationRequest.md @@ -0,0 +1,14 @@ + + +# ReferencePriceCalculationRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | **String** | | | +|**symbolStatus** | **SymbolStatus** | | [optional] | + + + diff --git a/clients/spot/docs/ReferencePriceCalculationResponse.md b/clients/spot/docs/ReferencePriceCalculationResponse.md new file mode 100644 index 000000000..5dcdb7774 --- /dev/null +++ b/clients/spot/docs/ReferencePriceCalculationResponse.md @@ -0,0 +1,15 @@ + + +# ReferencePriceCalculationResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | [optional] | +|**status** | **Long** | | [optional] | +|**result** | [**ReferencePriceCalculationResponseResult**](ReferencePriceCalculationResponseResult.md) | | [optional] | + + + diff --git a/clients/spot/docs/ReferencePriceCalculationResponseResult.md b/clients/spot/docs/ReferencePriceCalculationResponseResult.md new file mode 100644 index 000000000..708dc42c9 --- /dev/null +++ b/clients/spot/docs/ReferencePriceCalculationResponseResult.md @@ -0,0 +1,17 @@ + + +# ReferencePriceCalculationResponseResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | **String** | | [optional] | +|**calculationType** | **String** | | [optional] | +|**bucketCount** | **Long** | | [optional] | +|**bucketWidthMs** | **Long** | | [optional] | +|**externalCalculationId** | **Long** | | [optional] | + + + diff --git a/clients/spot/docs/ReferencePriceRequest.md b/clients/spot/docs/ReferencePriceRequest.md new file mode 100644 index 000000000..86baf0e69 --- /dev/null +++ b/clients/spot/docs/ReferencePriceRequest.md @@ -0,0 +1,13 @@ + + +# ReferencePriceRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | **String** | | | + + + diff --git a/clients/spot/docs/ReferencePriceResponse.md b/clients/spot/docs/ReferencePriceResponse.md new file mode 100644 index 000000000..e89d0f9d7 --- /dev/null +++ b/clients/spot/docs/ReferencePriceResponse.md @@ -0,0 +1,16 @@ + + +# ReferencePriceResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eLowerCase** | **String** | | [optional] | +|**sLowerCase** | **String** | | [optional] | +|**rLowerCase** | **String** | | [optional] | +|**tLowerCase** | **Long** | | [optional] | + + + diff --git a/clients/spot/docs/ReferencePriceResponseResult.md b/clients/spot/docs/ReferencePriceResponseResult.md new file mode 100644 index 000000000..341360c7e --- /dev/null +++ b/clients/spot/docs/ReferencePriceResponseResult.md @@ -0,0 +1,15 @@ + + +# ReferencePriceResponseResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | **String** | | [optional] | +|**referencePrice** | **String** | | [optional] | +|**timestamp** | **Long** | | [optional] | + + + diff --git a/clients/spot/docs/TradeApi.md b/clients/spot/docs/TradeApi.md index 94342e776..313cfd279 100644 --- a/clients/spot/docs/TradeApi.md +++ b/clients/spot/docs/TradeApi.md @@ -213,7 +213,7 @@ No authorization required WebSocket Cancel and replace order -Cancel an existing order and immediately place a new order instead of the canceled one. A new order that was not attempted (i.e. when `newOrderResult: NOT_ATTEMPTED`), will still increase the unfilled order count by 1. Weight: 1 +* Cancel an existing order and immediately place a new order instead of the canceled one. * A new order that was not attempted (i.e. when `newOrderResult: NOT_ATTEMPTED`), will still increase the unfilled order count by 1. * You can only cancel an individual order from an orderList using this method, but the result is the same as canceling the entire orderList. Weight: 1 ### Example ```java diff --git a/clients/spot/docs/UserDataStreamEventsResponse.md b/clients/spot/docs/UserDataStreamEventsResponse.md index 739047a46..f548239cd 100644 --- a/clients/spot/docs/UserDataStreamEventsResponse.md +++ b/clients/spot/docs/UserDataStreamEventsResponse.md @@ -61,6 +61,7 @@ |**gOT** | **String** | | [optional] | |**gOV** | **Long** | | [optional] | |**gp** | **String** | | [optional] | +|**eR** | **String** | | [optional] | diff --git a/clients/spot/docs/WebSocketStreamsApi.md b/clients/spot/docs/WebSocketStreamsApi.md index 1365286ec..625b60a79 100644 --- a/clients/spot/docs/WebSocketStreamsApi.md +++ b/clients/spot/docs/WebSocketStreamsApi.md @@ -14,6 +14,7 @@ All URIs are relative to *http://localhost* | [**klineOffset**](WebSocketStreamsApi.md#klineOffset) | **POST** /<symbol>@kline_<interval>@+08:00 | WebSocket Kline/Candlestick Streams with timezone offset | | [**miniTicker**](WebSocketStreamsApi.md#miniTicker) | **POST** /<symbol>@miniTicker | WebSocket Individual Symbol Mini Ticker Stream | | [**partialBookDepth**](WebSocketStreamsApi.md#partialBookDepth) | **POST** /<symbol>@depth<levels>@<updateSpeed> | WebSocket Partial Book Depth Streams | +| [**referencePrice**](WebSocketStreamsApi.md#referencePrice) | **POST** /<symbol>@referencePrice | WebSocket Reference Price Streams | | [**rollingWindowTicker**](WebSocketStreamsApi.md#rollingWindowTicker) | **POST** /<symbol>@ticker_<windowSize> | WebSocket Individual Symbol Rolling Window Statistics Streams | | [**ticker**](WebSocketStreamsApi.md#ticker) | **POST** /<symbol>@ticker | WebSocket Individual Symbol Ticker Streams | | [**trade**](WebSocketStreamsApi.md#trade) | **POST** /<symbol>@trade | WebSocket Trade Streams | @@ -635,6 +636,68 @@ No authorization required |-------------|-------------|------------------| | **200** | Partial Book Depth Streams | - | + +# **referencePrice** +> ReferencePriceResponse referencePrice(referencePriceRequest) + +WebSocket Reference Price Streams + + + +### Example +```java +// Import classes: +import com.binance.connector.client.spot.ApiClient; +import com.binance.connector.client.spot.ApiException; +import com.binance.connector.client.spot.Configuration; +import com.binance.connector.client.spot.models.*; +import com.binance.connector.client.spot.websocket.stream.api.WebSocketStreamsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + WebSocketStreamsApi apiInstance = new WebSocketStreamsApi(defaultClient); + ReferencePriceRequest referencePriceRequest = new ReferencePriceRequest(); // ReferencePriceRequest | + try { + ReferencePriceResponse result = apiInstance.referencePrice(referencePriceRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WebSocketStreamsApi#referencePrice"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **referencePriceRequest** | [**ReferencePriceRequest**](ReferencePriceRequest.md)| | | + +### Return type + +[**ReferencePriceResponse**](ReferencePriceResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Reference Price Streams | - | + # **rollingWindowTicker** > RollingWindowTickerResponse rollingWindowTicker(rollingWindowTickerRequest) diff --git a/clients/spot/docs/rest-api/migration-guide.md b/clients/spot/docs/rest-api/migration-guide.md index 0396f3ac6..47cc6e781 100644 --- a/clients/spot/docs/rest-api/migration-guide.md +++ b/clients/spot/docs/rest-api/migration-guide.md @@ -22,7 +22,7 @@ With the transition to a modularized structure, the Binance Connector has been s io.github.binance binance-spot - 9.0.0 + 10.0.0 ``` @@ -91,7 +91,7 @@ by: io.github.binance binance-spot - 9.0.0 + 10.0.0 ``` diff --git a/clients/spot/example_rest.md b/clients/spot/example_rest.md index b4e8bb7fe..c2f329c18 100644 --- a/clients/spot/example_rest.md +++ b/clients/spot/example_rest.md @@ -32,6 +32,8 @@ [GET /api/v3/exchangeInfo](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#exchange-information) - exchangeInfo - [ExchangeInfoExample.java:49](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/general/ExchangeInfoExample.java#L49) +[GET /api/v3/executionRules](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#query-execution-rules) - executionRules - [ExecutionRulesExample.java:49](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/general/ExecutionRulesExample.java#L49) + [GET /api/v3/ping](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#test-connectivity) - ping - [PingExample.java:44](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/general/PingExample.java#L44) [GET /api/v3/time](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#check-server-time) - time - [TimeExample.java:46](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/general/TimeExample.java#L46) @@ -50,6 +52,10 @@ [GET /api/v3/klines](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#klinecandlestick-data) - klines - [KlinesExample.java:48](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/KlinesExample.java#L48) +[GET /api/v3/referencePrice](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#query-reference-price) - referencePrice - [ReferencePriceExample.java:46](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/ReferencePriceExample.java#L46) + +[GET /api/v3/referencePrice/calculation](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#query-reference-price-calculation) - referencePriceCalculation - [ReferencePriceCalculationExample.java:47](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/ReferencePriceCalculationExample.java#L47) + [GET /api/v3/ticker](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#rolling-window-price-change-statistics) - ticker - [TickerExample.java:52](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/TickerExample.java#L52) [GET /api/v3/ticker/24hr](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#24hr-ticker-price-change-statistics) - ticker24hr - [Ticker24hrExample.java:59](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/Ticker24hrExample.java#L59) @@ -74,7 +80,7 @@ [PUT /api/v3/order/amend/keepPriority](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#order-amend-keep-priority-trade) - orderAmendKeepPriority - [OrderAmendKeepPriorityExample.java:49](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/trade/OrderAmendKeepPriorityExample.java#L49) -[POST /api/v3/order/cancelReplace](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#cancel-an-existing-order-and-send-a-new-order-trade) - orderCancelReplace - [OrderCancelReplaceExample.java:53](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/trade/OrderCancelReplaceExample.java#L53) +[POST /api/v3/order/cancelReplace](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#cancel-an-existing-order-and-send-a-new-order-trade) - orderCancelReplace - [OrderCancelReplaceExample.java:55](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/trade/OrderCancelReplaceExample.java#L55) [POST /api/v3/orderList/oco](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---oco-trade) - orderListOco - [OrderListOcoExample.java:62](/examples/spot/src/main/java/com/binance/connector/client/spot/rest/trade/OrderListOcoExample.java#L62) diff --git a/clients/spot/example_websocket_api.md b/clients/spot/example_websocket_api.md index 98a5f27a2..c6cccd646 100644 --- a/clients/spot/example_websocket_api.md +++ b/clients/spot/example_websocket_api.md @@ -40,6 +40,8 @@ [exchangeInfo](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/general-requests#exchange-information) - exchangeInfo - [ExchangeInfoExample.java:48](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/general/ExchangeInfoExample.java#L48) +[executionRules](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/general-requests#query-execution-rules) - executionRules - [ExecutionRulesExample.java:49](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/general/ExecutionRulesExample.java#L49) + [ping](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/general-requests#test-connectivity) - ping - [PingExample.java:47](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/general/PingExample.java#L47) [time](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/general-requests#check-server-time) - time - [TimeExample.java:47](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/general/TimeExample.java#L47) @@ -52,6 +54,10 @@ [klines](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#klines) - klines - [KlinesExample.java:53](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/KlinesExample.java#L53) +[referencePrice](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#query-reference-price) - referencePrice - [ReferencePriceExample.java:48](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/ReferencePriceExample.java#L48) + +[referencePrice.calculation](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#query-reference-price-calculation) - referencePriceCalculation - [ReferencePriceCalculationExample.java:48](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/ReferencePriceCalculationExample.java#L48) + [ticker](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#rolling-window-price-change-statistics) - ticker - [TickerExample.java:51](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/TickerExample.java#L51) [ticker.24hr](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/market-data-requests#24hr-ticker-price-change-statistics) - ticker24hr - [Ticker24hrExample.java:54](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/Ticker24hrExample.java#L54) @@ -78,7 +84,7 @@ [order.cancel](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-order-trade) - orderCancel - [OrderCancelExample.java:48](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/trade/OrderCancelExample.java#L48) -[order.cancelReplace](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-and-replace-order-trade) - orderCancelReplace - [OrderCancelReplaceExample.java:53](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/trade/OrderCancelReplaceExample.java#L53) +[order.cancelReplace](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-and-replace-order-trade) - orderCancelReplace - [OrderCancelReplaceExample.java:55](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/trade/OrderCancelReplaceExample.java#L55) [orderList.cancel](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-order-list-trade) - orderListCancel - [OrderListCancelExample.java:48](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/trade/OrderListCancelExample.java#L48) diff --git a/clients/spot/example_websocket_stream.md b/clients/spot/example_websocket_stream.md index 750c31b4f..37e062e83 100644 --- a/clients/spot/example_websocket_stream.md +++ b/clients/spot/example_websocket_stream.md @@ -20,6 +20,8 @@ [@depth@](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#partial-book-depth-streams) - partialBookDepth - [PartialBookDepthExample.java:45](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/websocketstreams/PartialBookDepthExample.java#L45) +[@referencePrice](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#reference-price-streams) - referencePrice - [ReferencePriceExample.java:41](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/websocketstreams/ReferencePriceExample.java#L41) + [@ticker_](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-rolling-window-statistics-streams) - rollingWindowTicker - [RollingWindowTickerExample.java:44](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/websocketstreams/RollingWindowTickerExample.java#L44) [@ticker](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-ticker-streams) - ticker - [TickerExample.java:44](/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/websocketstreams/TickerExample.java#L44) diff --git a/clients/spot/pom.xml b/clients/spot/pom.xml index 3a6b1b035..7568b2812 100644 --- a/clients/spot/pom.xml +++ b/clients/spot/pom.xml @@ -5,7 +5,7 @@ 4.0.0 binance-spot spot - 9.0.0 + 10.0.0 jar @@ -31,7 +31,7 @@ io.github.binance binance-common - 2.3.1 + 2.4.1 \ No newline at end of file diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/JSON.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/JSON.java index fa49a22a1..d9a5d6544 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/JSON.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/JSON.java @@ -429,6 +429,16 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.spot.rest.model.ExchangeMaxNumOrdersFilter .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.rest.model.ExecutionRulesResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.rest.model + .ExecutionRulesResponseSymbolRulesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.rest.model + .ExecutionRulesResponseSymbolRulesInnerRulesInner + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.spot.rest.model.GetAccountResponse .CustomTypeAdapterFactory()); @@ -694,6 +704,12 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.spot.rest.model.RateLimits .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.rest.model.ReferencePriceCalculationResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.rest.model.ReferencePriceResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.spot.rest.model.SorOrderRequest .CustomTypeAdapterFactory()); diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/AccountApi.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/AccountApi.java index fe6da5d1e..bae7e0335 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/AccountApi.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/AccountApi.java @@ -56,7 +56,7 @@ public class AccountApi { private static final String USER_AGENT = String.format( - "binance-spot/9.0.0 (Java/%s; %s; %s)", + "binance-spot/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = true; diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/GeneralApi.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/GeneralApi.java index fc5e3a489..fc7d77cbd 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/GeneralApi.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/GeneralApi.java @@ -21,6 +21,7 @@ import com.binance.connector.client.common.configuration.ClientConfiguration; import com.binance.connector.client.common.exception.ConstraintViolationException; import com.binance.connector.client.spot.rest.model.ExchangeInfoResponse; +import com.binance.connector.client.spot.rest.model.ExecutionRulesResponse; import com.binance.connector.client.spot.rest.model.Permissions; import com.binance.connector.client.spot.rest.model.SymbolStatus; import com.binance.connector.client.spot.rest.model.Symbols; @@ -47,7 +48,7 @@ public class GeneralApi { private static final String USER_AGENT = String.format( - "binance-spot/9.0.0 (Java/%s; %s; %s)", + "binance-spot/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = true; @@ -275,6 +276,161 @@ public ApiResponse exchangeInfo( return localVarApiClient.execute(localVarCall, localVarReturnType); } + /** + * Build call for executionRules + * + * @param symbol Symbol to query (optional) + * @param symbols List of symbols to query (optional) + * @param symbolStatus (optional) + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Execution Rules -
+ * + * @see Query + * Execution Rules Documentation + */ + private okhttp3.Call executionRulesCall( + String symbol, Symbols symbols, SymbolStatus symbolStatus) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v3/executionRules"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (symbol != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbol", symbol)); + } + + if (symbols != null) { + String json = JSON.getGson().toJson(symbols); + localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbols", json)); + } + + if (symbolStatus != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("symbolStatus", symbolStatus)); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + Set localVarAuthNames = new HashSet<>(); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executionRulesValidateBeforeCall( + String symbol, Symbols symbols, SymbolStatus symbolStatus) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {symbol, symbols, symbolStatus}; + Method method = + this.getClass() + .getMethod( + "executionRules", + String.class, + Symbols.class, + SymbolStatus.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return executionRulesCall(symbol, symbols, symbolStatus); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Query Execution Rules Weight: Parameter | Weight| --- | --- `symbol` | 2 + * `symbols` | 2 for each `symbol`, capped at a max of 40| + * `symbolStatus` |40| None |40| + * + * @param symbol Symbol to query (optional) + * @param symbols List of symbols to query (optional) + * @param symbolStatus (optional) + * @return ApiResponse<ExecutionRulesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Execution Rules -
+ * + * @see Query + * Execution Rules Documentation + */ + public ApiResponse executionRules( + String symbol, Symbols symbols, SymbolStatus symbolStatus) throws ApiException { + okhttp3.Call localVarCall = executionRulesValidateBeforeCall(symbol, symbols, symbolStatus); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + /** * Build call for ping * diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/MarketApi.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/MarketApi.java index 8802f3904..9dd928ea0 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/MarketApi.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/MarketApi.java @@ -27,6 +27,8 @@ import com.binance.connector.client.spot.rest.model.HistoricalTradesResponse; import com.binance.connector.client.spot.rest.model.Interval; import com.binance.connector.client.spot.rest.model.KlinesResponse; +import com.binance.connector.client.spot.rest.model.ReferencePriceCalculationResponse; +import com.binance.connector.client.spot.rest.model.ReferencePriceResponse; import com.binance.connector.client.spot.rest.model.SymbolStatus; import com.binance.connector.client.spot.rest.model.Symbols; import com.binance.connector.client.spot.rest.model.Ticker24hrResponse; @@ -59,7 +61,7 @@ public class MarketApi { private static final String USER_AGENT = String.format( - "binance-spot/9.0.0 (Java/%s; %s; %s)", + "binance-spot/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = true; @@ -1018,6 +1020,282 @@ public ApiResponse klines( return localVarApiClient.execute(localVarCall, localVarReturnType); } + /** + * Build call for referencePrice + * + * @param symbol (required) + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Reference Price -
+ * + * @see Query + * Reference Price Documentation + */ + private okhttp3.Call referencePriceCall(String symbol) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v3/referencePrice"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (symbol != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbol", symbol)); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + Set localVarAuthNames = new HashSet<>(); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call referencePriceValidateBeforeCall(String symbol) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {symbol}; + Method method = this.getClass().getMethod("referencePrice", String.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return referencePriceCall(symbol); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Query Reference Price Weight: 2 + * + * @param symbol (required) + * @return ApiResponse<ReferencePriceResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Reference Price -
+ * + * @see Query + * Reference Price Documentation + */ + public ApiResponse referencePrice(@NotNull String symbol) + throws ApiException { + okhttp3.Call localVarCall = referencePriceValidateBeforeCall(symbol); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Build call for referencePriceCalculation + * + * @param symbol (required) + * @param symbolStatus (optional) + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Reference Price Calculation -
+ * + * @see Query + * Reference Price Calculation Documentation + */ + private okhttp3.Call referencePriceCalculationCall(String symbol, SymbolStatus symbolStatus) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api/v3/referencePrice/calculation"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (symbol != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbol", symbol)); + } + + if (symbolStatus != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("symbolStatus", symbolStatus)); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (!localVarFormParams.isEmpty() && localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + Set localVarAuthNames = new HashSet<>(); + if (HAS_TIME_UNIT) { + localVarAuthNames.add("timeUnit"); + } + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call referencePriceCalculationValidateBeforeCall( + String symbol, SymbolStatus symbolStatus) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + ExecutableValidator executableValidator = validator.forExecutables(); + + Object[] parameterValues = {symbol, symbolStatus}; + Method method = + this.getClass() + .getMethod( + "referencePriceCalculation", String.class, SymbolStatus.class); + Set> violations = + executableValidator.validateParameters(this, method, parameterValues); + + if (violations.size() == 0) { + return referencePriceCalculationCall(symbol, symbolStatus); + } else { + throw new ConstraintViolationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * Query Reference Price Calculation Describes how reference price is calculated for a given + * symbol. Weight: 2 + * + * @param symbol (required) + * @param symbolStatus (optional) + * @return ApiResponse<ReferencePriceCalculationResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Reference Price Calculation -
+ * + * @see Query + * Reference Price Calculation Documentation + */ + public ApiResponse referencePriceCalculation( + @NotNull String symbol, SymbolStatus symbolStatus) throws ApiException { + okhttp3.Call localVarCall = + referencePriceCalculationValidateBeforeCall(symbol, symbolStatus); + java.lang.reflect.Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + /** * Build call for ticker * diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/SpotRestApi.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/SpotRestApi.java index 317aecdca..3b0b1ebc9 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/SpotRestApi.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/SpotRestApi.java @@ -16,6 +16,7 @@ import com.binance.connector.client.spot.rest.model.DeleteOrderResponse; import com.binance.connector.client.spot.rest.model.DepthResponse; import com.binance.connector.client.spot.rest.model.ExchangeInfoResponse; +import com.binance.connector.client.spot.rest.model.ExecutionRulesResponse; import com.binance.connector.client.spot.rest.model.GetAccountResponse; import com.binance.connector.client.spot.rest.model.GetOpenOrdersResponse; import com.binance.connector.client.spot.rest.model.GetOrderListResponse; @@ -52,6 +53,8 @@ import com.binance.connector.client.spot.rest.model.OrderTestResponse; import com.binance.connector.client.spot.rest.model.Permissions; import com.binance.connector.client.spot.rest.model.RateLimitOrderResponse; +import com.binance.connector.client.spot.rest.model.ReferencePriceCalculationResponse; +import com.binance.connector.client.spot.rest.model.ReferencePriceResponse; import com.binance.connector.client.spot.rest.model.SorOrderRequest; import com.binance.connector.client.spot.rest.model.SorOrderResponse; import com.binance.connector.client.spot.rest.model.SorOrderTestRequest; @@ -552,6 +555,33 @@ public ApiResponse exchangeInfo( symbol, symbols, permissions, showPermissionSets, symbolStatus); } + /** + * Query Execution Rules Weight: Parameter | Weight| --- | --- `symbol` | 2 + * `symbols` | 2 for each `symbol`, capped at a max of 40| + * `symbolStatus` |40| None |40| + * + * @param symbol Symbol to query (optional) + * @param symbols List of symbols to query (optional) + * @param symbolStatus (optional) + * @return ApiResponse<ExecutionRulesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Execution Rules -
+ * + * @see Query + * Execution Rules Documentation + */ + public ApiResponse executionRules( + String symbol, Symbols symbols, SymbolStatus symbolStatus) throws ApiException { + return generalApi.executionRules(symbol, symbols, symbolStatus); + } + /** * Test connectivity Test connectivity to the Rest API. Weight: 1 * @@ -757,6 +787,53 @@ public ApiResponse klines( return marketApi.klines(symbol, interval, startTime, endTime, timeZone, limit); } + /** + * Query Reference Price Weight: 2 + * + * @param symbol (required) + * @return ApiResponse<ReferencePriceResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Reference Price -
+ * + * @see Query + * Reference Price Documentation + */ + public ApiResponse referencePrice(String symbol) throws ApiException { + return marketApi.referencePrice(symbol); + } + + /** + * Query Reference Price Calculation Describes how reference price is calculated for a given + * symbol. Weight: 2 + * + * @param symbol (required) + * @param symbolStatus (optional) + * @return ApiResponse<ReferencePriceCalculationResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Reference Price Calculation -
+ * + * @see Query + * Reference Price Calculation Documentation + */ + public ApiResponse referencePriceCalculation( + String symbol, SymbolStatus symbolStatus) throws ApiException { + return marketApi.referencePriceCalculation(symbol, symbolStatus); + } + /** * Rolling window price change statistics Weight: 4 for each requested * <tt>symbol</tt> regardless of <tt>windowSize</tt>. @@ -1121,11 +1198,12 @@ public ApiResponse orderAmendKeepPriority( } /** - * Cancel an Existing Order and Send a New Order Cancels an existing order and places a new - * order on the same symbol. Filters and Order Count are evaluated before the processing of the - * cancellation and order placement occurs. A new order that was not attempted (i.e. when + * Cancel an Existing Order and Send a New Order * Cancels an existing order and places a new + * order on the same symbol. * Filters and Order Count are evaluated before the processing of + * the cancellation and order placement occurs. * A new order that was not attempted (i.e. when * `newOrderResult: NOT_ATTEMPTED`), will still increase the unfilled order count by - * 1. Weight: 1 + * 1. * You can only cancel an individual order from an orderList using this endpoint, but the + * result is the same as canceling the entire orderList. Weight: 1 * * @param orderCancelReplaceRequest (required) * @return ApiResponse<OrderCancelReplaceResponse> diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/TradeApi.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/TradeApi.java index d66a55291..2d4f788cd 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/TradeApi.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/api/TradeApi.java @@ -71,7 +71,7 @@ public class TradeApi { private static final String USER_AGENT = String.format( - "binance-spot/9.0.0 (Java/%s; %s; %s)", + "binance-spot/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = true; @@ -1298,11 +1298,12 @@ private okhttp3.Call orderCancelReplaceValidateBeforeCall( } /** - * Cancel an Existing Order and Send a New Order Cancels an existing order and places a new - * order on the same symbol. Filters and Order Count are evaluated before the processing of the - * cancellation and order placement occurs. A new order that was not attempted (i.e. when + * Cancel an Existing Order and Send a New Order * Cancels an existing order and places a new + * order on the same symbol. * Filters and Order Count are evaluated before the processing of + * the cancellation and order placement occurs. * A new order that was not attempted (i.e. when * `newOrderResult: NOT_ATTEMPTED`), will still increase the unfilled order count by - * 1. Weight: 1 + * 1. * You can only cancel an individual order from an orderList using this endpoint, but the + * result is the same as canceling the entire orderList. Weight: 1 * * @param orderCancelReplaceRequest (required) * @return ApiResponse<OrderCancelReplaceResponse> diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponse.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponse.java new file mode 100644 index 000000000..4e20bb791 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponse.java @@ -0,0 +1,245 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.rest.model; + +import com.binance.connector.client.spot.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ExecutionRulesResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ExecutionRulesResponse { + public static final String SERIALIZED_NAME_SYMBOL_RULES = "symbolRules"; + + @SerializedName(SERIALIZED_NAME_SYMBOL_RULES) + @jakarta.annotation.Nullable + private List<@Valid ExecutionRulesResponseSymbolRulesInner> symbolRules; + + public ExecutionRulesResponse() {} + + public ExecutionRulesResponse symbolRules( + @jakarta.annotation.Nullable + List<@Valid ExecutionRulesResponseSymbolRulesInner> symbolRules) { + this.symbolRules = symbolRules; + return this; + } + + public ExecutionRulesResponse addSymbolRulesItem( + ExecutionRulesResponseSymbolRulesInner symbolRulesItem) { + if (this.symbolRules == null) { + this.symbolRules = new ArrayList<>(); + } + this.symbolRules.add(symbolRulesItem); + return this; + } + + /** + * Get symbolRules + * + * @return symbolRules + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ExecutionRulesResponseSymbolRulesInner> getSymbolRules() { + return symbolRules; + } + + public void setSymbolRules( + @jakarta.annotation.Nullable + List<@Valid ExecutionRulesResponseSymbolRulesInner> symbolRules) { + this.symbolRules = symbolRules; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecutionRulesResponse executionRulesResponse = (ExecutionRulesResponse) o; + return Objects.equals(this.symbolRules, executionRulesResponse.symbolRules); + } + + @Override + public int hashCode() { + return Objects.hash(symbolRules); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecutionRulesResponse {\n"); + sb.append(" symbolRules: ").append(toIndentedString(symbolRules)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object symbolRulesValue = getSymbolRules(); + String symbolRulesValueAsString = ""; + symbolRulesValueAsString = + (String) + ((Collection) symbolRulesValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("symbolRules=").append(urlEncode(symbolRulesValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbolRules"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecutionRulesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecutionRulesResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ExecutionRulesResponse is not found in" + + " the empty JSON string", + ExecutionRulesResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("symbolRules") != null && !jsonObj.get("symbolRules").isJsonNull()) { + JsonArray jsonArraysymbolRules = jsonObj.getAsJsonArray("symbolRules"); + if (jsonArraysymbolRules != null) { + // ensure the json data is an array + if (!jsonObj.get("symbolRules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbolRules` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("symbolRules").toString())); + } + + // validate the optional field `symbolRules` (array) + for (int i = 0; i < jsonArraysymbolRules.size(); i++) { + ExecutionRulesResponseSymbolRulesInner.validateJsonElement( + jsonArraysymbolRules.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecutionRulesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecutionRulesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ExecutionRulesResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecutionRulesResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecutionRulesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ExecutionRulesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecutionRulesResponse + * @throws IOException if the JSON string is invalid with respect to ExecutionRulesResponse + */ + public static ExecutionRulesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecutionRulesResponse.class); + } + + /** + * Convert an instance of ExecutionRulesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponseSymbolRulesInner.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponseSymbolRulesInner.java new file mode 100644 index 000000000..09fa24ac1 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponseSymbolRulesInner.java @@ -0,0 +1,295 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.rest.model; + +import com.binance.connector.client.spot.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ExecutionRulesResponseSymbolRulesInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ExecutionRulesResponseSymbolRulesInner { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_RULES = "rules"; + + @SerializedName(SERIALIZED_NAME_RULES) + @jakarta.annotation.Nullable + private List<@Valid ExecutionRulesResponseSymbolRulesInnerRulesInner> rules; + + public ExecutionRulesResponseSymbolRulesInner() {} + + public ExecutionRulesResponseSymbolRulesInner symbol( + @jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public ExecutionRulesResponseSymbolRulesInner rules( + @jakarta.annotation.Nullable + List<@Valid ExecutionRulesResponseSymbolRulesInnerRulesInner> rules) { + this.rules = rules; + return this; + } + + public ExecutionRulesResponseSymbolRulesInner addRulesItem( + ExecutionRulesResponseSymbolRulesInnerRulesInner rulesItem) { + if (this.rules == null) { + this.rules = new ArrayList<>(); + } + this.rules.add(rulesItem); + return this; + } + + /** + * Get rules + * + * @return rules + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ExecutionRulesResponseSymbolRulesInnerRulesInner> getRules() { + return rules; + } + + public void setRules( + @jakarta.annotation.Nullable + List<@Valid ExecutionRulesResponseSymbolRulesInnerRulesInner> rules) { + this.rules = rules; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecutionRulesResponseSymbolRulesInner executionRulesResponseSymbolRulesInner = + (ExecutionRulesResponseSymbolRulesInner) o; + return Objects.equals(this.symbol, executionRulesResponseSymbolRulesInner.symbol) + && Objects.equals(this.rules, executionRulesResponseSymbolRulesInner.rules); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, rules); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecutionRulesResponseSymbolRulesInner {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object symbolValue = getSymbol(); + String symbolValueAsString = ""; + symbolValueAsString = symbolValue.toString(); + sb.append("symbol=").append(urlEncode(symbolValueAsString)).append(""); + Object rulesValue = getRules(); + String rulesValueAsString = ""; + rulesValueAsString = + (String) + ((Collection) rulesValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("rules=").append(urlEncode(rulesValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("rules"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ExecutionRulesResponseSymbolRulesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecutionRulesResponseSymbolRulesInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ExecutionRulesResponseSymbolRulesInner" + + " is not found in the empty JSON string", + ExecutionRulesResponseSymbolRulesInner.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + if (jsonObj.get("rules") != null && !jsonObj.get("rules").isJsonNull()) { + JsonArray jsonArrayrules = jsonObj.getAsJsonArray("rules"); + if (jsonArrayrules != null) { + // ensure the json data is an array + if (!jsonObj.get("rules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `rules` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("rules").toString())); + } + + // validate the optional field `rules` (array) + for (int i = 0; i < jsonArrayrules.size(); i++) { + ExecutionRulesResponseSymbolRulesInnerRulesInner.validateJsonElement( + jsonArrayrules.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecutionRulesResponseSymbolRulesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecutionRulesResponseSymbolRulesInner' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ExecutionRulesResponseSymbolRulesInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, ExecutionRulesResponseSymbolRulesInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecutionRulesResponseSymbolRulesInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ExecutionRulesResponseSymbolRulesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecutionRulesResponseSymbolRulesInner + * @throws IOException if the JSON string is invalid with respect to + * ExecutionRulesResponseSymbolRulesInner + */ + public static ExecutionRulesResponseSymbolRulesInner fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, ExecutionRulesResponseSymbolRulesInner.class); + } + + /** + * Convert an instance of ExecutionRulesResponseSymbolRulesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponseSymbolRulesInnerRulesInner.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponseSymbolRulesInnerRulesInner.java new file mode 100644 index 000000000..fcb7f7473 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ExecutionRulesResponseSymbolRulesInnerRulesInner.java @@ -0,0 +1,403 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.rest.model; + +import com.binance.connector.client.spot.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** ExecutionRulesResponseSymbolRulesInnerRulesInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ExecutionRulesResponseSymbolRulesInnerRulesInner { + public static final String SERIALIZED_NAME_RULE_TYPE = "ruleType"; + + @SerializedName(SERIALIZED_NAME_RULE_TYPE) + @jakarta.annotation.Nullable + private String ruleType; + + public static final String SERIALIZED_NAME_BID_LIMIT_MULT_UP = "bidLimitMultUp"; + + @SerializedName(SERIALIZED_NAME_BID_LIMIT_MULT_UP) + @jakarta.annotation.Nullable + private String bidLimitMultUp; + + public static final String SERIALIZED_NAME_BID_LIMIT_MULT_DOWN = "bidLimitMultDown"; + + @SerializedName(SERIALIZED_NAME_BID_LIMIT_MULT_DOWN) + @jakarta.annotation.Nullable + private String bidLimitMultDown; + + public static final String SERIALIZED_NAME_ASK_LIMIT_MULT_UP = "askLimitMultUp"; + + @SerializedName(SERIALIZED_NAME_ASK_LIMIT_MULT_UP) + @jakarta.annotation.Nullable + private String askLimitMultUp; + + public static final String SERIALIZED_NAME_ASK_LIMIT_MULT_DOWN = "askLimitMultDown"; + + @SerializedName(SERIALIZED_NAME_ASK_LIMIT_MULT_DOWN) + @jakarta.annotation.Nullable + private String askLimitMultDown; + + public ExecutionRulesResponseSymbolRulesInnerRulesInner() {} + + public ExecutionRulesResponseSymbolRulesInnerRulesInner ruleType( + @jakarta.annotation.Nullable String ruleType) { + this.ruleType = ruleType; + return this; + } + + /** + * Get ruleType + * + * @return ruleType + */ + @jakarta.annotation.Nullable + public String getRuleType() { + return ruleType; + } + + public void setRuleType(@jakarta.annotation.Nullable String ruleType) { + this.ruleType = ruleType; + } + + public ExecutionRulesResponseSymbolRulesInnerRulesInner bidLimitMultUp( + @jakarta.annotation.Nullable String bidLimitMultUp) { + this.bidLimitMultUp = bidLimitMultUp; + return this; + } + + /** + * Get bidLimitMultUp + * + * @return bidLimitMultUp + */ + @jakarta.annotation.Nullable + public String getBidLimitMultUp() { + return bidLimitMultUp; + } + + public void setBidLimitMultUp(@jakarta.annotation.Nullable String bidLimitMultUp) { + this.bidLimitMultUp = bidLimitMultUp; + } + + public ExecutionRulesResponseSymbolRulesInnerRulesInner bidLimitMultDown( + @jakarta.annotation.Nullable String bidLimitMultDown) { + this.bidLimitMultDown = bidLimitMultDown; + return this; + } + + /** + * Get bidLimitMultDown + * + * @return bidLimitMultDown + */ + @jakarta.annotation.Nullable + public String getBidLimitMultDown() { + return bidLimitMultDown; + } + + public void setBidLimitMultDown(@jakarta.annotation.Nullable String bidLimitMultDown) { + this.bidLimitMultDown = bidLimitMultDown; + } + + public ExecutionRulesResponseSymbolRulesInnerRulesInner askLimitMultUp( + @jakarta.annotation.Nullable String askLimitMultUp) { + this.askLimitMultUp = askLimitMultUp; + return this; + } + + /** + * Get askLimitMultUp + * + * @return askLimitMultUp + */ + @jakarta.annotation.Nullable + public String getAskLimitMultUp() { + return askLimitMultUp; + } + + public void setAskLimitMultUp(@jakarta.annotation.Nullable String askLimitMultUp) { + this.askLimitMultUp = askLimitMultUp; + } + + public ExecutionRulesResponseSymbolRulesInnerRulesInner askLimitMultDown( + @jakarta.annotation.Nullable String askLimitMultDown) { + this.askLimitMultDown = askLimitMultDown; + return this; + } + + /** + * Get askLimitMultDown + * + * @return askLimitMultDown + */ + @jakarta.annotation.Nullable + public String getAskLimitMultDown() { + return askLimitMultDown; + } + + public void setAskLimitMultDown(@jakarta.annotation.Nullable String askLimitMultDown) { + this.askLimitMultDown = askLimitMultDown; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecutionRulesResponseSymbolRulesInnerRulesInner + executionRulesResponseSymbolRulesInnerRulesInner = + (ExecutionRulesResponseSymbolRulesInnerRulesInner) o; + return Objects.equals( + this.ruleType, executionRulesResponseSymbolRulesInnerRulesInner.ruleType) + && Objects.equals( + this.bidLimitMultUp, + executionRulesResponseSymbolRulesInnerRulesInner.bidLimitMultUp) + && Objects.equals( + this.bidLimitMultDown, + executionRulesResponseSymbolRulesInnerRulesInner.bidLimitMultDown) + && Objects.equals( + this.askLimitMultUp, + executionRulesResponseSymbolRulesInnerRulesInner.askLimitMultUp) + && Objects.equals( + this.askLimitMultDown, + executionRulesResponseSymbolRulesInnerRulesInner.askLimitMultDown); + } + + @Override + public int hashCode() { + return Objects.hash( + ruleType, bidLimitMultUp, bidLimitMultDown, askLimitMultUp, askLimitMultDown); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecutionRulesResponseSymbolRulesInnerRulesInner {\n"); + sb.append(" ruleType: ").append(toIndentedString(ruleType)).append("\n"); + sb.append(" bidLimitMultUp: ").append(toIndentedString(bidLimitMultUp)).append("\n"); + sb.append(" bidLimitMultDown: ").append(toIndentedString(bidLimitMultDown)).append("\n"); + sb.append(" askLimitMultUp: ").append(toIndentedString(askLimitMultUp)).append("\n"); + sb.append(" askLimitMultDown: ").append(toIndentedString(askLimitMultDown)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object ruleTypeValue = getRuleType(); + String ruleTypeValueAsString = ""; + ruleTypeValueAsString = ruleTypeValue.toString(); + sb.append("ruleType=").append(urlEncode(ruleTypeValueAsString)).append(""); + Object bidLimitMultUpValue = getBidLimitMultUp(); + String bidLimitMultUpValueAsString = ""; + bidLimitMultUpValueAsString = bidLimitMultUpValue.toString(); + sb.append("bidLimitMultUp=").append(urlEncode(bidLimitMultUpValueAsString)).append(""); + Object bidLimitMultDownValue = getBidLimitMultDown(); + String bidLimitMultDownValueAsString = ""; + bidLimitMultDownValueAsString = bidLimitMultDownValue.toString(); + sb.append("bidLimitMultDown=").append(urlEncode(bidLimitMultDownValueAsString)).append(""); + Object askLimitMultUpValue = getAskLimitMultUp(); + String askLimitMultUpValueAsString = ""; + askLimitMultUpValueAsString = askLimitMultUpValue.toString(); + sb.append("askLimitMultUp=").append(urlEncode(askLimitMultUpValueAsString)).append(""); + Object askLimitMultDownValue = getAskLimitMultDown(); + String askLimitMultDownValueAsString = ""; + askLimitMultDownValueAsString = askLimitMultDownValue.toString(); + sb.append("askLimitMultDown=").append(urlEncode(askLimitMultDownValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("ruleType"); + openapiFields.add("bidLimitMultUp"); + openapiFields.add("bidLimitMultDown"); + openapiFields.add("askLimitMultUp"); + openapiFields.add("askLimitMultDown"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ExecutionRulesResponseSymbolRulesInnerRulesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecutionRulesResponseSymbolRulesInnerRulesInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " ExecutionRulesResponseSymbolRulesInnerRulesInner is not" + + " found in the empty JSON string", + ExecutionRulesResponseSymbolRulesInnerRulesInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("ruleType") != null && !jsonObj.get("ruleType").isJsonNull()) + && !jsonObj.get("ruleType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `ruleType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("ruleType").toString())); + } + if ((jsonObj.get("bidLimitMultUp") != null && !jsonObj.get("bidLimitMultUp").isJsonNull()) + && !jsonObj.get("bidLimitMultUp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bidLimitMultUp` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("bidLimitMultUp").toString())); + } + if ((jsonObj.get("bidLimitMultDown") != null + && !jsonObj.get("bidLimitMultDown").isJsonNull()) + && !jsonObj.get("bidLimitMultDown").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bidLimitMultDown` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("bidLimitMultDown").toString())); + } + if ((jsonObj.get("askLimitMultUp") != null && !jsonObj.get("askLimitMultUp").isJsonNull()) + && !jsonObj.get("askLimitMultUp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `askLimitMultUp` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("askLimitMultUp").toString())); + } + if ((jsonObj.get("askLimitMultDown") != null + && !jsonObj.get("askLimitMultDown").isJsonNull()) + && !jsonObj.get("askLimitMultDown").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `askLimitMultDown` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("askLimitMultDown").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecutionRulesResponseSymbolRulesInnerRulesInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'ExecutionRulesResponseSymbolRulesInnerRulesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(ExecutionRulesResponseSymbolRulesInnerRulesInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + ExecutionRulesResponseSymbolRulesInnerRulesInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecutionRulesResponseSymbolRulesInnerRulesInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ExecutionRulesResponseSymbolRulesInnerRulesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecutionRulesResponseSymbolRulesInnerRulesInner + * @throws IOException if the JSON string is invalid with respect to + * ExecutionRulesResponseSymbolRulesInnerRulesInner + */ + public static ExecutionRulesResponseSymbolRulesInnerRulesInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, ExecutionRulesResponseSymbolRulesInnerRulesInner.class); + } + + /** + * Convert an instance of ExecutionRulesResponseSymbolRulesInnerRulesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ReferencePriceCalculationResponse.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ReferencePriceCalculationResponse.java new file mode 100644 index 000000000..a7a256db3 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ReferencePriceCalculationResponse.java @@ -0,0 +1,366 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.rest.model; + +import com.binance.connector.client.spot.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** ReferencePriceCalculationResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ReferencePriceCalculationResponse { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_CALCULATION_TYPE = "calculationType"; + + @SerializedName(SERIALIZED_NAME_CALCULATION_TYPE) + @jakarta.annotation.Nullable + private String calculationType; + + public static final String SERIALIZED_NAME_BUCKET_COUNT = "bucketCount"; + + @SerializedName(SERIALIZED_NAME_BUCKET_COUNT) + @jakarta.annotation.Nullable + private Long bucketCount; + + public static final String SERIALIZED_NAME_BUCKET_WIDTH_MS = "bucketWidthMs"; + + @SerializedName(SERIALIZED_NAME_BUCKET_WIDTH_MS) + @jakarta.annotation.Nullable + private Long bucketWidthMs; + + public static final String SERIALIZED_NAME_EXTERNAL_CALCULATION_ID = "externalCalculationId"; + + @SerializedName(SERIALIZED_NAME_EXTERNAL_CALCULATION_ID) + @jakarta.annotation.Nullable + private Long externalCalculationId; + + public ReferencePriceCalculationResponse() {} + + public ReferencePriceCalculationResponse symbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public ReferencePriceCalculationResponse calculationType( + @jakarta.annotation.Nullable String calculationType) { + this.calculationType = calculationType; + return this; + } + + /** + * Get calculationType + * + * @return calculationType + */ + @jakarta.annotation.Nullable + public String getCalculationType() { + return calculationType; + } + + public void setCalculationType(@jakarta.annotation.Nullable String calculationType) { + this.calculationType = calculationType; + } + + public ReferencePriceCalculationResponse bucketCount( + @jakarta.annotation.Nullable Long bucketCount) { + this.bucketCount = bucketCount; + return this; + } + + /** + * Get bucketCount + * + * @return bucketCount + */ + @jakarta.annotation.Nullable + public Long getBucketCount() { + return bucketCount; + } + + public void setBucketCount(@jakarta.annotation.Nullable Long bucketCount) { + this.bucketCount = bucketCount; + } + + public ReferencePriceCalculationResponse bucketWidthMs( + @jakarta.annotation.Nullable Long bucketWidthMs) { + this.bucketWidthMs = bucketWidthMs; + return this; + } + + /** + * Get bucketWidthMs + * + * @return bucketWidthMs + */ + @jakarta.annotation.Nullable + public Long getBucketWidthMs() { + return bucketWidthMs; + } + + public void setBucketWidthMs(@jakarta.annotation.Nullable Long bucketWidthMs) { + this.bucketWidthMs = bucketWidthMs; + } + + public ReferencePriceCalculationResponse externalCalculationId( + @jakarta.annotation.Nullable Long externalCalculationId) { + this.externalCalculationId = externalCalculationId; + return this; + } + + /** + * Get externalCalculationId + * + * @return externalCalculationId + */ + @jakarta.annotation.Nullable + public Long getExternalCalculationId() { + return externalCalculationId; + } + + public void setExternalCalculationId(@jakarta.annotation.Nullable Long externalCalculationId) { + this.externalCalculationId = externalCalculationId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferencePriceCalculationResponse referencePriceCalculationResponse = + (ReferencePriceCalculationResponse) o; + return Objects.equals(this.symbol, referencePriceCalculationResponse.symbol) + && Objects.equals( + this.calculationType, referencePriceCalculationResponse.calculationType) + && Objects.equals(this.bucketCount, referencePriceCalculationResponse.bucketCount) + && Objects.equals( + this.bucketWidthMs, referencePriceCalculationResponse.bucketWidthMs) + && Objects.equals( + this.externalCalculationId, + referencePriceCalculationResponse.externalCalculationId); + } + + @Override + public int hashCode() { + return Objects.hash( + symbol, calculationType, bucketCount, bucketWidthMs, externalCalculationId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencePriceCalculationResponse {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); + sb.append(" bucketCount: ").append(toIndentedString(bucketCount)).append("\n"); + sb.append(" bucketWidthMs: ").append(toIndentedString(bucketWidthMs)).append("\n"); + sb.append(" externalCalculationId: ") + .append(toIndentedString(externalCalculationId)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object symbolValue = getSymbol(); + String symbolValueAsString = ""; + symbolValueAsString = symbolValue.toString(); + sb.append("symbol=").append(urlEncode(symbolValueAsString)).append(""); + Object calculationTypeValue = getCalculationType(); + String calculationTypeValueAsString = ""; + calculationTypeValueAsString = calculationTypeValue.toString(); + sb.append("calculationType=").append(urlEncode(calculationTypeValueAsString)).append(""); + Object bucketCountValue = getBucketCount(); + String bucketCountValueAsString = ""; + bucketCountValueAsString = bucketCountValue.toString(); + sb.append("bucketCount=").append(urlEncode(bucketCountValueAsString)).append(""); + Object bucketWidthMsValue = getBucketWidthMs(); + String bucketWidthMsValueAsString = ""; + bucketWidthMsValueAsString = bucketWidthMsValue.toString(); + sb.append("bucketWidthMs=").append(urlEncode(bucketWidthMsValueAsString)).append(""); + Object externalCalculationIdValue = getExternalCalculationId(); + String externalCalculationIdValueAsString = ""; + externalCalculationIdValueAsString = externalCalculationIdValue.toString(); + sb.append("externalCalculationId=") + .append(urlEncode(externalCalculationIdValueAsString)) + .append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("calculationType"); + openapiFields.add("bucketCount"); + openapiFields.add("bucketWidthMs"); + openapiFields.add("externalCalculationId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ReferencePriceCalculationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencePriceCalculationResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReferencePriceCalculationResponse is" + + " not found in the empty JSON string", + ReferencePriceCalculationResponse.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("calculationType") != null && !jsonObj.get("calculationType").isJsonNull()) + && !jsonObj.get("calculationType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `calculationType` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("calculationType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencePriceCalculationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferencePriceCalculationResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ReferencePriceCalculationResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferencePriceCalculationResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencePriceCalculationResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReferencePriceCalculationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencePriceCalculationResponse + * @throws IOException if the JSON string is invalid with respect to + * ReferencePriceCalculationResponse + */ + public static ReferencePriceCalculationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencePriceCalculationResponse.class); + } + + /** + * Convert an instance of ReferencePriceCalculationResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ReferencePriceResponse.java b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ReferencePriceResponse.java new file mode 100644 index 000000000..6b3f2dea6 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/rest/model/ReferencePriceResponse.java @@ -0,0 +1,283 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.rest.model; + +import com.binance.connector.client.spot.rest.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Objects; +import org.hibernate.validator.constraints.*; + +/** ReferencePriceResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ReferencePriceResponse { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_REFERENCE_PRICE = "referencePrice"; + + @SerializedName(SERIALIZED_NAME_REFERENCE_PRICE) + @jakarta.annotation.Nullable + private String referencePrice; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public ReferencePriceResponse() {} + + public ReferencePriceResponse symbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public ReferencePriceResponse referencePrice( + @jakarta.annotation.Nullable String referencePrice) { + this.referencePrice = referencePrice; + return this; + } + + /** + * Get referencePrice + * + * @return referencePrice + */ + @jakarta.annotation.Nullable + public String getReferencePrice() { + return referencePrice; + } + + public void setReferencePrice(@jakarta.annotation.Nullable String referencePrice) { + this.referencePrice = referencePrice; + } + + public ReferencePriceResponse timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferencePriceResponse referencePriceResponse = (ReferencePriceResponse) o; + return Objects.equals(this.symbol, referencePriceResponse.symbol) + && Objects.equals(this.referencePrice, referencePriceResponse.referencePrice) + && Objects.equals(this.timestamp, referencePriceResponse.timestamp); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, referencePrice, timestamp); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencePriceResponse {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" referencePrice: ").append(toIndentedString(referencePrice)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object symbolValue = getSymbol(); + String symbolValueAsString = ""; + symbolValueAsString = symbolValue.toString(); + sb.append("symbol=").append(urlEncode(symbolValueAsString)).append(""); + Object referencePriceValue = getReferencePrice(); + String referencePriceValueAsString = ""; + referencePriceValueAsString = referencePriceValue.toString(); + sb.append("referencePrice=").append(urlEncode(referencePriceValueAsString)).append(""); + Object timestampValue = getTimestamp(); + String timestampValueAsString = ""; + timestampValueAsString = timestampValue.toString(); + sb.append("timestamp=").append(urlEncode(timestampValueAsString)).append(""); + return sb.toString(); + } + + public static String urlEncode(String s) { + try { + return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(StandardCharsets.UTF_8.name() + " is unsupported", e); + } + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("referencePrice"); + openapiFields.add("timestamp"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReferencePriceResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencePriceResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReferencePriceResponse is not found in" + + " the empty JSON string", + ReferencePriceResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("referencePrice") != null && !jsonObj.get("referencePrice").isJsonNull()) + && !jsonObj.get("referencePrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `referencePrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("referencePrice").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencePriceResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferencePriceResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ReferencePriceResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferencePriceResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencePriceResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReferencePriceResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencePriceResponse + * @throws IOException if the JSON string is invalid with respect to ReferencePriceResponse + */ + public static ReferencePriceResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencePriceResponse.class); + } + + /** + * Convert an instance of ReferencePriceResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/JSON.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/JSON.java index 3cfc8b00d..03ba7b3a2 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/JSON.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/JSON.java @@ -530,6 +530,22 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.spot.websocket.api.model.ExecutionReport .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model.ExecutionRulesRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model.ExecutionRulesResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model + .ExecutionRulesResponseResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model + .ExecutionRulesResponseResultSymbolRulesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model + .ExecutionRulesResponseResultSymbolRulesInnerRulesInner + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.spot.websocket.api.model.ExternalLockUpdate .CustomTypeAdapterFactory()); @@ -894,6 +910,24 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.spot.websocket.api.model.RateLimits .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model + .ReferencePriceCalculationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model + .ReferencePriceCalculationResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model + .ReferencePriceCalculationResponseResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model.ReferencePriceRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model.ReferencePriceResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.api.model + .ReferencePriceResponseResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.spot.websocket.api.model.SessionLogonRequest .CustomTypeAdapterFactory()); diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/GeneralApi.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/GeneralApi.java index 578778e73..2be6075be 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/GeneralApi.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/GeneralApi.java @@ -19,6 +19,8 @@ import com.binance.connector.client.common.websocket.dtos.BaseRequestDTO; import com.binance.connector.client.spot.websocket.api.model.ExchangeInfoRequest; import com.binance.connector.client.spot.websocket.api.model.ExchangeInfoResponse; +import com.binance.connector.client.spot.websocket.api.model.ExecutionRulesRequest; +import com.binance.connector.client.spot.websocket.api.model.ExecutionRulesResponse; import com.binance.connector.client.spot.websocket.api.model.PingResponse; import com.binance.connector.client.spot.websocket.api.model.TimeResponse; import jakarta.validation.ConstraintViolation; @@ -102,6 +104,70 @@ private void exchangeInfoValidateBeforeCall(ExchangeInfoRequest exchangeInfoRequ } } + /** + * WebSocket Query Execution Rules Weight: Parameter | Weight| --- | --- `symbol` | 2 + * `symbols` | 2 for each `symbol`, capped at a max of 40| + * `symbolStatus` |40| None |40| + * + * @param executionRulesRequest (optional) + * @return ExecutionRulesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Execution Rules -
+ * + * @see WebSocket + * Query Execution Rules Documentation + */ + public CompletableFuture executionRules( + ExecutionRulesRequest executionRulesRequest) throws ApiException { + executionRulesValidateBeforeCall(executionRulesRequest); + String methodName = "/executionRules".substring(1); + ApiRequestWrapperDTO build = + new ApiRequestWrapperDTO.Builder() + .id(getRequestID()) + .method(methodName) + .params(executionRulesRequest) + .responseType(ExecutionRulesResponse.class) + .signed(false) + .build(); + + try { + connection.send(build); + } catch (InterruptedException e) { + throw new ApiException(e); + } + return build.getResponseCallback(); + } + + @SuppressWarnings("rawtypes") + private void executionRulesValidateBeforeCall(ExecutionRulesRequest executionRulesRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(executionRulesRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + /** * WebSocket Test connectivity Test connectivity to the WebSocket API. Weight: 1 * diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/MarketApi.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/MarketApi.java index 3ccdba266..4deedcb37 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/MarketApi.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/MarketApi.java @@ -22,6 +22,10 @@ import com.binance.connector.client.spot.websocket.api.model.DepthResponse; import com.binance.connector.client.spot.websocket.api.model.KlinesRequest; import com.binance.connector.client.spot.websocket.api.model.KlinesResponse; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceCalculationRequest; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceCalculationResponse; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceRequest; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceResponse; import com.binance.connector.client.spot.websocket.api.model.Ticker24hrRequest; import com.binance.connector.client.spot.websocket.api.model.Ticker24hrResponse; import com.binance.connector.client.spot.websocket.api.model.TickerBookRequest; @@ -249,6 +253,134 @@ private void klinesValidateBeforeCall(KlinesRequest klinesRequest) throws ApiExc } } + /** + * WebSocket Query Reference Price Weight: 2 + * + * @param referencePriceRequest (required) + * @return ReferencePriceResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Reference Price -
+ * + * @see WebSocket + * Query Reference Price Documentation + */ + public CompletableFuture referencePrice( + ReferencePriceRequest referencePriceRequest) throws ApiException { + referencePriceValidateBeforeCall(referencePriceRequest); + String methodName = "/referencePrice".substring(1); + ApiRequestWrapperDTO build = + new ApiRequestWrapperDTO.Builder() + .id(getRequestID()) + .method(methodName) + .params(referencePriceRequest) + .responseType(ReferencePriceResponse.class) + .signed(false) + .build(); + + try { + connection.send(build); + } catch (InterruptedException e) { + throw new ApiException(e); + } + return build.getResponseCallback(); + } + + @SuppressWarnings("rawtypes") + private void referencePriceValidateBeforeCall(ReferencePriceRequest referencePriceRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(referencePriceRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + + /** + * WebSocket Query Reference Price Calculation Describes how reference price is calculated for a + * given symbol. Weight: 2 + * + * @param referencePriceCalculationRequest (required) + * @return ReferencePriceCalculationResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Query Reference Price Calculation -
+ * + * @see WebSocket + * Query Reference Price Calculation Documentation + */ + public CompletableFuture referencePriceCalculation( + ReferencePriceCalculationRequest referencePriceCalculationRequest) throws ApiException { + referencePriceCalculationValidateBeforeCall(referencePriceCalculationRequest); + String methodName = "/referencePrice.calculation".substring(1); + ApiRequestWrapperDTO + build = + new ApiRequestWrapperDTO.Builder< + ReferencePriceCalculationRequest, + ReferencePriceCalculationResponse>() + .id(getRequestID()) + .method(methodName) + .params(referencePriceCalculationRequest) + .responseType(ReferencePriceCalculationResponse.class) + .signed(false) + .build(); + + try { + connection.send(build); + } catch (InterruptedException e) { + throw new ApiException(e); + } + return build.getResponseCallback(); + } + + @SuppressWarnings("rawtypes") + private void referencePriceCalculationValidateBeforeCall( + ReferencePriceCalculationRequest referencePriceCalculationRequest) throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(referencePriceCalculationRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + /** * WebSocket Rolling window price change statistics Get rolling window price change statistics * with a custom window. This request is similar to `ticker.24hr`, but statistics are diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/SpotWebSocketApi.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/SpotWebSocketApi.java index cf2b55f4d..90f13b412 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/SpotWebSocketApi.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/SpotWebSocketApi.java @@ -24,6 +24,8 @@ import com.binance.connector.client.spot.websocket.api.model.DepthResponse; import com.binance.connector.client.spot.websocket.api.model.ExchangeInfoRequest; import com.binance.connector.client.spot.websocket.api.model.ExchangeInfoResponse; +import com.binance.connector.client.spot.websocket.api.model.ExecutionRulesRequest; +import com.binance.connector.client.spot.websocket.api.model.ExecutionRulesResponse; import com.binance.connector.client.spot.websocket.api.model.KlinesRequest; import com.binance.connector.client.spot.websocket.api.model.KlinesResponse; import com.binance.connector.client.spot.websocket.api.model.MyAllocationsRequest; @@ -71,6 +73,10 @@ import com.binance.connector.client.spot.websocket.api.model.OrderTestRequest; import com.binance.connector.client.spot.websocket.api.model.OrderTestResponse; import com.binance.connector.client.spot.websocket.api.model.PingResponse; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceCalculationRequest; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceCalculationResponse; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceRequest; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceResponse; import com.binance.connector.client.spot.websocket.api.model.SessionLogonRequest; import com.binance.connector.client.spot.websocket.api.model.SessionLogonResponse; import com.binance.connector.client.spot.websocket.api.model.SessionLogoutResponse; @@ -112,7 +118,7 @@ public class SpotWebSocketApi { private static final String USER_AGENT = String.format( - "binance-spot/9.0.0 (Java/%s; %s; %s)", + "binance-spot/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private AccountApi accountApi; @@ -240,6 +246,11 @@ public CompletableFuture exchangeInfo( return generalApi.exchangeInfo(exchangeInfoRequest); } + public CompletableFuture executionRules( + ExecutionRulesRequest executionRulesRequest) throws ApiException { + return generalApi.executionRules(executionRulesRequest); + } + public CompletableFuture ping() throws ApiException { return generalApi.ping(); } @@ -262,6 +273,16 @@ public CompletableFuture klines(KlinesRequest klinesRequest) return marketApi.klines(klinesRequest); } + public CompletableFuture referencePrice( + ReferencePriceRequest referencePriceRequest) throws ApiException { + return marketApi.referencePrice(referencePriceRequest); + } + + public CompletableFuture referencePriceCalculation( + ReferencePriceCalculationRequest referencePriceCalculationRequest) throws ApiException { + return marketApi.referencePriceCalculation(referencePriceCalculationRequest); + } + public CompletableFuture ticker(TickerRequest tickerRequest) throws ApiException { return marketApi.ticker(tickerRequest); diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/TradeApi.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/TradeApi.java index d5c0e31b6..96bf66008 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/TradeApi.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/api/TradeApi.java @@ -254,10 +254,11 @@ private void orderCancelValidateBeforeCall(OrderCancelRequest orderCancelRequest } /** - * WebSocket Cancel and replace order Cancel an existing order and immediately place a new order - * instead of the canceled one. A new order that was not attempted (i.e. when + * WebSocket Cancel and replace order * Cancel an existing order and immediately place a new + * order instead of the canceled one. * A new order that was not attempted (i.e. when * `newOrderResult: NOT_ATTEMPTED`), will still increase the unfilled order count by - * 1. Weight: 1 + * 1. * You can only cancel an individual order from an orderList using this method, but the + * result is the same as canceling the entire orderList. Weight: 1 * * @param orderCancelReplaceRequest (required) * @return OrderCancelReplaceResponse diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionReport.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionReport.java index ecb6dd246..46898d15f 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionReport.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionReport.java @@ -363,6 +363,12 @@ public class ExecutionReport extends BaseDTO { @jakarta.annotation.Nullable private String gp; + public static final String SERIALIZED_NAME_E_R = "eR"; + + @SerializedName(SERIALIZED_NAME_E_R) + @jakarta.annotation.Nullable + private String eR; + public ExecutionReport() {} public ExecutionReport E(@jakarta.annotation.Nullable Long E) { @@ -1391,6 +1397,25 @@ public void setGp(@jakarta.annotation.Nullable String gp) { this.gp = gp; } + public ExecutionReport eR(@jakarta.annotation.Nullable String eR) { + this.eR = eR; + return this; + } + + /** + * Get eR + * + * @return eR + */ + @jakarta.annotation.Nullable + public String geteR() { + return eR; + } + + public void seteR(@jakarta.annotation.Nullable String eR) { + this.eR = eR; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -1453,7 +1478,8 @@ public boolean equals(Object o) { && Objects.equals(this.gP, executionReport.gP) && Objects.equals(this.gOT, executionReport.gOT) && Objects.equals(this.gOV, executionReport.gOV) - && Objects.equals(this.gp, executionReport.gp); + && Objects.equals(this.gp, executionReport.gp) + && Objects.equals(this.eR, executionReport.eR); } @Override @@ -1512,7 +1538,8 @@ public int hashCode() { gP, gOT, gOV, - gp); + gp, + eR); } @Override @@ -1573,6 +1600,7 @@ public String toString() { sb.append(" gOT: ").append(toIndentedString(gOT)).append("\n"); sb.append(" gOV: ").append(toIndentedString(gOV)).append("\n"); sb.append(" gp: ").append(toIndentedString(gp)).append("\n"); + sb.append(" eR: ").append(toIndentedString(eR)).append("\n"); sb.append("}"); return sb.toString(); } @@ -1851,6 +1879,11 @@ public String toUrlQueryString() { String gpValueAsString = gpValue.toString(); valMap.put("gp", gpValueAsString); } + String eRValue = geteR(); + if (eRValue != null) { + String eRValueAsString = eRValue.toString(); + valMap.put("eR", eRValueAsString); + } valMap.put("timestamp", getTimestamp()); return asciiEncode( @@ -2078,6 +2111,10 @@ public Map toMap() { if (gpValue != null) { valMap.put("gp", gpValue); } + Object eRValue = geteR(); + if (eRValue != null) { + valMap.put("eR", eRValue); + } valMap.put("timestamp", getTimestamp()); return valMap; @@ -2158,6 +2195,7 @@ private String toIndentedString(Object o) { openapiFields.add("gOT"); openapiFields.add("gOV"); openapiFields.add("gp"); + openapiFields.add("eR"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -2457,6 +2495,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti + " got `%s`", jsonObj.get("gp").toString())); } + if ((jsonObj.get("eR") != null && !jsonObj.get("eR").isJsonNull()) + && !jsonObj.get("eR").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eR` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("eR").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesRequest.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesRequest.java new file mode 100644 index 000000000..3e64e32d8 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesRequest.java @@ -0,0 +1,322 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ExecutionRulesRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ExecutionRulesRequest extends BaseDTO { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_SYMBOLS = "symbols"; + + @SerializedName(SERIALIZED_NAME_SYMBOLS) + @jakarta.annotation.Nullable + private Symbols symbols; + + public static final String SERIALIZED_NAME_SYMBOL_STATUS = "symbolStatus"; + + @SerializedName(SERIALIZED_NAME_SYMBOL_STATUS) + @jakarta.annotation.Nullable + private SymbolStatus symbolStatus; + + public ExecutionRulesRequest() {} + + public ExecutionRulesRequest symbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public ExecutionRulesRequest symbols(@jakarta.annotation.Nullable Symbols symbols) { + this.symbols = symbols; + return this; + } + + /** + * Get symbols + * + * @return symbols + */ + @jakarta.annotation.Nullable + @Valid + public Symbols getSymbols() { + return symbols; + } + + public void setSymbols(@jakarta.annotation.Nullable Symbols symbols) { + this.symbols = symbols; + } + + public ExecutionRulesRequest symbolStatus( + @jakarta.annotation.Nullable SymbolStatus symbolStatus) { + this.symbolStatus = symbolStatus; + return this; + } + + /** + * Get symbolStatus + * + * @return symbolStatus + */ + @jakarta.annotation.Nullable + @Valid + public SymbolStatus getSymbolStatus() { + return symbolStatus; + } + + public void setSymbolStatus(@jakarta.annotation.Nullable SymbolStatus symbolStatus) { + this.symbolStatus = symbolStatus; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecutionRulesRequest executionRulesRequest = (ExecutionRulesRequest) o; + return Objects.equals(this.symbol, executionRulesRequest.symbol) + && Objects.equals(this.symbols, executionRulesRequest.symbols) + && Objects.equals(this.symbolStatus, executionRulesRequest.symbolStatus); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, symbols, symbolStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecutionRulesRequest {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" symbols: ").append(toIndentedString(symbols)).append("\n"); + sb.append(" symbolStatus: ").append(toIndentedString(symbolStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String symbolValue = getSymbol(); + if (symbolValue != null) { + String symbolValueAsString = symbolValue.toString(); + valMap.put("symbol", symbolValueAsString); + } + Symbols symbolsValue = getSymbols(); + if (symbolsValue != null) { + String symbolsValueAsString = JSON.getGson().toJson(symbolsValue); + valMap.put("symbols", symbolsValueAsString); + } + SymbolStatus symbolStatusValue = getSymbolStatus(); + if (symbolStatusValue != null) { + String symbolStatusValueAsString = symbolStatusValue.toString(); + valMap.put("symbolStatus", symbolStatusValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object symbolValue = getSymbol(); + if (symbolValue != null) { + valMap.put("symbol", symbolValue); + } + Object symbolsValue = getSymbols(); + if (symbolsValue != null) { + valMap.put("symbols", symbolsValue); + } + Object symbolStatusValue = getSymbolStatus(); + if (symbolStatusValue != null) { + valMap.put("symbolStatus", symbolStatusValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("symbols"); + openapiFields.add("symbolStatus"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecutionRulesRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecutionRulesRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ExecutionRulesRequest is not found in" + + " the empty JSON string", + ExecutionRulesRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecutionRulesRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ExecutionRulesRequest` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + // validate the optional field `symbolStatus` + if (jsonObj.get("symbolStatus") != null && !jsonObj.get("symbolStatus").isJsonNull()) { + SymbolStatus.validateJsonElement(jsonObj.get("symbolStatus")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecutionRulesRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecutionRulesRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ExecutionRulesRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecutionRulesRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecutionRulesRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ExecutionRulesRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecutionRulesRequest + * @throws IOException if the JSON string is invalid with respect to ExecutionRulesRequest + */ + public static ExecutionRulesRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecutionRulesRequest.class); + } + + /** + * Convert an instance of ExecutionRulesRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponse.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponse.java new file mode 100644 index 000000000..9377a667f --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponse.java @@ -0,0 +1,321 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ExecutionRulesResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ExecutionRulesResponse extends BaseDTO { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private Long status; + + public static final String SERIALIZED_NAME_RESULT = "result"; + + @SerializedName(SERIALIZED_NAME_RESULT) + @jakarta.annotation.Nullable + private ExecutionRulesResponseResult result; + + public ExecutionRulesResponse() {} + + public ExecutionRulesResponse id(@jakarta.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id + */ + @jakarta.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable String id) { + this.id = id; + } + + public ExecutionRulesResponse status(@jakarta.annotation.Nullable Long status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public Long getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable Long status) { + this.status = status; + } + + public ExecutionRulesResponse result( + @jakarta.annotation.Nullable ExecutionRulesResponseResult result) { + this.result = result; + return this; + } + + /** + * Get result + * + * @return result + */ + @jakarta.annotation.Nullable + @Valid + public ExecutionRulesResponseResult getResult() { + return result; + } + + public void setResult(@jakarta.annotation.Nullable ExecutionRulesResponseResult result) { + this.result = result; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecutionRulesResponse executionRulesResponse = (ExecutionRulesResponse) o; + return Objects.equals(this.id, executionRulesResponse.id) + && Objects.equals(this.status, executionRulesResponse.status) + && Objects.equals(this.result, executionRulesResponse.result); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecutionRulesResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String idValue = getId(); + if (idValue != null) { + String idValueAsString = idValue.toString(); + valMap.put("id", idValueAsString); + } + Long statusValue = getStatus(); + if (statusValue != null) { + String statusValueAsString = statusValue.toString(); + valMap.put("status", statusValueAsString); + } + ExecutionRulesResponseResult resultValue = getResult(); + if (resultValue != null) { + String resultValueAsString = JSON.getGson().toJson(resultValue); + valMap.put("result", resultValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object idValue = getId(); + if (idValue != null) { + valMap.put("id", idValue); + } + Object statusValue = getStatus(); + if (statusValue != null) { + valMap.put("status", statusValue); + } + Object resultValue = getResult(); + if (resultValue != null) { + valMap.put("result", resultValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("status"); + openapiFields.add("result"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecutionRulesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecutionRulesResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ExecutionRulesResponse is not found in" + + " the empty JSON string", + ExecutionRulesResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecutionRulesResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ExecutionRulesResponse` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `id` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("id").toString())); + } + // validate the optional field `result` + if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { + ExecutionRulesResponseResult.validateJsonElement(jsonObj.get("result")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecutionRulesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecutionRulesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ExecutionRulesResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecutionRulesResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecutionRulesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ExecutionRulesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecutionRulesResponse + * @throws IOException if the JSON string is invalid with respect to ExecutionRulesResponse + */ + public static ExecutionRulesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecutionRulesResponse.class); + } + + /** + * Convert an instance of ExecutionRulesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResult.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResult.java new file mode 100644 index 000000000..08dd60296 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResult.java @@ -0,0 +1,276 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ExecutionRulesResponseResult */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ExecutionRulesResponseResult extends BaseDTO { + public static final String SERIALIZED_NAME_SYMBOL_RULES = "symbolRules"; + + @SerializedName(SERIALIZED_NAME_SYMBOL_RULES) + @jakarta.annotation.Nullable + private List<@Valid ExecutionRulesResponseResultSymbolRulesInner> symbolRules; + + public ExecutionRulesResponseResult() {} + + public ExecutionRulesResponseResult symbolRules( + @jakarta.annotation.Nullable + List<@Valid ExecutionRulesResponseResultSymbolRulesInner> symbolRules) { + this.symbolRules = symbolRules; + return this; + } + + public ExecutionRulesResponseResult addSymbolRulesItem( + ExecutionRulesResponseResultSymbolRulesInner symbolRulesItem) { + if (this.symbolRules == null) { + this.symbolRules = new ArrayList<>(); + } + this.symbolRules.add(symbolRulesItem); + return this; + } + + /** + * Get symbolRules + * + * @return symbolRules + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ExecutionRulesResponseResultSymbolRulesInner> getSymbolRules() { + return symbolRules; + } + + public void setSymbolRules( + @jakarta.annotation.Nullable + List<@Valid ExecutionRulesResponseResultSymbolRulesInner> symbolRules) { + this.symbolRules = symbolRules; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecutionRulesResponseResult executionRulesResponseResult = + (ExecutionRulesResponseResult) o; + return Objects.equals(this.symbolRules, executionRulesResponseResult.symbolRules); + } + + @Override + public int hashCode() { + return Objects.hash(symbolRules); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecutionRulesResponseResult {\n"); + sb.append(" symbolRules: ").append(toIndentedString(symbolRules)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + List<@Valid ExecutionRulesResponseResultSymbolRulesInner> symbolRulesValue = + getSymbolRules(); + if (symbolRulesValue != null) { + String symbolRulesValueAsString = JSON.getGson().toJson(symbolRulesValue); + valMap.put("symbolRules", symbolRulesValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object symbolRulesValue = getSymbolRules(); + if (symbolRulesValue != null) { + valMap.put("symbolRules", symbolRulesValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbolRules"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ExecutionRulesResponseResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecutionRulesResponseResult.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ExecutionRulesResponseResult is not" + + " found in the empty JSON string", + ExecutionRulesResponseResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecutionRulesResponseResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ExecutionRulesResponseResult` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("symbolRules") != null && !jsonObj.get("symbolRules").isJsonNull()) { + JsonArray jsonArraysymbolRules = jsonObj.getAsJsonArray("symbolRules"); + if (jsonArraysymbolRules != null) { + // ensure the json data is an array + if (!jsonObj.get("symbolRules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbolRules` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("symbolRules").toString())); + } + + // validate the optional field `symbolRules` (array) + for (int i = 0; i < jsonArraysymbolRules.size(); i++) { + ExecutionRulesResponseResultSymbolRulesInner.validateJsonElement( + jsonArraysymbolRules.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecutionRulesResponseResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecutionRulesResponseResult' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ExecutionRulesResponseResult.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecutionRulesResponseResult value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecutionRulesResponseResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ExecutionRulesResponseResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecutionRulesResponseResult + * @throws IOException if the JSON string is invalid with respect to + * ExecutionRulesResponseResult + */ + public static ExecutionRulesResponseResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecutionRulesResponseResult.class); + } + + /** + * Convert an instance of ExecutionRulesResponseResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResultSymbolRulesInner.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResultSymbolRulesInner.java new file mode 100644 index 000000000..99253e556 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResultSymbolRulesInner.java @@ -0,0 +1,331 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ExecutionRulesResponseResultSymbolRulesInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ExecutionRulesResponseResultSymbolRulesInner extends BaseDTO { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_RULES = "rules"; + + @SerializedName(SERIALIZED_NAME_RULES) + @jakarta.annotation.Nullable + private List<@Valid ExecutionRulesResponseResultSymbolRulesInnerRulesInner> rules; + + public ExecutionRulesResponseResultSymbolRulesInner() {} + + public ExecutionRulesResponseResultSymbolRulesInner symbol( + @jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public ExecutionRulesResponseResultSymbolRulesInner rules( + @jakarta.annotation.Nullable + List<@Valid ExecutionRulesResponseResultSymbolRulesInnerRulesInner> rules) { + this.rules = rules; + return this; + } + + public ExecutionRulesResponseResultSymbolRulesInner addRulesItem( + ExecutionRulesResponseResultSymbolRulesInnerRulesInner rulesItem) { + if (this.rules == null) { + this.rules = new ArrayList<>(); + } + this.rules.add(rulesItem); + return this; + } + + /** + * Get rules + * + * @return rules + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid ExecutionRulesResponseResultSymbolRulesInnerRulesInner> getRules() { + return rules; + } + + public void setRules( + @jakarta.annotation.Nullable + List<@Valid ExecutionRulesResponseResultSymbolRulesInnerRulesInner> rules) { + this.rules = rules; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecutionRulesResponseResultSymbolRulesInner executionRulesResponseResultSymbolRulesInner = + (ExecutionRulesResponseResultSymbolRulesInner) o; + return Objects.equals(this.symbol, executionRulesResponseResultSymbolRulesInner.symbol) + && Objects.equals(this.rules, executionRulesResponseResultSymbolRulesInner.rules); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, rules); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecutionRulesResponseResultSymbolRulesInner {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String symbolValue = getSymbol(); + if (symbolValue != null) { + String symbolValueAsString = symbolValue.toString(); + valMap.put("symbol", symbolValueAsString); + } + List<@Valid ExecutionRulesResponseResultSymbolRulesInnerRulesInner> rulesValue = getRules(); + if (rulesValue != null) { + String rulesValueAsString = JSON.getGson().toJson(rulesValue); + valMap.put("rules", rulesValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object symbolValue = getSymbol(); + if (symbolValue != null) { + valMap.put("symbol", symbolValue); + } + Object rulesValue = getRules(); + if (rulesValue != null) { + valMap.put("rules", rulesValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("rules"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ExecutionRulesResponseResultSymbolRulesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecutionRulesResponseResultSymbolRulesInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " ExecutionRulesResponseResultSymbolRulesInner is not found" + + " in the empty JSON string", + ExecutionRulesResponseResultSymbolRulesInner.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecutionRulesResponseResultSymbolRulesInner.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ExecutionRulesResponseResultSymbolRulesInner` properties." + + " JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + if (jsonObj.get("rules") != null && !jsonObj.get("rules").isJsonNull()) { + JsonArray jsonArrayrules = jsonObj.getAsJsonArray("rules"); + if (jsonArrayrules != null) { + // ensure the json data is an array + if (!jsonObj.get("rules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `rules` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("rules").toString())); + } + + // validate the optional field `rules` (array) + for (int i = 0; i < jsonArrayrules.size(); i++) { + ExecutionRulesResponseResultSymbolRulesInnerRulesInner.validateJsonElement( + jsonArrayrules.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecutionRulesResponseResultSymbolRulesInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'ExecutionRulesResponseResultSymbolRulesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(ExecutionRulesResponseResultSymbolRulesInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, ExecutionRulesResponseResultSymbolRulesInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecutionRulesResponseResultSymbolRulesInner read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ExecutionRulesResponseResultSymbolRulesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecutionRulesResponseResultSymbolRulesInner + * @throws IOException if the JSON string is invalid with respect to + * ExecutionRulesResponseResultSymbolRulesInner + */ + public static ExecutionRulesResponseResultSymbolRulesInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, ExecutionRulesResponseResultSymbolRulesInner.class); + } + + /** + * Convert an instance of ExecutionRulesResponseResultSymbolRulesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResultSymbolRulesInnerRulesInner.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResultSymbolRulesInnerRulesInner.java new file mode 100644 index 000000000..58489d5c6 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ExecutionRulesResponseResultSymbolRulesInnerRulesInner.java @@ -0,0 +1,460 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ExecutionRulesResponseResultSymbolRulesInnerRulesInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ExecutionRulesResponseResultSymbolRulesInnerRulesInner extends BaseDTO { + public static final String SERIALIZED_NAME_RULE_TYPE = "ruleType"; + + @SerializedName(SERIALIZED_NAME_RULE_TYPE) + @jakarta.annotation.Nullable + private String ruleType; + + public static final String SERIALIZED_NAME_BID_LIMIT_MULT_UP = "bidLimitMultUp"; + + @SerializedName(SERIALIZED_NAME_BID_LIMIT_MULT_UP) + @jakarta.annotation.Nullable + private String bidLimitMultUp; + + public static final String SERIALIZED_NAME_BID_LIMIT_MULT_DOWN = "bidLimitMultDown"; + + @SerializedName(SERIALIZED_NAME_BID_LIMIT_MULT_DOWN) + @jakarta.annotation.Nullable + private String bidLimitMultDown; + + public static final String SERIALIZED_NAME_ASK_LIMIT_MULT_UP = "askLimitMultUp"; + + @SerializedName(SERIALIZED_NAME_ASK_LIMIT_MULT_UP) + @jakarta.annotation.Nullable + private String askLimitMultUp; + + public static final String SERIALIZED_NAME_ASK_LIMIT_MULT_DOWN = "askLimitMultDown"; + + @SerializedName(SERIALIZED_NAME_ASK_LIMIT_MULT_DOWN) + @jakarta.annotation.Nullable + private String askLimitMultDown; + + public ExecutionRulesResponseResultSymbolRulesInnerRulesInner() {} + + public ExecutionRulesResponseResultSymbolRulesInnerRulesInner ruleType( + @jakarta.annotation.Nullable String ruleType) { + this.ruleType = ruleType; + return this; + } + + /** + * Get ruleType + * + * @return ruleType + */ + @jakarta.annotation.Nullable + public String getRuleType() { + return ruleType; + } + + public void setRuleType(@jakarta.annotation.Nullable String ruleType) { + this.ruleType = ruleType; + } + + public ExecutionRulesResponseResultSymbolRulesInnerRulesInner bidLimitMultUp( + @jakarta.annotation.Nullable String bidLimitMultUp) { + this.bidLimitMultUp = bidLimitMultUp; + return this; + } + + /** + * Get bidLimitMultUp + * + * @return bidLimitMultUp + */ + @jakarta.annotation.Nullable + public String getBidLimitMultUp() { + return bidLimitMultUp; + } + + public void setBidLimitMultUp(@jakarta.annotation.Nullable String bidLimitMultUp) { + this.bidLimitMultUp = bidLimitMultUp; + } + + public ExecutionRulesResponseResultSymbolRulesInnerRulesInner bidLimitMultDown( + @jakarta.annotation.Nullable String bidLimitMultDown) { + this.bidLimitMultDown = bidLimitMultDown; + return this; + } + + /** + * Get bidLimitMultDown + * + * @return bidLimitMultDown + */ + @jakarta.annotation.Nullable + public String getBidLimitMultDown() { + return bidLimitMultDown; + } + + public void setBidLimitMultDown(@jakarta.annotation.Nullable String bidLimitMultDown) { + this.bidLimitMultDown = bidLimitMultDown; + } + + public ExecutionRulesResponseResultSymbolRulesInnerRulesInner askLimitMultUp( + @jakarta.annotation.Nullable String askLimitMultUp) { + this.askLimitMultUp = askLimitMultUp; + return this; + } + + /** + * Get askLimitMultUp + * + * @return askLimitMultUp + */ + @jakarta.annotation.Nullable + public String getAskLimitMultUp() { + return askLimitMultUp; + } + + public void setAskLimitMultUp(@jakarta.annotation.Nullable String askLimitMultUp) { + this.askLimitMultUp = askLimitMultUp; + } + + public ExecutionRulesResponseResultSymbolRulesInnerRulesInner askLimitMultDown( + @jakarta.annotation.Nullable String askLimitMultDown) { + this.askLimitMultDown = askLimitMultDown; + return this; + } + + /** + * Get askLimitMultDown + * + * @return askLimitMultDown + */ + @jakarta.annotation.Nullable + public String getAskLimitMultDown() { + return askLimitMultDown; + } + + public void setAskLimitMultDown(@jakarta.annotation.Nullable String askLimitMultDown) { + this.askLimitMultDown = askLimitMultDown; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecutionRulesResponseResultSymbolRulesInnerRulesInner + executionRulesResponseResultSymbolRulesInnerRulesInner = + (ExecutionRulesResponseResultSymbolRulesInnerRulesInner) o; + return Objects.equals( + this.ruleType, + executionRulesResponseResultSymbolRulesInnerRulesInner.ruleType) + && Objects.equals( + this.bidLimitMultUp, + executionRulesResponseResultSymbolRulesInnerRulesInner.bidLimitMultUp) + && Objects.equals( + this.bidLimitMultDown, + executionRulesResponseResultSymbolRulesInnerRulesInner.bidLimitMultDown) + && Objects.equals( + this.askLimitMultUp, + executionRulesResponseResultSymbolRulesInnerRulesInner.askLimitMultUp) + && Objects.equals( + this.askLimitMultDown, + executionRulesResponseResultSymbolRulesInnerRulesInner.askLimitMultDown); + } + + @Override + public int hashCode() { + return Objects.hash( + ruleType, bidLimitMultUp, bidLimitMultDown, askLimitMultUp, askLimitMultDown); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecutionRulesResponseResultSymbolRulesInnerRulesInner {\n"); + sb.append(" ruleType: ").append(toIndentedString(ruleType)).append("\n"); + sb.append(" bidLimitMultUp: ").append(toIndentedString(bidLimitMultUp)).append("\n"); + sb.append(" bidLimitMultDown: ").append(toIndentedString(bidLimitMultDown)).append("\n"); + sb.append(" askLimitMultUp: ").append(toIndentedString(askLimitMultUp)).append("\n"); + sb.append(" askLimitMultDown: ").append(toIndentedString(askLimitMultDown)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String ruleTypeValue = getRuleType(); + if (ruleTypeValue != null) { + String ruleTypeValueAsString = ruleTypeValue.toString(); + valMap.put("ruleType", ruleTypeValueAsString); + } + String bidLimitMultUpValue = getBidLimitMultUp(); + if (bidLimitMultUpValue != null) { + String bidLimitMultUpValueAsString = bidLimitMultUpValue.toString(); + valMap.put("bidLimitMultUp", bidLimitMultUpValueAsString); + } + String bidLimitMultDownValue = getBidLimitMultDown(); + if (bidLimitMultDownValue != null) { + String bidLimitMultDownValueAsString = bidLimitMultDownValue.toString(); + valMap.put("bidLimitMultDown", bidLimitMultDownValueAsString); + } + String askLimitMultUpValue = getAskLimitMultUp(); + if (askLimitMultUpValue != null) { + String askLimitMultUpValueAsString = askLimitMultUpValue.toString(); + valMap.put("askLimitMultUp", askLimitMultUpValueAsString); + } + String askLimitMultDownValue = getAskLimitMultDown(); + if (askLimitMultDownValue != null) { + String askLimitMultDownValueAsString = askLimitMultDownValue.toString(); + valMap.put("askLimitMultDown", askLimitMultDownValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object ruleTypeValue = getRuleType(); + if (ruleTypeValue != null) { + valMap.put("ruleType", ruleTypeValue); + } + Object bidLimitMultUpValue = getBidLimitMultUp(); + if (bidLimitMultUpValue != null) { + valMap.put("bidLimitMultUp", bidLimitMultUpValue); + } + Object bidLimitMultDownValue = getBidLimitMultDown(); + if (bidLimitMultDownValue != null) { + valMap.put("bidLimitMultDown", bidLimitMultDownValue); + } + Object askLimitMultUpValue = getAskLimitMultUp(); + if (askLimitMultUpValue != null) { + valMap.put("askLimitMultUp", askLimitMultUpValue); + } + Object askLimitMultDownValue = getAskLimitMultDown(); + if (askLimitMultDownValue != null) { + valMap.put("askLimitMultDown", askLimitMultDownValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("ruleType"); + openapiFields.add("bidLimitMultUp"); + openapiFields.add("bidLimitMultDown"); + openapiFields.add("askLimitMultUp"); + openapiFields.add("askLimitMultDown"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ExecutionRulesResponseResultSymbolRulesInnerRulesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecutionRulesResponseResultSymbolRulesInnerRulesInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " ExecutionRulesResponseResultSymbolRulesInnerRulesInner is" + + " not found in the empty JSON string", + ExecutionRulesResponseResultSymbolRulesInnerRulesInner + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecutionRulesResponseResultSymbolRulesInnerRulesInner.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ExecutionRulesResponseResultSymbolRulesInnerRulesInner`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("ruleType") != null && !jsonObj.get("ruleType").isJsonNull()) + && !jsonObj.get("ruleType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `ruleType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("ruleType").toString())); + } + if ((jsonObj.get("bidLimitMultUp") != null && !jsonObj.get("bidLimitMultUp").isJsonNull()) + && !jsonObj.get("bidLimitMultUp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bidLimitMultUp` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("bidLimitMultUp").toString())); + } + if ((jsonObj.get("bidLimitMultDown") != null + && !jsonObj.get("bidLimitMultDown").isJsonNull()) + && !jsonObj.get("bidLimitMultDown").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `bidLimitMultDown` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("bidLimitMultDown").toString())); + } + if ((jsonObj.get("askLimitMultUp") != null && !jsonObj.get("askLimitMultUp").isJsonNull()) + && !jsonObj.get("askLimitMultUp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `askLimitMultUp` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("askLimitMultUp").toString())); + } + if ((jsonObj.get("askLimitMultDown") != null + && !jsonObj.get("askLimitMultDown").isJsonNull()) + && !jsonObj.get("askLimitMultDown").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `askLimitMultDown` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("askLimitMultDown").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecutionRulesResponseResultSymbolRulesInnerRulesInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'ExecutionRulesResponseResultSymbolRulesInnerRulesInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + ExecutionRulesResponseResultSymbolRulesInnerRulesInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + ExecutionRulesResponseResultSymbolRulesInnerRulesInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecutionRulesResponseResultSymbolRulesInnerRulesInner read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ExecutionRulesResponseResultSymbolRulesInnerRulesInner given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of ExecutionRulesResponseResultSymbolRulesInnerRulesInner + * @throws IOException if the JSON string is invalid with respect to + * ExecutionRulesResponseResultSymbolRulesInnerRulesInner + */ + public static ExecutionRulesResponseResultSymbolRulesInnerRulesInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, ExecutionRulesResponseResultSymbolRulesInnerRulesInner.class); + } + + /** + * Convert an instance of ExecutionRulesResponseResultSymbolRulesInnerRulesInner to an JSON + * string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationRequest.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationRequest.java new file mode 100644 index 000000000..8ba94f393 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationRequest.java @@ -0,0 +1,301 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ReferencePriceCalculationRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ReferencePriceCalculationRequest extends BaseDTO { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nonnull + private String symbol; + + public static final String SERIALIZED_NAME_SYMBOL_STATUS = "symbolStatus"; + + @SerializedName(SERIALIZED_NAME_SYMBOL_STATUS) + @jakarta.annotation.Nullable + private SymbolStatus symbolStatus; + + public ReferencePriceCalculationRequest() {} + + public ReferencePriceCalculationRequest symbol(@jakarta.annotation.Nonnull String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nonnull String symbol) { + this.symbol = symbol; + } + + public ReferencePriceCalculationRequest symbolStatus( + @jakarta.annotation.Nullable SymbolStatus symbolStatus) { + this.symbolStatus = symbolStatus; + return this; + } + + /** + * Get symbolStatus + * + * @return symbolStatus + */ + @jakarta.annotation.Nullable + @Valid + public SymbolStatus getSymbolStatus() { + return symbolStatus; + } + + public void setSymbolStatus(@jakarta.annotation.Nullable SymbolStatus symbolStatus) { + this.symbolStatus = symbolStatus; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferencePriceCalculationRequest referencePriceCalculationRequest = + (ReferencePriceCalculationRequest) o; + return Objects.equals(this.symbol, referencePriceCalculationRequest.symbol) + && Objects.equals(this.symbolStatus, referencePriceCalculationRequest.symbolStatus); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, symbolStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencePriceCalculationRequest {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" symbolStatus: ").append(toIndentedString(symbolStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String symbolValue = getSymbol(); + if (symbolValue != null) { + String symbolValueAsString = symbolValue.toString(); + valMap.put("symbol", symbolValueAsString); + } + SymbolStatus symbolStatusValue = getSymbolStatus(); + if (symbolStatusValue != null) { + String symbolStatusValueAsString = symbolStatusValue.toString(); + valMap.put("symbolStatus", symbolStatusValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object symbolValue = getSymbol(); + if (symbolValue != null) { + valMap.put("symbol", symbolValue); + } + Object symbolStatusValue = getSymbolStatus(); + if (symbolStatusValue != null) { + valMap.put("symbolStatus", symbolStatusValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("symbolStatus"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("symbol"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ReferencePriceCalculationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencePriceCalculationRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReferencePriceCalculationRequest is" + + " not found in the empty JSON string", + ReferencePriceCalculationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReferencePriceCalculationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ReferencePriceCalculationRequest` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReferencePriceCalculationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + // validate the optional field `symbolStatus` + if (jsonObj.get("symbolStatus") != null && !jsonObj.get("symbolStatus").isJsonNull()) { + SymbolStatus.validateJsonElement(jsonObj.get("symbolStatus")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencePriceCalculationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferencePriceCalculationRequest' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ReferencePriceCalculationRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferencePriceCalculationRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencePriceCalculationRequest read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReferencePriceCalculationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencePriceCalculationRequest + * @throws IOException if the JSON string is invalid with respect to + * ReferencePriceCalculationRequest + */ + public static ReferencePriceCalculationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencePriceCalculationRequest.class); + } + + /** + * Convert an instance of ReferencePriceCalculationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationResponse.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationResponse.java new file mode 100644 index 000000000..8db981f2e --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationResponse.java @@ -0,0 +1,329 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ReferencePriceCalculationResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ReferencePriceCalculationResponse extends BaseDTO { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private Long status; + + public static final String SERIALIZED_NAME_RESULT = "result"; + + @SerializedName(SERIALIZED_NAME_RESULT) + @jakarta.annotation.Nullable + private ReferencePriceCalculationResponseResult result; + + public ReferencePriceCalculationResponse() {} + + public ReferencePriceCalculationResponse id(@jakarta.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id + */ + @jakarta.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable String id) { + this.id = id; + } + + public ReferencePriceCalculationResponse status(@jakarta.annotation.Nullable Long status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public Long getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable Long status) { + this.status = status; + } + + public ReferencePriceCalculationResponse result( + @jakarta.annotation.Nullable ReferencePriceCalculationResponseResult result) { + this.result = result; + return this; + } + + /** + * Get result + * + * @return result + */ + @jakarta.annotation.Nullable + @Valid + public ReferencePriceCalculationResponseResult getResult() { + return result; + } + + public void setResult( + @jakarta.annotation.Nullable ReferencePriceCalculationResponseResult result) { + this.result = result; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferencePriceCalculationResponse referencePriceCalculationResponse = + (ReferencePriceCalculationResponse) o; + return Objects.equals(this.id, referencePriceCalculationResponse.id) + && Objects.equals(this.status, referencePriceCalculationResponse.status) + && Objects.equals(this.result, referencePriceCalculationResponse.result); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencePriceCalculationResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String idValue = getId(); + if (idValue != null) { + String idValueAsString = idValue.toString(); + valMap.put("id", idValueAsString); + } + Long statusValue = getStatus(); + if (statusValue != null) { + String statusValueAsString = statusValue.toString(); + valMap.put("status", statusValueAsString); + } + ReferencePriceCalculationResponseResult resultValue = getResult(); + if (resultValue != null) { + String resultValueAsString = JSON.getGson().toJson(resultValue); + valMap.put("result", resultValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object idValue = getId(); + if (idValue != null) { + valMap.put("id", idValue); + } + Object statusValue = getStatus(); + if (statusValue != null) { + valMap.put("status", statusValue); + } + Object resultValue = getResult(); + if (resultValue != null) { + valMap.put("result", resultValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("status"); + openapiFields.add("result"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ReferencePriceCalculationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencePriceCalculationResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReferencePriceCalculationResponse is" + + " not found in the empty JSON string", + ReferencePriceCalculationResponse.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReferencePriceCalculationResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ReferencePriceCalculationResponse` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `id` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("id").toString())); + } + // validate the optional field `result` + if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { + ReferencePriceCalculationResponseResult.validateJsonElement(jsonObj.get("result")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencePriceCalculationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferencePriceCalculationResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ReferencePriceCalculationResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferencePriceCalculationResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencePriceCalculationResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReferencePriceCalculationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencePriceCalculationResponse + * @throws IOException if the JSON string is invalid with respect to + * ReferencePriceCalculationResponse + */ + public static ReferencePriceCalculationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencePriceCalculationResponse.class); + } + + /** + * Convert an instance of ReferencePriceCalculationResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationResponseResult.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationResponseResult.java new file mode 100644 index 000000000..b8f563ce8 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceCalculationResponseResult.java @@ -0,0 +1,422 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ReferencePriceCalculationResponseResult */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ReferencePriceCalculationResponseResult extends BaseDTO { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_CALCULATION_TYPE = "calculationType"; + + @SerializedName(SERIALIZED_NAME_CALCULATION_TYPE) + @jakarta.annotation.Nullable + private String calculationType; + + public static final String SERIALIZED_NAME_BUCKET_COUNT = "bucketCount"; + + @SerializedName(SERIALIZED_NAME_BUCKET_COUNT) + @jakarta.annotation.Nullable + private Long bucketCount; + + public static final String SERIALIZED_NAME_BUCKET_WIDTH_MS = "bucketWidthMs"; + + @SerializedName(SERIALIZED_NAME_BUCKET_WIDTH_MS) + @jakarta.annotation.Nullable + private Long bucketWidthMs; + + public static final String SERIALIZED_NAME_EXTERNAL_CALCULATION_ID = "externalCalculationId"; + + @SerializedName(SERIALIZED_NAME_EXTERNAL_CALCULATION_ID) + @jakarta.annotation.Nullable + private Long externalCalculationId; + + public ReferencePriceCalculationResponseResult() {} + + public ReferencePriceCalculationResponseResult symbol( + @jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public ReferencePriceCalculationResponseResult calculationType( + @jakarta.annotation.Nullable String calculationType) { + this.calculationType = calculationType; + return this; + } + + /** + * Get calculationType + * + * @return calculationType + */ + @jakarta.annotation.Nullable + public String getCalculationType() { + return calculationType; + } + + public void setCalculationType(@jakarta.annotation.Nullable String calculationType) { + this.calculationType = calculationType; + } + + public ReferencePriceCalculationResponseResult bucketCount( + @jakarta.annotation.Nullable Long bucketCount) { + this.bucketCount = bucketCount; + return this; + } + + /** + * Get bucketCount + * + * @return bucketCount + */ + @jakarta.annotation.Nullable + public Long getBucketCount() { + return bucketCount; + } + + public void setBucketCount(@jakarta.annotation.Nullable Long bucketCount) { + this.bucketCount = bucketCount; + } + + public ReferencePriceCalculationResponseResult bucketWidthMs( + @jakarta.annotation.Nullable Long bucketWidthMs) { + this.bucketWidthMs = bucketWidthMs; + return this; + } + + /** + * Get bucketWidthMs + * + * @return bucketWidthMs + */ + @jakarta.annotation.Nullable + public Long getBucketWidthMs() { + return bucketWidthMs; + } + + public void setBucketWidthMs(@jakarta.annotation.Nullable Long bucketWidthMs) { + this.bucketWidthMs = bucketWidthMs; + } + + public ReferencePriceCalculationResponseResult externalCalculationId( + @jakarta.annotation.Nullable Long externalCalculationId) { + this.externalCalculationId = externalCalculationId; + return this; + } + + /** + * Get externalCalculationId + * + * @return externalCalculationId + */ + @jakarta.annotation.Nullable + public Long getExternalCalculationId() { + return externalCalculationId; + } + + public void setExternalCalculationId(@jakarta.annotation.Nullable Long externalCalculationId) { + this.externalCalculationId = externalCalculationId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferencePriceCalculationResponseResult referencePriceCalculationResponseResult = + (ReferencePriceCalculationResponseResult) o; + return Objects.equals(this.symbol, referencePriceCalculationResponseResult.symbol) + && Objects.equals( + this.calculationType, + referencePriceCalculationResponseResult.calculationType) + && Objects.equals( + this.bucketCount, referencePriceCalculationResponseResult.bucketCount) + && Objects.equals( + this.bucketWidthMs, referencePriceCalculationResponseResult.bucketWidthMs) + && Objects.equals( + this.externalCalculationId, + referencePriceCalculationResponseResult.externalCalculationId); + } + + @Override + public int hashCode() { + return Objects.hash( + symbol, calculationType, bucketCount, bucketWidthMs, externalCalculationId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencePriceCalculationResponseResult {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" calculationType: ").append(toIndentedString(calculationType)).append("\n"); + sb.append(" bucketCount: ").append(toIndentedString(bucketCount)).append("\n"); + sb.append(" bucketWidthMs: ").append(toIndentedString(bucketWidthMs)).append("\n"); + sb.append(" externalCalculationId: ") + .append(toIndentedString(externalCalculationId)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String symbolValue = getSymbol(); + if (symbolValue != null) { + String symbolValueAsString = symbolValue.toString(); + valMap.put("symbol", symbolValueAsString); + } + String calculationTypeValue = getCalculationType(); + if (calculationTypeValue != null) { + String calculationTypeValueAsString = calculationTypeValue.toString(); + valMap.put("calculationType", calculationTypeValueAsString); + } + Long bucketCountValue = getBucketCount(); + if (bucketCountValue != null) { + String bucketCountValueAsString = bucketCountValue.toString(); + valMap.put("bucketCount", bucketCountValueAsString); + } + Long bucketWidthMsValue = getBucketWidthMs(); + if (bucketWidthMsValue != null) { + String bucketWidthMsValueAsString = bucketWidthMsValue.toString(); + valMap.put("bucketWidthMs", bucketWidthMsValueAsString); + } + Long externalCalculationIdValue = getExternalCalculationId(); + if (externalCalculationIdValue != null) { + String externalCalculationIdValueAsString = externalCalculationIdValue.toString(); + valMap.put("externalCalculationId", externalCalculationIdValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object symbolValue = getSymbol(); + if (symbolValue != null) { + valMap.put("symbol", symbolValue); + } + Object calculationTypeValue = getCalculationType(); + if (calculationTypeValue != null) { + valMap.put("calculationType", calculationTypeValue); + } + Object bucketCountValue = getBucketCount(); + if (bucketCountValue != null) { + valMap.put("bucketCount", bucketCountValue); + } + Object bucketWidthMsValue = getBucketWidthMs(); + if (bucketWidthMsValue != null) { + valMap.put("bucketWidthMs", bucketWidthMsValue); + } + Object externalCalculationIdValue = getExternalCalculationId(); + if (externalCalculationIdValue != null) { + valMap.put("externalCalculationId", externalCalculationIdValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("calculationType"); + openapiFields.add("bucketCount"); + openapiFields.add("bucketWidthMs"); + openapiFields.add("externalCalculationId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ReferencePriceCalculationResponseResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencePriceCalculationResponseResult.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " ReferencePriceCalculationResponseResult is not found in the" + + " empty JSON string", + ReferencePriceCalculationResponseResult.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReferencePriceCalculationResponseResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ReferencePriceCalculationResponseResult` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("calculationType") != null && !jsonObj.get("calculationType").isJsonNull()) + && !jsonObj.get("calculationType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `calculationType` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("calculationType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencePriceCalculationResponseResult.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'ReferencePriceCalculationResponseResult' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ReferencePriceCalculationResponseResult.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, ReferencePriceCalculationResponseResult value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencePriceCalculationResponseResult read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReferencePriceCalculationResponseResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencePriceCalculationResponseResult + * @throws IOException if the JSON string is invalid with respect to + * ReferencePriceCalculationResponseResult + */ + public static ReferencePriceCalculationResponseResult fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencePriceCalculationResponseResult.class); + } + + /** + * Convert an instance of ReferencePriceCalculationResponseResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceRequest.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceRequest.java new file mode 100644 index 000000000..0dce3ab1b --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceRequest.java @@ -0,0 +1,251 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ReferencePriceRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ReferencePriceRequest extends BaseDTO { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nonnull + private String symbol; + + public ReferencePriceRequest() {} + + public ReferencePriceRequest symbol(@jakarta.annotation.Nonnull String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nonnull String symbol) { + this.symbol = symbol; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferencePriceRequest referencePriceRequest = (ReferencePriceRequest) o; + return Objects.equals(this.symbol, referencePriceRequest.symbol); + } + + @Override + public int hashCode() { + return Objects.hash(symbol); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencePriceRequest {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String symbolValue = getSymbol(); + if (symbolValue != null) { + String symbolValueAsString = symbolValue.toString(); + valMap.put("symbol", symbolValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object symbolValue = getSymbol(); + if (symbolValue != null) { + valMap.put("symbol", symbolValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("symbol"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReferencePriceRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencePriceRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReferencePriceRequest is not found in" + + " the empty JSON string", + ReferencePriceRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReferencePriceRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ReferencePriceRequest` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReferencePriceRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencePriceRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferencePriceRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ReferencePriceRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferencePriceRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencePriceRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReferencePriceRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencePriceRequest + * @throws IOException if the JSON string is invalid with respect to ReferencePriceRequest + */ + public static ReferencePriceRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencePriceRequest.class); + } + + /** + * Convert an instance of ReferencePriceRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceResponse.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceResponse.java new file mode 100644 index 000000000..ff43bf2c7 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceResponse.java @@ -0,0 +1,321 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ReferencePriceResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ReferencePriceResponse extends BaseDTO { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private Long status; + + public static final String SERIALIZED_NAME_RESULT = "result"; + + @SerializedName(SERIALIZED_NAME_RESULT) + @jakarta.annotation.Nullable + private ReferencePriceResponseResult result; + + public ReferencePriceResponse() {} + + public ReferencePriceResponse id(@jakarta.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id + */ + @jakarta.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable String id) { + this.id = id; + } + + public ReferencePriceResponse status(@jakarta.annotation.Nullable Long status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status + */ + @jakarta.annotation.Nullable + public Long getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable Long status) { + this.status = status; + } + + public ReferencePriceResponse result( + @jakarta.annotation.Nullable ReferencePriceResponseResult result) { + this.result = result; + return this; + } + + /** + * Get result + * + * @return result + */ + @jakarta.annotation.Nullable + @Valid + public ReferencePriceResponseResult getResult() { + return result; + } + + public void setResult(@jakarta.annotation.Nullable ReferencePriceResponseResult result) { + this.result = result; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferencePriceResponse referencePriceResponse = (ReferencePriceResponse) o; + return Objects.equals(this.id, referencePriceResponse.id) + && Objects.equals(this.status, referencePriceResponse.status) + && Objects.equals(this.result, referencePriceResponse.result); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencePriceResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String idValue = getId(); + if (idValue != null) { + String idValueAsString = idValue.toString(); + valMap.put("id", idValueAsString); + } + Long statusValue = getStatus(); + if (statusValue != null) { + String statusValueAsString = statusValue.toString(); + valMap.put("status", statusValueAsString); + } + ReferencePriceResponseResult resultValue = getResult(); + if (resultValue != null) { + String resultValueAsString = JSON.getGson().toJson(resultValue); + valMap.put("result", resultValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object idValue = getId(); + if (idValue != null) { + valMap.put("id", idValue); + } + Object statusValue = getStatus(); + if (statusValue != null) { + valMap.put("status", statusValue); + } + Object resultValue = getResult(); + if (resultValue != null) { + valMap.put("result", resultValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("status"); + openapiFields.add("result"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReferencePriceResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencePriceResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReferencePriceResponse is not found in" + + " the empty JSON string", + ReferencePriceResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReferencePriceResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ReferencePriceResponse` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `id` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("id").toString())); + } + // validate the optional field `result` + if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { + ReferencePriceResponseResult.validateJsonElement(jsonObj.get("result")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencePriceResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferencePriceResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ReferencePriceResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferencePriceResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencePriceResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReferencePriceResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencePriceResponse + * @throws IOException if the JSON string is invalid with respect to ReferencePriceResponse + */ + public static ReferencePriceResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencePriceResponse.class); + } + + /** + * Convert an instance of ReferencePriceResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceResponseResult.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceResponseResult.java new file mode 100644 index 000000000..c8fdb38ac --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/api/model/ReferencePriceResponseResult.java @@ -0,0 +1,327 @@ +/* + * Binance Spot WebSocket API + * OpenAPI Specifications for the Binance Spot WebSocket API API documents: - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md) - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ReferencePriceResponseResult */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ReferencePriceResponseResult extends BaseDTO { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nullable + private String symbol; + + public static final String SERIALIZED_NAME_REFERENCE_PRICE = "referencePrice"; + + @SerializedName(SERIALIZED_NAME_REFERENCE_PRICE) + @jakarta.annotation.Nullable + private String referencePrice; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @jakarta.annotation.Nullable + private Long timestamp; + + public ReferencePriceResponseResult() {} + + public ReferencePriceResponseResult symbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nullable + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nullable String symbol) { + this.symbol = symbol; + } + + public ReferencePriceResponseResult referencePrice( + @jakarta.annotation.Nullable String referencePrice) { + this.referencePrice = referencePrice; + return this; + } + + /** + * Get referencePrice + * + * @return referencePrice + */ + @jakarta.annotation.Nullable + public String getReferencePrice() { + return referencePrice; + } + + public void setReferencePrice(@jakarta.annotation.Nullable String referencePrice) { + this.referencePrice = referencePrice; + } + + public ReferencePriceResponseResult timestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * + * @return timestamp + */ + @jakarta.annotation.Nullable + public String getTimestamp() { + return String.valueOf(timestamp); + } + + public void setTimestamp(@jakarta.annotation.Nullable Long timestamp) { + this.timestamp = timestamp; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferencePriceResponseResult referencePriceResponseResult = + (ReferencePriceResponseResult) o; + return Objects.equals(this.symbol, referencePriceResponseResult.symbol) + && Objects.equals(this.referencePrice, referencePriceResponseResult.referencePrice) + && Objects.equals(this.timestamp, referencePriceResponseResult.timestamp); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, referencePrice, timestamp); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencePriceResponseResult {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" referencePrice: ").append(toIndentedString(referencePrice)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String symbolValue = getSymbol(); + if (symbolValue != null) { + String symbolValueAsString = symbolValue.toString(); + valMap.put("symbol", symbolValueAsString); + } + String referencePriceValue = getReferencePrice(); + if (referencePriceValue != null) { + String referencePriceValueAsString = referencePriceValue.toString(); + valMap.put("referencePrice", referencePriceValueAsString); + } + String timestampValue = getTimestamp(); + if (timestampValue != null) { + String timestampValueAsString = timestampValue.toString(); + valMap.put("timestamp", timestampValueAsString); + } + + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object symbolValue = getSymbol(); + if (symbolValue != null) { + valMap.put("symbol", symbolValue); + } + Object referencePriceValue = getReferencePrice(); + if (referencePriceValue != null) { + valMap.put("referencePrice", referencePriceValue); + } + Object timestampValue = getTimestamp(); + if (timestampValue != null) { + valMap.put("timestamp", timestampValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("referencePrice"); + openapiFields.add("timestamp"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ReferencePriceResponseResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencePriceResponseResult.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReferencePriceResponseResult is not" + + " found in the empty JSON string", + ReferencePriceResponseResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReferencePriceResponseResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ReferencePriceResponseResult` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) + && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("referencePrice") != null && !jsonObj.get("referencePrice").isJsonNull()) + && !jsonObj.get("referencePrice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `referencePrice` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("referencePrice").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencePriceResponseResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferencePriceResponseResult' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ReferencePriceResponseResult.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferencePriceResponseResult value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencePriceResponseResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReferencePriceResponseResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencePriceResponseResult + * @throws IOException if the JSON string is invalid with respect to + * ReferencePriceResponseResult + */ + public static ReferencePriceResponseResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencePriceResponseResult.class); + } + + /** + * Convert an instance of ReferencePriceResponseResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/JSON.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/JSON.java index 0ac1bdc1a..8c2862e9d 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/JSON.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/JSON.java @@ -489,6 +489,12 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.spot.websocket.stream.model.RateLimits .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.stream.model.ReferencePriceRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.spot.websocket.stream.model.ReferencePriceResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.spot.websocket.stream.model .RollingWindowTickerRequest.CustomTypeAdapterFactory()); diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/api/SpotWebSocketStreams.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/api/SpotWebSocketStreams.java index 010bf64be..930be17d1 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/api/SpotWebSocketStreams.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/api/SpotWebSocketStreams.java @@ -27,6 +27,8 @@ import com.binance.connector.client.spot.websocket.stream.model.MiniTickerResponse; import com.binance.connector.client.spot.websocket.stream.model.PartialBookDepthRequest; import com.binance.connector.client.spot.websocket.stream.model.PartialBookDepthResponse; +import com.binance.connector.client.spot.websocket.stream.model.ReferencePriceRequest; +import com.binance.connector.client.spot.websocket.stream.model.ReferencePriceResponse; import com.binance.connector.client.spot.websocket.stream.model.RollingWindowTickerRequest; import com.binance.connector.client.spot.websocket.stream.model.RollingWindowTickerResponse; import com.binance.connector.client.spot.websocket.stream.model.TickerRequest; @@ -38,7 +40,7 @@ public class SpotWebSocketStreams { private static final String USER_AGENT = String.format( - "binance-spot/9.0.0 (Java/%s; %s; %s)", + "binance-spot/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private final StreamConnectionInterface connection; @@ -114,6 +116,11 @@ public StreamBlockingQueueWrapper partialBookDepth( return webSocketStreamsApi.partialBookDepth(partialBookDepthRequest); } + public StreamBlockingQueueWrapper referencePrice( + ReferencePriceRequest referencePriceRequest) throws ApiException { + return webSocketStreamsApi.referencePrice(referencePriceRequest); + } + public StreamBlockingQueueWrapper rollingWindowTicker( RollingWindowTickerRequest rollingWindowTickerRequest) throws ApiException { return webSocketStreamsApi.rollingWindowTicker(rollingWindowTickerRequest); diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/api/WebSocketStreamsApi.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/api/WebSocketStreamsApi.java index 45a9a6059..53df8b802 100644 --- a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/api/WebSocketStreamsApi.java +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/api/WebSocketStreamsApi.java @@ -42,6 +42,8 @@ import com.binance.connector.client.spot.websocket.stream.model.MiniTickerResponse; import com.binance.connector.client.spot.websocket.stream.model.PartialBookDepthRequest; import com.binance.connector.client.spot.websocket.stream.model.PartialBookDepthResponse; +import com.binance.connector.client.spot.websocket.stream.model.ReferencePriceRequest; +import com.binance.connector.client.spot.websocket.stream.model.ReferencePriceResponse; import com.binance.connector.client.spot.websocket.stream.model.RollingWindowTickerRequest; import com.binance.connector.client.spot.websocket.stream.model.RollingWindowTickerResponse; import com.binance.connector.client.spot.websocket.stream.model.TickerRequest; @@ -62,7 +64,7 @@ public class WebSocketStreamsApi { private static final String USER_AGENT = String.format( - "binance-spot/9.0.0 (Java/%s; %s; %s)", + "binance-spot/10.0.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private StreamConnectionInterface connection; @@ -869,6 +871,83 @@ private void partialBookDepthValidateBeforeCall(PartialBookDepthRequest partialB } } + /** + * WebSocket Reference Price Streams + * + * @param referencePriceRequest (required) + * @return ReferencePriceResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Reference Price Streams -
+ * + * @see WebSocket + * Reference Price Streams Documentation + */ + public StreamBlockingQueueWrapper referencePrice( + ReferencePriceRequest referencePriceRequest) throws ApiException { + StreamBlockingQueue queue = referencePriceRaw(referencePriceRequest); + + TypeToken typeToken = new TypeToken() {}; + + return new StreamBlockingQueueWrapper<>(queue, typeToken); + } + + public StreamBlockingQueue referencePriceRaw( + ReferencePriceRequest referencePriceRequest) throws ApiException { + referencePriceValidateBeforeCall(referencePriceRequest); + + String methodName = + "/@referencePrice" + .substring(1) + .replace( + "", + referencePriceRequest.getSymbol() != null + ? referencePriceRequest.getSymbol().toString() + : ""); + if ("@".equals(methodName.substring(methodName.length() - 1))) { + methodName = methodName.substring(0, methodName.length() - 1); + } + + RequestWrapperDTO, Object> requestWrapperDTO = + new RequestWrapperDTO.Builder, Object>() + .id(getRequestID()) + .method("SUBSCRIBE") + .params(Collections.singleton(methodName)) + .build(); + Map> queuesMap = + connection.subscribe(requestWrapperDTO); + return queuesMap.get(methodName); + } + + @SuppressWarnings("rawtypes") + private void referencePriceValidateBeforeCall(ReferencePriceRequest referencePriceRequest) + throws ApiException { + try { + Validator validator = + Validation.byDefaultProvider() + .configure() + .messageInterpolator(new ParameterMessageInterpolator()) + .buildValidatorFactory() + .getValidator(); + + Set> violations = + validator.validate(referencePriceRequest); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + } + /** * WebSocket Individual Symbol Rolling Window Statistics Streams Rolling window ticker * statistics for a single symbol, computed over multiple windows. diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/model/ReferencePriceRequest.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/model/ReferencePriceRequest.java new file mode 100644 index 000000000..5d07ee7b6 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/model/ReferencePriceRequest.java @@ -0,0 +1,251 @@ +/* + * Binance Spot WebSocket Streams + * OpenAPI Specifications for the Binance Spot WebSocket Streams API documents: - [Github web-socket-streams documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md) - [General API information for web-socket-streams on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.stream.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.stream.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ReferencePriceRequest */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ReferencePriceRequest extends BaseDTO { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + + @SerializedName(SERIALIZED_NAME_SYMBOL) + @jakarta.annotation.Nonnull + private String symbol; + + public ReferencePriceRequest() {} + + public ReferencePriceRequest symbol(@jakarta.annotation.Nonnull String symbol) { + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * + * @return symbol + */ + @jakarta.annotation.Nonnull + @NotNull + public String getSymbol() { + return symbol; + } + + public void setSymbol(@jakarta.annotation.Nonnull String symbol) { + this.symbol = symbol; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferencePriceRequest referencePriceRequest = (ReferencePriceRequest) o; + return Objects.equals(this.symbol, referencePriceRequest.symbol); + } + + @Override + public int hashCode() { + return Objects.hash(symbol); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencePriceRequest {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String symbolValue = getSymbol(); + if (symbolValue != null) { + String symbolValueAsString = symbolValue.toString(); + valMap.put("symbol", symbolValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object symbolValue = getSymbol(); + if (symbolValue != null) { + valMap.put("symbol", symbolValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("symbol"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReferencePriceRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencePriceRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReferencePriceRequest is not found in" + + " the empty JSON string", + ReferencePriceRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReferencePriceRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ReferencePriceRequest` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReferencePriceRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `symbol` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("symbol").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencePriceRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferencePriceRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ReferencePriceRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferencePriceRequest value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencePriceRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReferencePriceRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencePriceRequest + * @throws IOException if the JSON string is invalid with respect to ReferencePriceRequest + */ + public static ReferencePriceRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencePriceRequest.class); + } + + /** + * Convert an instance of ReferencePriceRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/model/ReferencePriceResponse.java b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/model/ReferencePriceResponse.java new file mode 100644 index 000000000..658a14349 --- /dev/null +++ b/clients/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/model/ReferencePriceResponse.java @@ -0,0 +1,367 @@ +/* + * Binance Spot WebSocket Streams + * OpenAPI Specifications for the Binance Spot WebSocket Streams API documents: - [Github web-socket-streams documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md) - [General API information for web-socket-streams on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.stream.model; + +import com.binance.connector.client.common.websocket.dtos.BaseDTO; +import com.binance.connector.client.spot.websocket.stream.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import jakarta.validation.constraints.*; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; +import org.hibernate.validator.constraints.*; + +/** ReferencePriceResponse */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +public class ReferencePriceResponse extends BaseDTO { + public static final String SERIALIZED_NAME_E_LOWER_CASE = "e"; + + @SerializedName(SERIALIZED_NAME_E_LOWER_CASE) + @jakarta.annotation.Nullable + private String eLowerCase; + + public static final String SERIALIZED_NAME_S_LOWER_CASE = "s"; + + @SerializedName(SERIALIZED_NAME_S_LOWER_CASE) + @jakarta.annotation.Nullable + private String sLowerCase; + + public static final String SERIALIZED_NAME_R_LOWER_CASE = "r"; + + @SerializedName(SERIALIZED_NAME_R_LOWER_CASE) + @jakarta.annotation.Nullable + private String rLowerCase; + + public static final String SERIALIZED_NAME_T_LOWER_CASE = "t"; + + @SerializedName(SERIALIZED_NAME_T_LOWER_CASE) + @jakarta.annotation.Nullable + private Long tLowerCase; + + public ReferencePriceResponse() {} + + public ReferencePriceResponse eLowerCase(@jakarta.annotation.Nullable String eLowerCase) { + this.eLowerCase = eLowerCase; + return this; + } + + /** + * Get eLowerCase + * + * @return eLowerCase + */ + @jakarta.annotation.Nullable + public String geteLowerCase() { + return eLowerCase; + } + + public void seteLowerCase(@jakarta.annotation.Nullable String eLowerCase) { + this.eLowerCase = eLowerCase; + } + + public ReferencePriceResponse sLowerCase(@jakarta.annotation.Nullable String sLowerCase) { + this.sLowerCase = sLowerCase; + return this; + } + + /** + * Get sLowerCase + * + * @return sLowerCase + */ + @jakarta.annotation.Nullable + public String getsLowerCase() { + return sLowerCase; + } + + public void setsLowerCase(@jakarta.annotation.Nullable String sLowerCase) { + this.sLowerCase = sLowerCase; + } + + public ReferencePriceResponse rLowerCase(@jakarta.annotation.Nullable String rLowerCase) { + this.rLowerCase = rLowerCase; + return this; + } + + /** + * Get rLowerCase + * + * @return rLowerCase + */ + @jakarta.annotation.Nullable + public String getrLowerCase() { + return rLowerCase; + } + + public void setrLowerCase(@jakarta.annotation.Nullable String rLowerCase) { + this.rLowerCase = rLowerCase; + } + + public ReferencePriceResponse tLowerCase(@jakarta.annotation.Nullable Long tLowerCase) { + this.tLowerCase = tLowerCase; + return this; + } + + /** + * Get tLowerCase + * + * @return tLowerCase + */ + @jakarta.annotation.Nullable + public Long gettLowerCase() { + return tLowerCase; + } + + public void settLowerCase(@jakarta.annotation.Nullable Long tLowerCase) { + this.tLowerCase = tLowerCase; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferencePriceResponse referencePriceResponse = (ReferencePriceResponse) o; + return Objects.equals(this.eLowerCase, referencePriceResponse.eLowerCase) + && Objects.equals(this.sLowerCase, referencePriceResponse.sLowerCase) + && Objects.equals(this.rLowerCase, referencePriceResponse.rLowerCase) + && Objects.equals(this.tLowerCase, referencePriceResponse.tLowerCase); + } + + @Override + public int hashCode() { + return Objects.hash(eLowerCase, sLowerCase, rLowerCase, tLowerCase); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencePriceResponse {\n"); + sb.append(" eLowerCase: ").append(toIndentedString(eLowerCase)).append("\n"); + sb.append(" sLowerCase: ").append(toIndentedString(sLowerCase)).append("\n"); + sb.append(" rLowerCase: ").append(toIndentedString(rLowerCase)).append("\n"); + sb.append(" tLowerCase: ").append(toIndentedString(tLowerCase)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + String eLowerCaseValue = geteLowerCase(); + if (eLowerCaseValue != null) { + String eLowerCaseValueAsString = eLowerCaseValue.toString(); + valMap.put("eLowerCase", eLowerCaseValueAsString); + } + String sLowerCaseValue = getsLowerCase(); + if (sLowerCaseValue != null) { + String sLowerCaseValueAsString = sLowerCaseValue.toString(); + valMap.put("sLowerCase", sLowerCaseValueAsString); + } + String rLowerCaseValue = getrLowerCase(); + if (rLowerCaseValue != null) { + String rLowerCaseValueAsString = rLowerCaseValue.toString(); + valMap.put("rLowerCase", rLowerCaseValueAsString); + } + Long tLowerCaseValue = gettLowerCase(); + if (tLowerCaseValue != null) { + String tLowerCaseValueAsString = tLowerCaseValue.toString(); + valMap.put("tLowerCase", tLowerCaseValueAsString); + } + + valMap.put("timestamp", getTimestamp()); + return asciiEncode( + valMap.keySet().stream() + .map(key -> key + "=" + valMap.get(key)) + .collect(Collectors.joining("&"))); + } + + public Map toMap() { + Map valMap = new TreeMap(); + valMap.put("apiKey", getApiKey()); + Object eLowerCaseValue = geteLowerCase(); + if (eLowerCaseValue != null) { + valMap.put("eLowerCase", eLowerCaseValue); + } + Object sLowerCaseValue = getsLowerCase(); + if (sLowerCaseValue != null) { + valMap.put("sLowerCase", sLowerCaseValue); + } + Object rLowerCaseValue = getrLowerCase(); + if (rLowerCaseValue != null) { + valMap.put("rLowerCase", rLowerCaseValue); + } + Object tLowerCaseValue = gettLowerCase(); + if (tLowerCaseValue != null) { + valMap.put("tLowerCase", tLowerCaseValue); + } + + valMap.put("timestamp", getTimestamp()); + return valMap; + } + + public static String asciiEncode(String s) { + return new String(s.getBytes(), StandardCharsets.US_ASCII); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("e"); + openapiFields.add("s"); + openapiFields.add("r"); + openapiFields.add("t"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReferencePriceResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencePriceResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReferencePriceResponse is not found in" + + " the empty JSON string", + ReferencePriceResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReferencePriceResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ReferencePriceResponse` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("e") != null && !jsonObj.get("e").isJsonNull()) + && !jsonObj.get("e").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `e` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("e").toString())); + } + if ((jsonObj.get("s") != null && !jsonObj.get("s").isJsonNull()) + && !jsonObj.get("s").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `s` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("s").toString())); + } + if ((jsonObj.get("r") != null && !jsonObj.get("r").isJsonNull()) + && !jsonObj.get("r").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `r` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("r").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencePriceResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferencePriceResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ReferencePriceResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferencePriceResponse value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencePriceResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReferencePriceResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencePriceResponse + * @throws IOException if the JSON string is invalid with respect to ReferencePriceResponse + */ + public static ReferencePriceResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencePriceResponse.class); + } + + /** + * Convert an instance of ReferencePriceResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/spot/src/test/java/com/binance/connector/client/spot/websocket/api/api/GeneralApiTest.java b/clients/spot/src/test/java/com/binance/connector/client/spot/websocket/api/api/GeneralApiTest.java index 07f753ee5..17c1d5a4f 100644 --- a/clients/spot/src/test/java/com/binance/connector/client/spot/websocket/api/api/GeneralApiTest.java +++ b/clients/spot/src/test/java/com/binance/connector/client/spot/websocket/api/api/GeneralApiTest.java @@ -17,9 +17,11 @@ import com.binance.connector.client.common.websocket.adapter.ConnectionWrapper; import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.dtos.ApiRequestWrapperDTO; import com.binance.connector.client.common.websocket.dtos.BaseRequestDTO; import com.binance.connector.client.common.websocket.dtos.BaseResponseDTO; import com.binance.connector.client.common.websocket.dtos.RequestWrapperDTO; +import com.binance.connector.client.spot.websocket.api.JSON; import com.binance.connector.client.spot.websocket.api.model.ExchangeInfoRequest; import com.binance.connector.client.spot.websocket.api.model.ExchangeInfoResponse; import com.binance.connector.client.spot.websocket.api.model.Permissions; @@ -35,6 +37,7 @@ import org.eclipse.jetty.websocket.api.RemoteEndpoint; import org.eclipse.jetty.websocket.api.Session; +import org.eclipse.jetty.websocket.api.WriteCallback; import org.eclipse.jetty.websocket.client.WebSocketClient; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -168,4 +171,68 @@ public void timeTest() throws ApiException, URISyntaxException, IOException { JSONAssert.assertEquals(expectedJson, sentPayload, true); } + + @Test + public void serverShutdownTest() { + connectionSpy.onWebSocketText("{\"event\":{\"e\":\"serverShutdown\",\"E\":1770123456789}}"); + // Should call connect 2 times, one for the initial connect + one for reconnect + Mockito.verify(connectionSpy, Mockito.times(2)).connect(); + } + + @Test + public void serverShutdownAnyEventTest() { + connectionSpy.onWebSocketText("{\"event\":{\"e\":\"blablabla\",\"E\":1770123456789}}"); + // Connect only once for initial commit + Mockito.verify(connectionSpy, Mockito.times(1)).connect(); + } + + @Test + public void serverShutdownPendingMessagesTest() { + api.time(); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor writeCallbackArgumentCaptor = ArgumentCaptor.forClass(WriteCallback.class); + RemoteEndpoint remote = sessionMock.getRemote(); + + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), writeCallbackArgumentCaptor.capture()); + writeCallbackArgumentCaptor.getValue().writeSuccess(); + + connectionSpy.onWebSocketText("{\"event\":{\"e\":\"serverShutdown\",\"E\":1770123456789}}"); + // Should call connect only once for initial connect, reconnect should be pending as there is a pending request + Mockito.verify(connectionSpy, Mockito.times(1)).connect(); + + ApiRequestWrapperDTO requestWrapperDTO = JSON.getGson().fromJson(sendArgumentCaptor.getValue(), ApiRequestWrapperDTO.class); + connectionSpy.onWebSocketText("{\"id\":\"" + requestWrapperDTO.getId() + "\",\"status\":200,\"result\":{\"serverTime\":1773288442504},\"rateLimits\":[{\"rateLimitType\":\"REQUEST_WEIGHT\",\"interval\":\"MINUTE\",\"intervalNum\":1,\"limit\":6000,\"count\":3}]}"); + // Should be called a second time, as there is no more pending request + Mockito.verify(connectionSpy, Mockito.times(2)).connect(); + } + + @Test + public void multipleServerShutdownPendingMessagesTest() { + api.time(); + ArgumentCaptor sendArgumentCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor writeCallbackArgumentCaptor = ArgumentCaptor.forClass(WriteCallback.class); + RemoteEndpoint remote = sessionMock.getRemote(); + + Mockito.verify(remote).sendString(sendArgumentCaptor.capture(), writeCallbackArgumentCaptor.capture()); + writeCallbackArgumentCaptor.getValue().writeSuccess(); + + connectionSpy.onWebSocketText("{\"event\":{\"e\":\"serverShutdown\",\"E\":1770123456789}}"); + connectionSpy.onWebSocketText("{\"event\":{\"e\":\"serverShutdown\",\"E\":1770123456789}}"); + connectionSpy.onWebSocketText("{\"event\":{\"e\":\"serverShutdown\",\"E\":1770123456789}}"); + // Should call connect only once for initial connect, reconnect should be pending as there is a pending request + Mockito.verify(connectionSpy, Mockito.times(1)).connect(); + + ApiRequestWrapperDTO requestWrapperDTO = JSON.getGson().fromJson(sendArgumentCaptor.getValue(), ApiRequestWrapperDTO.class); + connectionSpy.onWebSocketText("{\"id\":\"" + requestWrapperDTO.getId() + "\",\"status\":200,\"result\":{\"serverTime\":1773288442504},\"rateLimits\":[{\"rateLimitType\":\"REQUEST_WEIGHT\",\"interval\":\"MINUTE\",\"intervalNum\":1,\"limit\":6000,\"count\":3}]}"); + // Should be called a second time, as there is no more pending request + Mockito.verify(connectionSpy, Mockito.times(2)).connect(); + } + + @Test + public void serverShutdownReconnectNotReadyTest() { + connectionSpy.setReady(false); + connectionSpy.onWebSocketText("{\"event\":{\"e\":\"serverShutdown\",\"E\":1770123456789}}"); + // Should call connect 1 times, should not reconnect as connection is not ready + Mockito.verify(connectionSpy, Mockito.times(1)).connect(); + } } diff --git a/examples/derivatives-trading-coin-futures/pom.xml b/examples/derivatives-trading-coin-futures/pom.xml index 03122fe35..60afb9631 100644 --- a/examples/derivatives-trading-coin-futures/pom.xml +++ b/examples/derivatives-trading-coin-futures/pom.xml @@ -31,7 +31,7 @@ io.github.binance binance-derivatives-trading-coin-futures - 6.0.0 + 7.0.0 \ No newline at end of file diff --git a/examples/derivatives-trading-options/pom.xml b/examples/derivatives-trading-options/pom.xml index c2515c537..e2b9ad966 100644 --- a/examples/derivatives-trading-options/pom.xml +++ b/examples/derivatives-trading-options/pom.xml @@ -31,7 +31,7 @@ io.github.binance binance-derivatives-trading-options - 6.0.0 + 7.0.0 \ No newline at end of file diff --git a/examples/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/marketmakerendpoints/SetAutoCancelAllOpenOrdersExample.java b/examples/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/marketmakerendpoints/SetAutoCancelAllOpenOrdersExample.java index 284687ee9..f7d8cfc7f 100644 --- a/examples/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/marketmakerendpoints/SetAutoCancelAllOpenOrdersExample.java +++ b/examples/derivatives-trading-options/src/main/java/com/binance/connector/client/derivatives_trading_options/rest/marketmakerendpoints/SetAutoCancelAllOpenOrdersExample.java @@ -53,7 +53,7 @@ public DerivativesTradingOptionsRestApi getApi() { * within 10 seconds with the specified underlying symbol, all open orders of the specified * symbol will be automatically canceled. If this endpoint is called with an countdownTime of 0, * the countdown timer will be stopped. * The system will check all countdowns approximately - * every 1000 milliseconds, **please note that sufficient redundancy should be considered when + * every 100 milliseconds, **please note that sufficient redundancy should be considered when * using this function**. We do not recommend setting the countdown time to be too precise or * too small. Weight: 1 * diff --git a/examples/derivatives-trading-usds-futures/pom.xml b/examples/derivatives-trading-usds-futures/pom.xml index 0cf360b22..7d364e5ce 100644 --- a/examples/derivatives-trading-usds-futures/pom.xml +++ b/examples/derivatives-trading-usds-futures/pom.xml @@ -31,7 +31,7 @@ io.github.binance binance-derivatives-trading-usds-futures - 9.0.0 + 10.0.0 \ No newline at end of file diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AggregateTradeStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AggregateTradeStreamsExample.java new file mode 100644 index 000000000..51a42d703 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AggregateTradeStreamsExample.java @@ -0,0 +1,57 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AggregateTradeStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AggregateTradeStreamsResponse; + +/** API examples for MarketApi */ +public class AggregateTradeStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Aggregate Trade Streams + * + *

The Aggregate Trade Streams push market trade information that is aggregated for fills + * with same price and taking side every 100 milliseconds. Only market trades will be + * aggregated, which means the insurance fund trades and ADL trades won't be aggregated. + * Retail Price Improvement(RPI) orders are aggregated into field `q` and without + * special tags to be distinguished. Update Speed: 100ms + * + * @throws ApiException if the Api call fails + */ + public void aggregateTradeStreamsExample() throws ApiException, InterruptedException { + AggregateTradeStreamsRequest aggregateTradeStreamsRequest = + new AggregateTradeStreamsRequest(); + aggregateTradeStreamsRequest.symbol("btcusdt"); + StreamBlockingQueueWrapper response = + getApi().aggregateTradeStreams(aggregateTradeStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketLiquidationOrderStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketLiquidationOrderStreamsExample.java new file mode 100644 index 000000000..e4bcfe308 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketLiquidationOrderStreamsExample.java @@ -0,0 +1,56 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketLiquidationOrderStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketLiquidationOrderStreamsResponse; + +/** API examples for MarketApi */ +public class AllMarketLiquidationOrderStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * All Market Liquidation Order Streams + * + *

The All Liquidation Order Snapshot Streams push force liquidation order information for + * all symbols in the market. For each symbol,only the latest one liquidation order within + * 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, + * no stream will be pushed. Update Speed: 1000ms + * + * @throws ApiException if the Api call fails + */ + public void allMarketLiquidationOrderStreamsExample() + throws ApiException, InterruptedException { + AllMarketLiquidationOrderStreamsRequest allMarketLiquidationOrderStreamsRequest = + new AllMarketLiquidationOrderStreamsRequest(); + StreamBlockingQueueWrapper response = + getApi().allMarketLiquidationOrderStreams(allMarketLiquidationOrderStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketMiniTickersStreamExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketMiniTickersStreamExample.java new file mode 100644 index 000000000..bc632f8ed --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketMiniTickersStreamExample.java @@ -0,0 +1,54 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketMiniTickersStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketMiniTickersStreamResponse; + +/** API examples for MarketApi */ +public class AllMarketMiniTickersStreamExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * All Market Mini Tickers Stream + * + *

24hr rolling window mini-ticker statistics for all symbols. These are NOT the statistics + * of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only + * tickers that have changed will be present in the array. Update Speed: 1000ms + * + * @throws ApiException if the Api call fails + */ + public void allMarketMiniTickersStreamExample() throws ApiException, InterruptedException { + AllMarketMiniTickersStreamRequest allMarketMiniTickersStreamRequest = + new AllMarketMiniTickersStreamRequest(); + StreamBlockingQueueWrapper response = + getApi().allMarketMiniTickersStream(allMarketMiniTickersStreamRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketTickersStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketTickersStreamsExample.java new file mode 100644 index 000000000..217970da3 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/AllMarketTickersStreamsExample.java @@ -0,0 +1,54 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketTickersStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllMarketTickersStreamsResponse; + +/** API examples for MarketApi */ +public class AllMarketTickersStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * All Market Tickers Streams + * + *

24hr rolling window ticker statistics for all symbols. These are NOT the statistics of the + * UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers + * that have changed will be present in the array. Update Speed: 1000ms + * + * @throws ApiException if the Api call fails + */ + public void allMarketTickersStreamsExample() throws ApiException, InterruptedException { + AllMarketTickersStreamsRequest allMarketTickersStreamsRequest = + new AllMarketTickersStreamsRequest(); + StreamBlockingQueueWrapper response = + getApi().allMarketTickersStreams(allMarketTickersStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/CompositeIndexSymbolInformationStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/CompositeIndexSymbolInformationStreamsExample.java new file mode 100644 index 000000000..e8288a491 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/CompositeIndexSymbolInformationStreamsExample.java @@ -0,0 +1,56 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.CompositeIndexSymbolInformationStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.CompositeIndexSymbolInformationStreamsResponse; + +/** API examples for MarketApi */ +public class CompositeIndexSymbolInformationStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Composite Index Symbol Information Streams + * + *

Composite index information for index symbols pushed every second. Update Speed: 1000ms + * + * @throws ApiException if the Api call fails + */ + public void compositeIndexSymbolInformationStreamsExample() + throws ApiException, InterruptedException { + CompositeIndexSymbolInformationStreamsRequest + compositeIndexSymbolInformationStreamsRequest = + new CompositeIndexSymbolInformationStreamsRequest(); + compositeIndexSymbolInformationStreamsRequest.symbol("btcusdt"); + StreamBlockingQueueWrapper response = + getApi().compositeIndexSymbolInformationStreams( + compositeIndexSymbolInformationStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/ContinuousContractKlineCandlestickStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/ContinuousContractKlineCandlestickStreamsExample.java new file mode 100644 index 000000000..df0e013be --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/ContinuousContractKlineCandlestickStreamsExample.java @@ -0,0 +1,58 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContinuousContractKlineCandlestickStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContinuousContractKlineCandlestickStreamsResponse; + +/** API examples for MarketApi */ +public class ContinuousContractKlineCandlestickStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Continuous Contract Kline/Candlestick Streams + * + *

Update Speed: 250ms + * + * @throws ApiException if the Api call fails + */ + public void continuousContractKlineCandlestickStreamsExample() + throws ApiException, InterruptedException { + ContinuousContractKlineCandlestickStreamsRequest + continuousContractKlineCandlestickStreamsRequest = + new ContinuousContractKlineCandlestickStreamsRequest(); + continuousContractKlineCandlestickStreamsRequest.pair("btcusdt"); + continuousContractKlineCandlestickStreamsRequest.contractType("next_quarter"); + continuousContractKlineCandlestickStreamsRequest.interval("1m"); + StreamBlockingQueueWrapper response = + getApi().continuousContractKlineCandlestickStreams( + continuousContractKlineCandlestickStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/ContractInfoStreamExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/ContractInfoStreamExample.java new file mode 100644 index 000000000..c887c081c --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/ContractInfoStreamExample.java @@ -0,0 +1,53 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContractInfoStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.ContractInfoStreamResponse; + +/** API examples for MarketApi */ +public class ContractInfoStreamExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Contract Info Stream + * + *

ContractInfo stream pushes when contract info updates(listing/settlement/contract bracket + * update). `bks` field only shows up when bracket gets updated. Update Speed: + * Real-time + * + * @throws ApiException if the Api call fails + */ + public void contractInfoStreamExample() throws ApiException, InterruptedException { + ContractInfoStreamRequest contractInfoStreamRequest = new ContractInfoStreamRequest(); + StreamBlockingQueueWrapper response = + getApi().contractInfoStream(contractInfoStreamRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/IndividualSymbolMiniTickerStreamExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/IndividualSymbolMiniTickerStreamExample.java new file mode 100644 index 000000000..311691fd1 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/IndividualSymbolMiniTickerStreamExample.java @@ -0,0 +1,56 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolMiniTickerStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolMiniTickerStreamResponse; + +/** API examples for MarketApi */ +public class IndividualSymbolMiniTickerStreamExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Individual Symbol Mini Ticker Stream + * + *

24hr rolling window mini-ticker statistics for a single symbol. These are NOT the + * statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Update + * Speed: 2s + * + * @throws ApiException if the Api call fails + */ + public void individualSymbolMiniTickerStreamExample() + throws ApiException, InterruptedException { + IndividualSymbolMiniTickerStreamRequest individualSymbolMiniTickerStreamRequest = + new IndividualSymbolMiniTickerStreamRequest(); + individualSymbolMiniTickerStreamRequest.symbol("btcusdt"); + StreamBlockingQueueWrapper response = + getApi().individualSymbolMiniTickerStream(individualSymbolMiniTickerStreamRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/IndividualSymbolTickerStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/IndividualSymbolTickerStreamsExample.java new file mode 100644 index 000000000..a2df2152e --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/IndividualSymbolTickerStreamsExample.java @@ -0,0 +1,54 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolTickerStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolTickerStreamsResponse; + +/** API examples for MarketApi */ +public class IndividualSymbolTickerStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Individual Symbol Ticker Streams + * + *

24hr rolling window ticker statistics for a single symbol. These are NOT the statistics of + * the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Update Speed: 2000ms + * + * @throws ApiException if the Api call fails + */ + public void individualSymbolTickerStreamsExample() throws ApiException, InterruptedException { + IndividualSymbolTickerStreamsRequest individualSymbolTickerStreamsRequest = + new IndividualSymbolTickerStreamsRequest(); + individualSymbolTickerStreamsRequest.symbol("btcusdt"); + StreamBlockingQueueWrapper response = + getApi().individualSymbolTickerStreams(individualSymbolTickerStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/KlineCandlestickStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/KlineCandlestickStreamsExample.java new file mode 100644 index 000000000..fbfe944a9 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/KlineCandlestickStreamsExample.java @@ -0,0 +1,55 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.KlineCandlestickStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.KlineCandlestickStreamsResponse; + +/** API examples for MarketApi */ +public class KlineCandlestickStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Kline/Candlestick Streams + * + *

The Kline/Candlestick Stream push updates to the current klines/candlestick every 250 + * milliseconds (if existing). Update Speed: 250ms + * + * @throws ApiException if the Api call fails + */ + public void klineCandlestickStreamsExample() throws ApiException, InterruptedException { + KlineCandlestickStreamsRequest klineCandlestickStreamsRequest = + new KlineCandlestickStreamsRequest(); + klineCandlestickStreamsRequest.symbol("btcusdt"); + klineCandlestickStreamsRequest.interval("1m"); + StreamBlockingQueueWrapper response = + getApi().klineCandlestickStreams(klineCandlestickStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/LiquidationOrderStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/LiquidationOrderStreamsExample.java new file mode 100644 index 000000000..c9942ce50 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/LiquidationOrderStreamsExample.java @@ -0,0 +1,56 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.LiquidationOrderStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.LiquidationOrderStreamsResponse; + +/** API examples for MarketApi */ +public class LiquidationOrderStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Liquidation Order Streams + * + *

The Liquidation Order Snapshot Streams push force liquidation order information for + * specific symbol. For each symbol,only the latest one liquidation order within 1000ms will be + * pushed as the snapshot. If no liquidation happens in the interval of 1000ms, no stream will + * be pushed. Update Speed: 1000ms + * + * @throws ApiException if the Api call fails + */ + public void liquidationOrderStreamsExample() throws ApiException, InterruptedException { + LiquidationOrderStreamsRequest liquidationOrderStreamsRequest = + new LiquidationOrderStreamsRequest(); + liquidationOrderStreamsRequest.symbol("btcusdt"); + StreamBlockingQueueWrapper response = + getApi().liquidationOrderStreams(liquidationOrderStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamExample.java new file mode 100644 index 000000000..c7d296018 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamExample.java @@ -0,0 +1,53 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamResponse; + +/** API examples for MarketApi */ +public class MarkPriceStreamExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Mark Price Stream + * + *

Mark price and funding rate for a single symbol pushed every 3 seconds or every second. + * Update Speed: 3000ms or 1000ms + * + * @throws ApiException if the Api call fails + */ + public void markPriceStreamExample() throws ApiException, InterruptedException { + MarkPriceStreamRequest markPriceStreamRequest = new MarkPriceStreamRequest(); + markPriceStreamRequest.symbol("btcusdt"); + StreamBlockingQueueWrapper response = + getApi().markPriceStream(markPriceStreamRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamForAllMarketExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamForAllMarketExample.java new file mode 100644 index 000000000..58b8da66c --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamForAllMarketExample.java @@ -0,0 +1,54 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamForAllMarketRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MarkPriceStreamForAllMarketResponse; + +/** API examples for MarketApi */ +public class MarkPriceStreamForAllMarketExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Mark Price Stream for All market + * + *

Mark price and funding rate for all symbols pushed every 3 seconds or every second. + * **Note**: TradFi symbols will be pushed through a seperate message. Update Speed: 3000ms or + * 1000ms + * + * @throws ApiException if the Api call fails + */ + public void markPriceStreamForAllMarketExample() throws ApiException, InterruptedException { + MarkPriceStreamForAllMarketRequest markPriceStreamForAllMarketRequest = + new MarkPriceStreamForAllMarketRequest(); + StreamBlockingQueueWrapper response = + getApi().markPriceStreamForAllMarket(markPriceStreamForAllMarketRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MultiAssetsModeAssetIndexExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MultiAssetsModeAssetIndexExample.java new file mode 100644 index 000000000..7c9833dd7 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MultiAssetsModeAssetIndexExample.java @@ -0,0 +1,52 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MultiAssetsModeAssetIndexRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.MultiAssetsModeAssetIndexResponse; + +/** API examples for MarketApi */ +public class MultiAssetsModeAssetIndexExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Multi-Assets Mode Asset Index + * + *

Asset index for multi-assets mode user Update Speed: 1s + * + * @throws ApiException if the Api call fails + */ + public void multiAssetsModeAssetIndexExample() throws ApiException, InterruptedException { + MultiAssetsModeAssetIndexRequest multiAssetsModeAssetIndexRequest = + new MultiAssetsModeAssetIndexRequest(); + StreamBlockingQueueWrapper response = + getApi().multiAssetsModeAssetIndex(multiAssetsModeAssetIndexRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/TradingSessionStreamExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/TradingSessionStreamExample.java new file mode 100644 index 000000000..53114cfd6 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/TradingSessionStreamExample.java @@ -0,0 +1,57 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.TradingSessionStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.TradingSessionStreamResponse; + +/** API examples for MarketApi */ +public class TradingSessionStreamExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Trading Session Stream + * + *

Trading session information for the underlying assets of TradFi Perpetual + * contracts—covering the U.S. equity market and the commodity market—is updated every second. + * Trading session information for different underlying markets is pushed in separate messages. + * Session types for the equity market include \"PRE_MARKET\", \"REGULAR\", + * \"AFTER_MARKET\", \"OVERNIGHT\", and \"NO_TRADING\". Session + * types for the commodity market include \"REGULAR\" and \"NO_TRADING\". + * Update Speed: 1s + * + * @throws ApiException if the Api call fails + */ + public void tradingSessionStreamExample() throws ApiException, InterruptedException { + TradingSessionStreamRequest tradingSessionStreamRequest = new TradingSessionStreamRequest(); + StreamBlockingQueueWrapper response = + getApi().tradingSessionStream(tradingSessionStreamRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/AllBookTickersStreamExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/AllBookTickersStreamExample.java new file mode 100644 index 000000000..dfbb5a032 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/AllBookTickersStreamExample.java @@ -0,0 +1,53 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.publicpkg; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllBookTickersStreamRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.AllBookTickersStreamResponse; + +/** API examples for PublicApi */ +public class AllBookTickersStreamExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * All Book Tickers Stream + * + *

Pushes any update to the best bid or ask's price or quantity in real-time for all + * symbols. Retail Price Improvement(RPI) orders are not visible and excluded in the response + * message. Update Speed: 5s + * + * @throws ApiException if the Api call fails + */ + public void allBookTickersStreamExample() throws ApiException, InterruptedException { + AllBookTickersStreamRequest allBookTickersStreamRequest = new AllBookTickersStreamRequest(); + StreamBlockingQueueWrapper response = + getApi().allBookTickersStream(allBookTickersStreamRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/DiffBookDepthStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/DiffBookDepthStreamsExample.java new file mode 100644 index 000000000..6d808d782 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/DiffBookDepthStreamsExample.java @@ -0,0 +1,54 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.publicpkg; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.DiffBookDepthStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.DiffBookDepthStreamsResponse; + +/** API examples for PublicApi */ +public class DiffBookDepthStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Diff. Book Depth Streams + * + *

Bids and asks, pushed every 250 milliseconds, 500 milliseconds, 100 milliseconds (if + * existing) Retail Price Improvement(RPI) orders are not visible and excluded in the response + * message. Update Speed: 250ms, 500ms, 100ms + * + * @throws ApiException if the Api call fails + */ + public void diffBookDepthStreamsExample() throws ApiException, InterruptedException { + DiffBookDepthStreamsRequest diffBookDepthStreamsRequest = new DiffBookDepthStreamsRequest(); + diffBookDepthStreamsRequest.symbol("btcusdt"); + StreamBlockingQueueWrapper response = + getApi().diffBookDepthStreams(diffBookDepthStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/IndividualSymbolBookTickerStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/IndividualSymbolBookTickerStreamsExample.java new file mode 100644 index 000000000..b797faab2 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/IndividualSymbolBookTickerStreamsExample.java @@ -0,0 +1,57 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.publicpkg; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolBookTickerStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.IndividualSymbolBookTickerStreamsResponse; + +/** API examples for PublicApi */ +public class IndividualSymbolBookTickerStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Individual Symbol Book Ticker Streams + * + *

Pushes any update to the best bid or ask's price or quantity in real-time for a + * specified symbol. Retail Price Improvement(RPI) orders are not visible and excluded in the + * response message. Update Speed: Real-time + * + * @throws ApiException if the Api call fails + */ + public void individualSymbolBookTickerStreamsExample() + throws ApiException, InterruptedException { + IndividualSymbolBookTickerStreamsRequest individualSymbolBookTickerStreamsRequest = + new IndividualSymbolBookTickerStreamsRequest(); + individualSymbolBookTickerStreamsRequest.symbol("btcusdt"); + StreamBlockingQueueWrapper response = + getApi().individualSymbolBookTickerStreams( + individualSymbolBookTickerStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/PartialBookDepthStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/PartialBookDepthStreamsExample.java new file mode 100644 index 000000000..cf0f211cb --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/PartialBookDepthStreamsExample.java @@ -0,0 +1,56 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.publicpkg; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.PartialBookDepthStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.PartialBookDepthStreamsResponse; + +/** API examples for PublicApi */ +public class PartialBookDepthStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * Partial Book Depth Streams + * + *

Top **<levels\\>** bids and asks, Valid **<levels\\>** are 5, 10, or 20. + * Retail Price Improvement(RPI) orders are not visible and excluded in the response message. + * Update Speed: 250ms, 500ms or 100ms + * + * @throws ApiException if the Api call fails + */ + public void partialBookDepthStreamsExample() throws ApiException, InterruptedException { + PartialBookDepthStreamsRequest partialBookDepthStreamsRequest = + new PartialBookDepthStreamsRequest(); + partialBookDepthStreamsRequest.symbol("btcusdt"); + partialBookDepthStreamsRequest.levels(10L); + StreamBlockingQueueWrapper response = + getApi().partialBookDepthStreams(partialBookDepthStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/RpiDiffBookDepthStreamsExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/RpiDiffBookDepthStreamsExample.java new file mode 100644 index 000000000..7644c1155 --- /dev/null +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/publicpkg/RpiDiffBookDepthStreamsExample.java @@ -0,0 +1,57 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.publicpkg; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.DerivativesTradingUsdsFuturesWebSocketStreamsUtil; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.api.DerivativesTradingUsdsFuturesWebSocketStreams; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.RpiDiffBookDepthStreamsRequest; +import com.binance.connector.client.derivatives_trading_usds_futures.websocket.stream.model.RpiDiffBookDepthStreamsResponse; + +/** API examples for PublicApi */ +public class RpiDiffBookDepthStreamsExample { + private DerivativesTradingUsdsFuturesWebSocketStreams api; + + public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + DerivativesTradingUsdsFuturesWebSocketStreamsUtil.getClientConfiguration(); + api = new DerivativesTradingUsdsFuturesWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * RPI Diff. Book Depth Streams + * + *

Bids and asks including RPI orders, pushed every 500 milliseconds RPI(Retail Price + * Improvement) orders are included and aggreated in the response message. When the quantity of + * a price level to be updated is equal to 0, it means either all quotations for this price have + * been filled/canceled, or the quantity of crossed RPI orders for this price are hidden Update + * Speed: 500ms + * + * @throws ApiException if the Api call fails + */ + public void rpiDiffBookDepthStreamsExample() throws ApiException, InterruptedException { + RpiDiffBookDepthStreamsRequest rpiDiffBookDepthStreamsRequest = + new RpiDiffBookDepthStreamsRequest(); + rpiDiffBookDepthStreamsRequest.symbol("btcusdt"); + StreamBlockingQueueWrapper response = + getApi().rpiDiffBookDepthStreams(rpiDiffBookDepthStreamsRequest); + while (true) { + System.out.println(response.take()); + } + } +} diff --git a/examples/simple-earn/pom.xml b/examples/simple-earn/pom.xml index 3dc6cefb9..445d3ec62 100644 --- a/examples/simple-earn/pom.xml +++ b/examples/simple-earn/pom.xml @@ -31,7 +31,7 @@ io.github.binance binance-simple-earn - 5.0.0 + 6.0.0 \ No newline at end of file diff --git a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/bfusd/GetBfusdQuotaDetailsExample.java b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/bfusd/GetBfusdQuotaDetailsExample.java index 8f3068ffd..2915486d4 100644 --- a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/bfusd/GetBfusdQuotaDetailsExample.java +++ b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/bfusd/GetBfusdQuotaDetailsExample.java @@ -40,8 +40,8 @@ public SimpleEarnRestApi getApi() { /** * Get BFUSD Quota Details (USER_DATA) * - *

Get BFUSD quota details including fast redemption quota and standard redemption quota. - * Weight: 150 + *

Get BFUSD quota details including subscription quota, fast redemption quota and standard + * redemption quota. Weight: 150 * * @throws ApiException if the Api call fails */ diff --git a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleRedemptionRecordExample.java b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleRedemptionRecordExample.java index ac7258929..7b1a2a297 100644 --- a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleRedemptionRecordExample.java +++ b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleRedemptionRecordExample.java @@ -41,7 +41,7 @@ public SimpleEarnRestApi getApi() { * Get Flexible Redemption Record(USER_DATA) * *

Get Flexible Redemption Record * The time between `startTime` and - * `endTime` cannot be longer than 3 months. * If `startTime` and + * `endTime` cannot be longer than 30 days. * If `startTime` and * `endTime` are both not sent, then the last 30 days' data will be returned. * If * `startTime` is sent but `endTime` is not sent, the next 30 days' data * beginning from `startTime` will be returned. * If `endTime` is sent but diff --git a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleRewardsHistoryExample.java b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleRewardsHistoryExample.java index 2be2956a5..2e96c788d 100644 --- a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleRewardsHistoryExample.java +++ b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleRewardsHistoryExample.java @@ -41,7 +41,7 @@ public SimpleEarnRestApi getApi() { * Get Flexible Rewards History(USER_DATA) * *

Get Flexible Rewards History * The time between `startTime` and - * `endTime` cannot be longer than 3 months. * If `startTime` and + * `endTime` cannot be longer than 30 days. * If `startTime` and * `endTime` are both not sent, then the last 30 days' data will be returned. * If * `startTime` is sent but `endTime` is not sent, the next 30 days' data * beginning from `startTime` will be returned. * If `endTime` is sent but diff --git a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleSubscriptionRecordExample.java b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleSubscriptionRecordExample.java index b703793e1..7d2ce77f3 100644 --- a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleSubscriptionRecordExample.java +++ b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetFlexibleSubscriptionRecordExample.java @@ -41,7 +41,7 @@ public SimpleEarnRestApi getApi() { * Get Flexible Subscription Record(USER_DATA) * *

Get Flexible Subscription Record * The time between `startTime` and - * `endTime` cannot be longer than 3 months. * If `startTime` and + * `endTime` cannot be longer than 30 days. * If `startTime` and * `endTime` are both not sent, then the last 30 days' data will be returned. * If * `startTime` is sent but `endTime` is not sent, the next 30 days' data * beginning from `startTime` will be returned. * If `endTime` is sent but diff --git a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedRedemptionRecordExample.java b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedRedemptionRecordExample.java index f6df86e88..52fc90929 100644 --- a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedRedemptionRecordExample.java +++ b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedRedemptionRecordExample.java @@ -41,7 +41,7 @@ public SimpleEarnRestApi getApi() { * Get Locked Redemption Record(USER_DATA) * *

Get Locked Redemption Record * The time between `startTime` and - * `endTime` cannot be longer than 3 months. * If `startTime` and + * `endTime` cannot be longer than 30 days. * If `startTime` and * `endTime` are both not sent, then the last 30 days' data will be returned. * If * `startTime` is sent but `endTime` is not sent, the next 30 days' data * beginning from `startTime` will be returned. * If `endTime` is sent but diff --git a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedRewardsHistoryExample.java b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedRewardsHistoryExample.java index c6a6cfd83..4c4107d6e 100644 --- a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedRewardsHistoryExample.java +++ b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedRewardsHistoryExample.java @@ -41,7 +41,7 @@ public SimpleEarnRestApi getApi() { * Get Locked Rewards History(USER_DATA) * *

Get Locked Rewards History * The time between `startTime` and - * `endTime` cannot be longer than 3 months. * If `startTime` and + * `endTime` cannot be longer than 30 days. * If `startTime` and * `endTime` are both not sent, then the last 30 days' data will be returned. * If * `startTime` is sent but `endTime` is not sent, the next 30 days' data * beginning from `startTime` will be returned. * If `endTime` is sent but diff --git a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedSubscriptionRecordExample.java b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedSubscriptionRecordExample.java index a59720ae9..4487e5dd2 100644 --- a/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedSubscriptionRecordExample.java +++ b/examples/simple-earn/src/main/java/com/binance/connector/client/simple_earn/rest/flexiblelocked/GetLockedSubscriptionRecordExample.java @@ -41,7 +41,7 @@ public SimpleEarnRestApi getApi() { * Get Locked Subscription Record(USER_DATA) * *

Get Locked Subscription Record * The time between `startTime` and - * `endTime` cannot be longer than 3 months. * If `startTime` and + * `endTime` cannot be longer than 30 days. * If `startTime` and * `endTime` are both not sent, then the last 30 days' data will be returned. * If * `startTime` is sent but `endTime` is not sent, the next 30 days' data * beginning from `startTime` will be returned. * If `endTime` is sent but diff --git a/examples/spot/pom.xml b/examples/spot/pom.xml index b29a4b03d..f573ffd5a 100644 --- a/examples/spot/pom.xml +++ b/examples/spot/pom.xml @@ -31,7 +31,7 @@ io.github.binance binance-spot - 9.0.0 + 10.0.0 \ No newline at end of file diff --git a/examples/spot/src/main/java/com/binance/connector/client/spot/rest/general/ExecutionRulesExample.java b/examples/spot/src/main/java/com/binance/connector/client/spot/rest/general/ExecutionRulesExample.java new file mode 100644 index 000000000..4fd2d9916 --- /dev/null +++ b/examples/spot/src/main/java/com/binance/connector/client/spot/rest/general/ExecutionRulesExample.java @@ -0,0 +1,57 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.rest.general; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.spot.rest.SpotRestApiUtil; +import com.binance.connector.client.spot.rest.api.SpotRestApi; +import com.binance.connector.client.spot.rest.model.ExecutionRulesResponse; +import com.binance.connector.client.spot.rest.model.SymbolStatus; +import com.binance.connector.client.spot.rest.model.Symbols; + +/** API examples for GeneralApi */ +public class ExecutionRulesExample { + private SpotRestApi api; + + public SpotRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = SpotRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new SpotRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Execution Rules + * + *

Weight: Parameter | Weight| --- | --- `symbol` | 2 `symbols` | 2 for + * each `symbol`, capped at a max of 40| `symbolStatus` |40| None |40| + * + * @throws ApiException if the Api call fails + */ + public void executionRulesExample() throws ApiException { + String symbol = "BNBUSDT"; + Symbols symbols = null; + SymbolStatus symbolStatus = SymbolStatus.TRADING; + ApiResponse response = + getApi().executionRules(symbol, symbols, symbolStatus); + System.out.println(response.getData()); + } +} diff --git a/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/ReferencePriceCalculationExample.java b/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/ReferencePriceCalculationExample.java new file mode 100644 index 000000000..5b1b5726b --- /dev/null +++ b/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/ReferencePriceCalculationExample.java @@ -0,0 +1,54 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.rest.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.spot.rest.SpotRestApiUtil; +import com.binance.connector.client.spot.rest.api.SpotRestApi; +import com.binance.connector.client.spot.rest.model.ReferencePriceCalculationResponse; +import com.binance.connector.client.spot.rest.model.SymbolStatus; + +/** API examples for MarketApi */ +public class ReferencePriceCalculationExample { + private SpotRestApi api; + + public SpotRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = SpotRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new SpotRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Reference Price Calculation + * + *

Describes how reference price is calculated for a given symbol. Weight: 2 + * + * @throws ApiException if the Api call fails + */ + public void referencePriceCalculationExample() throws ApiException { + String symbol = "BNBUSDT"; + SymbolStatus symbolStatus = SymbolStatus.TRADING; + ApiResponse response = + getApi().referencePriceCalculation(symbol, symbolStatus); + System.out.println(response.getData()); + } +} diff --git a/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/ReferencePriceExample.java b/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/ReferencePriceExample.java new file mode 100644 index 000000000..e664fd492 --- /dev/null +++ b/examples/spot/src/main/java/com/binance/connector/client/spot/rest/market/ReferencePriceExample.java @@ -0,0 +1,51 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.rest.market; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.ApiResponse; +import com.binance.connector.client.common.configuration.ClientConfiguration; +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.spot.rest.SpotRestApiUtil; +import com.binance.connector.client.spot.rest.api.SpotRestApi; +import com.binance.connector.client.spot.rest.model.ReferencePriceResponse; + +/** API examples for MarketApi */ +public class ReferencePriceExample { + private SpotRestApi api; + + public SpotRestApi getApi() { + if (api == null) { + ClientConfiguration clientConfiguration = SpotRestApiUtil.getClientConfiguration(); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new SpotRestApi(clientConfiguration); + } + return api; + } + + /** + * Query Reference Price + * + *

Weight: 2 + * + * @throws ApiException if the Api call fails + */ + public void referencePriceExample() throws ApiException { + String symbol = "BNBUSDT"; + ApiResponse response = getApi().referencePrice(symbol); + System.out.println(response.getData()); + } +} diff --git a/examples/spot/src/main/java/com/binance/connector/client/spot/rest/trade/OrderCancelReplaceExample.java b/examples/spot/src/main/java/com/binance/connector/client/spot/rest/trade/OrderCancelReplaceExample.java index 6f6e73b9a..d041e96d0 100644 --- a/examples/spot/src/main/java/com/binance/connector/client/spot/rest/trade/OrderCancelReplaceExample.java +++ b/examples/spot/src/main/java/com/binance/connector/client/spot/rest/trade/OrderCancelReplaceExample.java @@ -43,10 +43,12 @@ public SpotRestApi getApi() { /** * Cancel an Existing Order and Send a New Order * - *

Cancels an existing order and places a new order on the same symbol. Filters and Order - * Count are evaluated before the processing of the cancellation and order placement occurs. A + *

* Cancels an existing order and places a new order on the same symbol. * Filters and Order + * Count are evaluated before the processing of the cancellation and order placement occurs. * A * new order that was not attempted (i.e. when `newOrderResult: NOT_ATTEMPTED`), will - * still increase the unfilled order count by 1. Weight: 1 + * still increase the unfilled order count by 1. * You can only cancel an individual order from + * an orderList using this endpoint, but the result is the same as canceling the entire + * orderList. Weight: 1 * * @throws ApiException if the Api call fails */ diff --git a/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/general/ExecutionRulesExample.java b/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/general/ExecutionRulesExample.java new file mode 100644 index 000000000..9b2e1058b --- /dev/null +++ b/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/general/ExecutionRulesExample.java @@ -0,0 +1,76 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.general; + +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.spot.websocket.api.SpotWebSocketApiUtil; +import com.binance.connector.client.spot.websocket.api.api.SpotWebSocketApi; +import com.binance.connector.client.spot.websocket.api.model.ExecutionRulesRequest; +import com.binance.connector.client.spot.websocket.api.model.ExecutionRulesResponse; +import java.util.concurrent.CompletableFuture; + +/** API examples for GeneralApi */ +public class ExecutionRulesExample { + private SpotWebSocketApi api; + + public SpotWebSocketApi getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + SpotWebSocketApiUtil.getClientConfiguration(); + // if you want the connection to be auto logged on: + // https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/authentication-requests + clientConfiguration.setAutoLogon(true); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("/path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new SpotWebSocketApi(clientConfiguration); + } + return api; + } + + /** + * WebSocket Query Execution Rules + * + *

Weight: Parameter | Weight| --- | --- `symbol` | 2 `symbols` | 2 for + * each `symbol`, capped at a max of 40| `symbolStatus` |40| None |40| + */ + public void executionRulesExampleAsync() { + ExecutionRulesRequest executionRulesRequest = new ExecutionRulesRequest(); + CompletableFuture future = + getApi().executionRules(executionRulesRequest); + future.handle( + (response, error) -> { + if (error != null) { + System.err.println(error); + } + System.out.println(response); + return response; + }); + } + + /** + * WebSocket Query Execution Rules + * + *

Weight: Parameter | Weight| --- | --- `symbol` | 2 `symbols` | 2 for + * each `symbol`, capped at a max of 40| `symbolStatus` |40| None |40| + */ + public void executionRulesExampleSync() { + ExecutionRulesRequest executionRulesRequest = new ExecutionRulesRequest(); + CompletableFuture future = + getApi().executionRules(executionRulesRequest); + ExecutionRulesResponse response = future.join(); + System.out.println(response); + } +} diff --git a/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/ReferencePriceCalculationExample.java b/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/ReferencePriceCalculationExample.java new file mode 100644 index 000000000..0bdfa4002 --- /dev/null +++ b/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/ReferencePriceCalculationExample.java @@ -0,0 +1,78 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.market; + +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.spot.websocket.api.SpotWebSocketApiUtil; +import com.binance.connector.client.spot.websocket.api.api.SpotWebSocketApi; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceCalculationRequest; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceCalculationResponse; +import java.util.concurrent.CompletableFuture; + +/** API examples for MarketApi */ +public class ReferencePriceCalculationExample { + private SpotWebSocketApi api; + + public SpotWebSocketApi getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + SpotWebSocketApiUtil.getClientConfiguration(); + // if you want the connection to be auto logged on: + // https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/authentication-requests + clientConfiguration.setAutoLogon(true); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("/path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new SpotWebSocketApi(clientConfiguration); + } + return api; + } + + /** + * WebSocket Query Reference Price Calculation + * + *

Describes how reference price is calculated for a given symbol. Weight: 2 + */ + public void referencePriceCalculationExampleAsync() { + ReferencePriceCalculationRequest referencePriceCalculationRequest = + new ReferencePriceCalculationRequest(); + referencePriceCalculationRequest.symbol("BNBUSDT"); + CompletableFuture future = + getApi().referencePriceCalculation(referencePriceCalculationRequest); + future.handle( + (response, error) -> { + if (error != null) { + System.err.println(error); + } + System.out.println(response); + return response; + }); + } + + /** + * WebSocket Query Reference Price Calculation + * + *

Describes how reference price is calculated for a given symbol. Weight: 2 + */ + public void referencePriceCalculationExampleSync() { + ReferencePriceCalculationRequest referencePriceCalculationRequest = + new ReferencePriceCalculationRequest(); + referencePriceCalculationRequest.symbol("BNBUSDT"); + CompletableFuture future = + getApi().referencePriceCalculation(referencePriceCalculationRequest); + ReferencePriceCalculationResponse response = future.join(); + System.out.println(response); + } +} diff --git a/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/ReferencePriceExample.java b/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/ReferencePriceExample.java new file mode 100644 index 000000000..36b40c370 --- /dev/null +++ b/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/market/ReferencePriceExample.java @@ -0,0 +1,76 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.api.market; + +import com.binance.connector.client.common.configuration.SignatureConfiguration; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.spot.websocket.api.SpotWebSocketApiUtil; +import com.binance.connector.client.spot.websocket.api.api.SpotWebSocketApi; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceRequest; +import com.binance.connector.client.spot.websocket.api.model.ReferencePriceResponse; +import java.util.concurrent.CompletableFuture; + +/** API examples for MarketApi */ +public class ReferencePriceExample { + private SpotWebSocketApi api; + + public SpotWebSocketApi getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + SpotWebSocketApiUtil.getClientConfiguration(); + // if you want the connection to be auto logged on: + // https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/authentication-requests + clientConfiguration.setAutoLogon(true); + SignatureConfiguration signatureConfiguration = new SignatureConfiguration(); + signatureConfiguration.setApiKey("apiKey"); + signatureConfiguration.setPrivateKey("/path/to/private.key"); + clientConfiguration.setSignatureConfiguration(signatureConfiguration); + api = new SpotWebSocketApi(clientConfiguration); + } + return api; + } + + /** + * WebSocket Query Reference Price + * + *

Weight: 2 + */ + public void referencePriceExampleAsync() { + ReferencePriceRequest referencePriceRequest = new ReferencePriceRequest(); + referencePriceRequest.symbol("BNBUSDT"); + CompletableFuture future = + getApi().referencePrice(referencePriceRequest); + future.handle( + (response, error) -> { + if (error != null) { + System.err.println(error); + } + System.out.println(response); + return response; + }); + } + + /** + * WebSocket Query Reference Price + * + *

Weight: 2 + */ + public void referencePriceExampleSync() { + ReferencePriceRequest referencePriceRequest = new ReferencePriceRequest(); + referencePriceRequest.symbol("BNBUSDT"); + CompletableFuture future = + getApi().referencePrice(referencePriceRequest); + ReferencePriceResponse response = future.join(); + System.out.println(response); + } +} diff --git a/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/trade/OrderCancelReplaceExample.java b/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/trade/OrderCancelReplaceExample.java index 6bcc4f2cb..3eb4a42dc 100644 --- a/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/trade/OrderCancelReplaceExample.java +++ b/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/api/trade/OrderCancelReplaceExample.java @@ -46,9 +46,11 @@ public SpotWebSocketApi getApi() { /** * WebSocket Cancel and replace order * - *

Cancel an existing order and immediately place a new order instead of the canceled one. A - * new order that was not attempted (i.e. when `newOrderResult: NOT_ATTEMPTED`), will - * still increase the unfilled order count by 1. Weight: 1 + *

* Cancel an existing order and immediately place a new order instead of the canceled one. + * * A new order that was not attempted (i.e. when `newOrderResult: NOT_ATTEMPTED`), + * will still increase the unfilled order count by 1. * You can only cancel an individual order + * from an orderList using this method, but the result is the same as canceling the entire + * orderList. Weight: 1 */ public void orderCancelReplaceExampleAsync() { OrderCancelReplaceRequest orderCancelReplaceRequest = new OrderCancelReplaceRequest(); @@ -71,9 +73,11 @@ public void orderCancelReplaceExampleAsync() { /** * WebSocket Cancel and replace order * - *

Cancel an existing order and immediately place a new order instead of the canceled one. A - * new order that was not attempted (i.e. when `newOrderResult: NOT_ATTEMPTED`), will - * still increase the unfilled order count by 1. Weight: 1 + *

* Cancel an existing order and immediately place a new order instead of the canceled one. + * * A new order that was not attempted (i.e. when `newOrderResult: NOT_ATTEMPTED`), + * will still increase the unfilled order count by 1. * You can only cancel an individual order + * from an orderList using this method, but the result is the same as canceling the entire + * orderList. Weight: 1 */ public void orderCancelReplaceExampleSync() { OrderCancelReplaceRequest orderCancelReplaceRequest = new OrderCancelReplaceRequest(); diff --git a/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/websocketstreams/ReferencePriceExample.java b/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/websocketstreams/ReferencePriceExample.java new file mode 100644 index 000000000..b6f9fbffc --- /dev/null +++ b/examples/spot/src/main/java/com/binance/connector/client/spot/websocket/stream/websocketstreams/ReferencePriceExample.java @@ -0,0 +1,50 @@ +/* + * Binance Spot REST API + * OpenAPI Specifications for the Binance Spot REST API API documents: - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md) - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.binance.connector.client.spot.websocket.stream.websocketstreams; + +import com.binance.connector.client.common.ApiException; +import com.binance.connector.client.common.websocket.configuration.WebSocketClientConfiguration; +import com.binance.connector.client.common.websocket.service.StreamBlockingQueueWrapper; +import com.binance.connector.client.spot.websocket.stream.SpotWebSocketStreamsUtil; +import com.binance.connector.client.spot.websocket.stream.api.SpotWebSocketStreams; +import com.binance.connector.client.spot.websocket.stream.model.ReferencePriceRequest; +import com.binance.connector.client.spot.websocket.stream.model.ReferencePriceResponse; + +/** API examples for WebSocketStreamsApi */ +public class ReferencePriceExample { + private SpotWebSocketStreams api; + + public SpotWebSocketStreams getApi() { + if (api == null) { + WebSocketClientConfiguration clientConfiguration = + SpotWebSocketStreamsUtil.getClientConfiguration(); + api = new SpotWebSocketStreams(clientConfiguration); + } + return api; + } + + /** + * WebSocket Reference Price Streams + * + * @throws ApiException if the Api call fails + */ + public void referencePriceExample() throws ApiException, InterruptedException { + ReferencePriceRequest referencePriceRequest = new ReferencePriceRequest(); + referencePriceRequest.symbol("bnbusdt"); + StreamBlockingQueueWrapper response = + getApi().referencePrice(referencePriceRequest); + while (true) { + System.out.println(response.take()); + } + } +}