From e8dcd3ec82eea20a681317e7bdfb518a7011a98a Mon Sep 17 00:00:00 2001 From: theo-s68 <194042188+theo-s68@users.noreply.github.com> Date: Tue, 22 Sep 2026 16:06:58 +0700 Subject: [PATCH] Release binance-derivatives-trading-usds-futures v12.1.0 - Added parameter `reduceOnly` - affected methods: - `modifyOrder()` (`PUT /fapi/v1/order`) - Modified parameter `incomeType`: - enum added: `SPECIAL_FUNDING_FEE` - affected methods: - `getIncomeHistory()` (`GET /fapi/v1/income`) - Modified response for `tradingSchedule()` (`GET /fapi/v1/tradingSchedule`): - `marketSchedules`: property `FX` added - Modified response field `marketSchedules`: - property `FX` added - affected events: - `tradingScheduleResponse` - Added parameter `reduceOnly` - affected methods: - `modifyOrder()` (`order.modify` method) --- clients/common/pom.xml | 2 +- .../stream/StreamConnectionWrapper.java | 2 +- .../CHANGELOG.md | 26 ++ .../docs/BatchOrdersInner.md | 2 +- .../docs/IncomeType.md | 2 + .../docs/MarketApi.md | 2 +- .../docs/ModifyOrderRequest.md | 1 + .../docs/TradeApi.md | 2 +- .../TradingScheduleResponseMarketSchedules.md | 1 + ...radingScheduleResponseMarketSchedulesFX.md | 13 + ...eResponseMarketSchedulesFXSessionsInner.md | 15 + .../docs/TradingSessionStreamResponse.md | 2 +- .../docs/rest-api/migration-guide.md | 4 +- .../example_rest.md | 4 +- .../example_websocket_api.md | 2 +- .../example_websocket_stream.md | 2 +- .../derivatives-trading-usds-futures/pom.xml | 4 +- .../rest/JSON.java | 7 + .../rest/api/AccountApi.java | 2 +- .../rest/api/ConvertApi.java | 2 +- .../DerivativesTradingUsdsFuturesRestApi.java | 18 +- .../rest/api/MarketDataApi.java | 9 +- .../rest/api/PortfolioMarginEndpointsApi.java | 2 +- .../rest/api/TradeApi.java | 17 +- .../rest/api/UserDataStreamsApi.java | 2 +- .../rest/model/BatchOrdersInner.java | 8 +- .../rest/model/IncomeType.java | 4 +- .../rest/model/ModifyOrderRequest.java | 38 +++ .../rest/model/SelfTradePreventionMode.java | 4 +- ...radingScheduleResponseMarketSchedules.java | 42 ++- ...dingScheduleResponseMarketSchedulesFX.java | 256 +++++++++++++++ ...esponseMarketSchedulesFXSessionsInner.java | 301 ++++++++++++++++++ ...vativesTradingUsdsFuturesWebSocketApi.java | 2 +- .../websocket/api/api/TradeApi.java | 11 +- .../api/model/ModifyOrderRequest.java | 43 +++ .../api/model/SelfTradePreventionMode.java | 4 +- ...vesTradingUsdsFuturesWebSocketStreams.java | 2 +- .../websocket/stream/api/MarketApi.java | 14 +- .../websocket/stream/api/PublicApi.java | 2 +- .../model/TradingSessionStreamResponse.java | 3 +- .../derivatives-trading-usds-futures/pom.xml | 2 +- .../marketdata/TradingScheduleExample.java | 7 +- .../rest/trade/ModifyOrderExample.java | 11 +- .../api/trade/ModifyOrderExample.java | 22 +- .../market/TradingSessionStreamExample.java | 10 +- 45 files changed, 870 insertions(+), 61 deletions(-) create mode 100644 clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedulesFX.md create mode 100644 clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedulesFXSessionsInner.md create mode 100644 clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedulesFX.java create mode 100644 clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedulesFXSessionsInner.java diff --git a/clients/common/pom.xml b/clients/common/pom.xml index cfd509203..fffb875af 100644 --- a/clients/common/pom.xml +++ b/clients/common/pom.xml @@ -10,6 +10,6 @@ binance-common common - 2.5.1 + 2.5.2 jar \ No newline at end of file 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 c5749ea8a..f1e005346 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 @@ -102,7 +102,7 @@ public void onWebSocketText(String message) { // Response to subscribe JsonElement id = obj.get("id"); - if (id != null) { + if (id != null && !id.isJsonNull()) { JsonElement result = obj.get("result"); RequestWrapperDTO requestWrapperDTO = pendingRequest.get(id.getAsString()); Type responseType = requestWrapperDTO.getResponseType(); diff --git a/clients/derivatives-trading-usds-futures/CHANGELOG.md b/clients/derivatives-trading-usds-futures/CHANGELOG.md index 668dfdfb9..780f9bed1 100644 --- a/clients/derivatives-trading-usds-futures/CHANGELOG.md +++ b/clients/derivatives-trading-usds-futures/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## 12.1.0 - 2026-09-21 + +### Changed (5) + +#### REST API + +- Added parameter `reduceOnly` + - affected methods: + - `modifyOrder()` (`PUT /fapi/v1/order`) +- Modified parameter `incomeType`: + - enum added: `SPECIAL_FUNDING_FEE` + - affected methods: + - `getIncomeHistory()` (`GET /fapi/v1/income`) +- Modified response for `tradingSchedule()` (`GET /fapi/v1/tradingSchedule`): + - `marketSchedules`: property `FX` added + +- Modified response field `marketSchedules`: + - property `FX` added + - affected events: + - `tradingScheduleResponse` +#### WebSocket API + +- Added parameter `reduceOnly` + - affected methods: + - `modifyOrder()` (`order.modify` method) + ## 12.0.3 - 2026-08-27 ### Changed (1) diff --git a/clients/derivatives-trading-usds-futures/docs/BatchOrdersInner.md b/clients/derivatives-trading-usds-futures/docs/BatchOrdersInner.md index 2ceb37d18..be177a6cf 100644 --- a/clients/derivatives-trading-usds-futures/docs/BatchOrdersInner.md +++ b/clients/derivatives-trading-usds-futures/docs/BatchOrdersInner.md @@ -18,7 +18,7 @@ |**newClientOrderId** | **String** | | [optional] | |**newOrderRespType** | [**NewOrderRespTypeEnum**](#NewOrderRespTypeEnum) | | [optional] | |**priceMatch** | [**PriceMatchEnum**](#PriceMatchEnum) | only avaliable for LIMIT/STOP/TAKE_PROFIT order; Can't be passed together with price | [optional] | -|**selfTradePreventionMode** | [**SelfTradePreventionModeEnum**](#SelfTradePreventionModeEnum) | EXPIRE_TAKER:expire taker order when STP triggers/ EXPIRE_MAKER:expire taker order when STP triggers/ EXPIRE_BOTH:expire both orders when STP triggers; default NONE | [optional] | +|**selfTradePreventionMode** | [**SelfTradePreventionModeEnum**](#SelfTradePreventionModeEnum) | EXPIRE_TAKER: expire taker order when STP triggers/ EXPIRE_MAKER: expire taker order when STP triggers/ EXPIRE_BOTH: expire both orders when STP triggers; default NONE | [optional] | |**goodTillDate** | **Long** | Auto-cancel time for `GTD` orders. | [optional] | diff --git a/clients/derivatives-trading-usds-futures/docs/IncomeType.md b/clients/derivatives-trading-usds-futures/docs/IncomeType.md index ec2fd7258..9289f8e07 100644 --- a/clients/derivatives-trading-usds-futures/docs/IncomeType.md +++ b/clients/derivatives-trading-usds-futures/docs/IncomeType.md @@ -49,5 +49,7 @@ * `BFUSD_REWARD` (value: `"BFUSD_REWARD"`) +* `SPECIAL_FUNDING_FEE` (value: `"SPECIAL_FUNDING_FEE"`) + diff --git a/clients/derivatives-trading-usds-futures/docs/MarketApi.md b/clients/derivatives-trading-usds-futures/docs/MarketApi.md index 7962f33c8..2c1061b5b 100644 --- a/clients/derivatives-trading-usds-futures/docs/MarketApi.md +++ b/clients/derivatives-trading-usds-futures/docs/MarketApi.md @@ -895,7 +895,7 @@ No authorization required Trading Session Stream -Trading session information for the underlying assets of TradFi Perpetual contracts, covering the U.S. equity market, Korean equity market, Hong Kong equity market, China equity market, and the commodity market, is updated every second. Trading session information for different underlying markets is pushed in separate messages. **Event type:** - `EquityUpdate`: Session types for the U.S. equity market include \"PRE_MARKET\", \"REGULAR\", \"AFTER_MARKET\", \"OVERNIGHT\", and \"NO_TRADING\". - `CommodityUpdate`: Session types for the commodity market include \"REGULAR\" and \"NO_TRADING\". - `KR_EquityUpdate`: Session types for the Korean equity market include \"REGULAR\" and \"NO_TRADING\". - `HK_EquityUpdate`: Session types for the Hong Kong equity market include \"REGULAR\" and \"NO_TRADING\". - `CN_EquityUpdate`: Session types for the China equity market include \"REGULAR\" and \"NO_TRADING\". Update Speed: 1s +Trading session information for the underlying assets of TradFi Perpetual contracts, covering the U.S. equity market, Korean equity market, Hong Kong equity market, China equity market, the commodity market, and the FX market, is updated every second. Trading session information for different underlying markets is pushed in separate messages. **Event type:** - `EquityUpdate`: Session types for the U.S. equity market include \"PRE_MARKET\", \"REGULAR\", \"AFTER_MARKET\", \"OVERNIGHT\", and \"NO_TRADING\". - `CommodityUpdate`: Session types for the commodity market include \"REGULAR\" and \"NO_TRADING\". - `KR_EquityUpdate`: Session types for the Korean equity market include \"REGULAR\" and \"NO_TRADING\". - `HK_EquityUpdate`: Session types for the Hong Kong equity market include \"REGULAR\" and \"NO_TRADING\". - `CN_EquityUpdate`: Session types for the China equity market include \"REGULAR\" and \"NO_TRADING\". - `FXUpdate`: Session types for the FX market include \"REGULAR\" and \"NO_TRADING\". Update Speed: 1s ### Example ```java diff --git a/clients/derivatives-trading-usds-futures/docs/ModifyOrderRequest.md b/clients/derivatives-trading-usds-futures/docs/ModifyOrderRequest.md index 245444ffc..ecc9fcbed 100644 --- a/clients/derivatives-trading-usds-futures/docs/ModifyOrderRequest.md +++ b/clients/derivatives-trading-usds-futures/docs/ModifyOrderRequest.md @@ -16,6 +16,7 @@ |**price** | **Double** | Price. | | |**priceMatch** | **PriceMatch** | | [optional] | |**modifyId** | **Long** | User-defined modification identifier, returned as-is in the response. Optional; not validated for uniqueness. | [optional] | +|**reduceOnly** | **ReduceOnly** | | [optional] | |**recvWindow** | **Long** | Recv Window. | [optional] | diff --git a/clients/derivatives-trading-usds-futures/docs/TradeApi.md b/clients/derivatives-trading-usds-futures/docs/TradeApi.md index 875cffea9..2c34bb558 100644 --- a/clients/derivatives-trading-usds-futures/docs/TradeApi.md +++ b/clients/derivatives-trading-usds-futures/docs/TradeApi.md @@ -144,7 +144,7 @@ No authorization required Modify Order (TRADE) -Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue Weight: 1 on 10s order rate limit(X-MBX-ORDER-COUNT-10S); 1 on 1min order rate limit(X-MBX-ORDER-COUNT-1M); 0 on IP rate limit(x-mbx-used-weight-1m) Security Type: TRADE Notes: - Either `orderId` or `origClientOrderId` must be sent, and the `orderId` will prevail if both are sent. - Both `quantity` and `price` must be sent. *(After CM migration, the dapi modify order endpoint follows the same rule.)* - When the new `quantity` or `price` doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is. - However the order will be cancelled by the amendment in the following situations: - when the order is in partially filled status and the new `quantity` <= `executedQty` - When the order is `GTX` and the new price will cause it to be executed immediately - One order can only be modfied for less than 10000 times +Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue Weight: 1 on 10s order rate limit(X-MBX-ORDER-COUNT-10S); 1 on 1min order rate limit(X-MBX-ORDER-COUNT-1M); 0 on IP rate limit(x-mbx-used-weight-1m) Security Type: TRADE Notes: - Either `orderId` or `origClientOrderId` must be sent, and the `orderId` will prevail if both are sent. - Both `quantity` and `price` must be sent. *(After CM migration, the dapi modify order endpoint follows the same rule.)* - When the new `quantity` or `price` doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is. - However the order will be cancelled by the amendment in the following situations: - when the order is in partially filled status and the new `quantity` <= `executedQty` - When the order is `GTX` and the new price will cause it to be executed immediately - One order can only be modfied for less than 10000 times - `reduceOnly` behavior: - `false` or omitted: behave as today — `min_notional` is enforced on the modified order. - `true` and the original order's `reduceOnly` attribute is also `true` (consistent): the `min_notional` check is skipped on the modified order, matching placement semantics. - `true` but the original order's `reduceOnly` attribute is `false` (inconsistent): the modify request is rejected with error code `-5047`, \"The original order is not a reduce-only order\". - `reduceOnly` is used purely for validation — passing `true` does not change the original order's `reduceOnly` attribute; that flag remains whatever it was set to at placement time. ### Example ```java diff --git a/clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedules.md b/clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedules.md index a83c8c4db..6366ce937 100644 --- a/clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedules.md +++ b/clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedules.md @@ -12,6 +12,7 @@ |**KR_EQUITY** | [**TradingScheduleResponseMarketSchedulesKREQUITY**](TradingScheduleResponseMarketSchedulesKREQUITY.md) | | [optional] | |**HK_EQUITY** | [**TradingScheduleResponseMarketSchedulesHKEQUITY**](TradingScheduleResponseMarketSchedulesHKEQUITY.md) | | [optional] | |**CN_EQUITY** | [**TradingScheduleResponseMarketSchedulesHKEQUITY**](TradingScheduleResponseMarketSchedulesHKEQUITY.md) | | [optional] | +|**FX** | [**TradingScheduleResponseMarketSchedulesFX**](TradingScheduleResponseMarketSchedulesFX.md) | | [optional] | diff --git a/clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedulesFX.md b/clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedulesFX.md new file mode 100644 index 000000000..607960caf --- /dev/null +++ b/clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedulesFX.md @@ -0,0 +1,13 @@ + + +# TradingScheduleResponseMarketSchedulesFX + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sessions** | [**List<TradingScheduleResponseMarketSchedulesFXSessionsInner>**](TradingScheduleResponseMarketSchedulesFXSessionsInner.md) | | [optional] | + + + diff --git a/clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedulesFXSessionsInner.md b/clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedulesFXSessionsInner.md new file mode 100644 index 000000000..efed6c9b7 --- /dev/null +++ b/clients/derivatives-trading-usds-futures/docs/TradingScheduleResponseMarketSchedulesFXSessionsInner.md @@ -0,0 +1,15 @@ + + +# TradingScheduleResponseMarketSchedulesFXSessionsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**startTime** | **Long** | | [optional] | +|**endTime** | **Long** | | [optional] | +|**type** | **String** | | [optional] | + + + diff --git a/clients/derivatives-trading-usds-futures/docs/TradingSessionStreamResponse.md b/clients/derivatives-trading-usds-futures/docs/TradingSessionStreamResponse.md index 9827c4e0c..35bd59c5e 100644 --- a/clients/derivatives-trading-usds-futures/docs/TradingSessionStreamResponse.md +++ b/clients/derivatives-trading-usds-futures/docs/TradingSessionStreamResponse.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**eLowerCase** | **String** | Event type, can also be CommodityUpdate, KR_EquityUpdate, HK_EquityUpdate or CN_EquityUpdate | [optional] | +|**eLowerCase** | **String** | Event type, can also be CommodityUpdate, KR_EquityUpdate, HK_EquityUpdate, CN_EquityUpdate or FXUpdate | [optional] | |**E** | **Long** | Event time | [optional] | |**tLowerCase** | **Long** | Session start time | [optional] | |**T** | **Long** | Session end time | [optional] | 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 537728c94..6b1afe3a1 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 - 12.0.3 + 12.1.0 ``` @@ -91,7 +91,7 @@ by: io.github.binance binance-derivatives-trading-usds-futures - 12.0.3 + 12.1.0 ``` diff --git a/clients/derivatives-trading-usds-futures/example_rest.md b/clients/derivatives-trading-usds-futures/example_rest.md index 48253dab5..1f3487142 100644 --- a/clients/derivatives-trading-usds-futures/example_rest.md +++ b/clients/derivatives-trading-usds-futures/example_rest.md @@ -120,7 +120,7 @@ [GET /futures/data/topLongShortPositionRatio](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/rest-api/market-data#top-trader-long-short-ratio-positions) - topTraderLongShortRatioPositions - [TopTraderLongShortRatioPositionsExample.java:43](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/marketdata/TopTraderLongShortRatioPositionsExample.java#L43) -[GET /fapi/v1/tradingSchedule](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/rest-api/market-data#trading-schedule) - tradingSchedule - [TradingScheduleExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/marketdata/TradingScheduleExample.java#L45) +[GET /fapi/v1/tradingSchedule](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/rest-api/market-data#trading-schedule) - tradingSchedule - [TradingScheduleExample.java:46](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/marketdata/TradingScheduleExample.java#L46) ## PortfolioMarginEndpoints @@ -166,7 +166,7 @@ [PUT /fapi/v1/batchOrders](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/rest-api/trade#modify-multiple-orders) - modifyMultipleOrders - [ModifyMultipleOrdersExample.java:43](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/trade/ModifyMultipleOrdersExample.java#L43) -[PUT /fapi/v1/order](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/rest-api/trade#modify-order) - modifyOrder - [ModifyOrderExample.java:50](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/trade/ModifyOrderExample.java#L50) +[PUT /fapi/v1/order](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/rest-api/trade#modify-order) - modifyOrder - [ModifyOrderExample.java:59](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/trade/ModifyOrderExample.java#L59) [POST /fapi/v1/algoOrder](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/rest-api/trade#new-algo-order) - newAlgoOrder - [NewAlgoOrderExample.java:75](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/trade/NewAlgoOrderExample.java#L75) diff --git a/clients/derivatives-trading-usds-futures/example_websocket_api.md b/clients/derivatives-trading-usds-futures/example_websocket_api.md index 14d0e0926..46eed9c4d 100644 --- a/clients/derivatives-trading-usds-futures/example_websocket_api.md +++ b/clients/derivatives-trading-usds-futures/example_websocket_api.md @@ -22,7 +22,7 @@ [order.cancel](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/ws-api/trade#cancel-order) - cancelOrder - [CancelOrderExample.java:37](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/trade/CancelOrderExample.java#L37) -[order.modify](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/ws-api/trade#modify-order) - modifyOrder - [ModifyOrderExample.java:49](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/trade/ModifyOrderExample.java#L49) +[order.modify](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/ws-api/trade#modify-order) - modifyOrder - [ModifyOrderExample.java:58](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/trade/ModifyOrderExample.java#L58) [algoOrder.place](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/ws-api/trade#new-algo-order) - newAlgoOrder - [NewAlgoOrderExample.java:69](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/trade/NewAlgoOrderExample.java#L69) diff --git a/clients/derivatives-trading-usds-futures/example_websocket_stream.md b/clients/derivatives-trading-usds-futures/example_websocket_stream.md index 5362a10c9..7e940ff8e 100644 --- a/clients/derivatives-trading-usds-futures/example_websocket_stream.md +++ b/clients/derivatives-trading-usds-futures/example_websocket_stream.md @@ -28,7 +28,7 @@ [!markPrice@arr@](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/ws-streams/market#mark-price-stream-for-all-market) - markPriceStreamForAllMarket - [MarkPriceStreamForAllMarketExample.java:35](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/MarkPriceStreamForAllMarketExample.java#L35) -[tradingSession](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/ws-streams/market#trading-session-stream) - tradingSessionStream - [TradingSessionStreamExample.java:43](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/TradingSessionStreamExample.java#L43) +[tradingSession](https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/ws-streams/market#trading-session-stream) - tradingSessionStream - [TradingSessionStreamExample.java:45](/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/market/TradingSessionStreamExample.java#L45) ## Public diff --git a/clients/derivatives-trading-usds-futures/pom.xml b/clients/derivatives-trading-usds-futures/pom.xml index 704c77829..70ee60f4b 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 - 12.0.3 + 12.1.0 jar @@ -31,7 +31,7 @@ io.github.binance binance-common - 2.5.1 + 2.5.2 \ 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 92227abe6..ee0f5e23b 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 @@ -742,6 +742,13 @@ private static Class getClassByDiscriminator( new com.binance.connector.client.derivatives_trading_usds_futures.rest.model .TradingScheduleResponseMarketSchedulesEQUITYSessionsInner .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.derivatives_trading_usds_futures.rest.model + .TradingScheduleResponseMarketSchedulesFX.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.binance.connector.client.derivatives_trading_usds_futures.rest.model + .TradingScheduleResponseMarketSchedulesFXSessionsInner + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.binance.connector.client.derivatives_trading_usds_futures.rest.model .TradingScheduleResponseMarketSchedulesHKEQUITY.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 d180db94b..49de44901 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 @@ -65,7 +65,7 @@ public class AccountApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/12.0.3 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/12.1.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 b24e4853c..b531794f6 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/12.0.3 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/12.1.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/DerivativesTradingUsdsFuturesRestApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/DerivativesTradingUsdsFuturesRestApi.java index 8d7cf20f0..b015e722b 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/DerivativesTradingUsdsFuturesRestApi.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/api/DerivativesTradingUsdsFuturesRestApi.java @@ -1726,13 +1726,14 @@ public ApiResponse topTraderLongShortR * Trading Schedule Trading session schedules for the underlying assets of TradFi Perps are * provided for a one-week period forward and one-week period backward starting from the day * prior to the query time, covering the U.S. equity market, Korean equity market, Hong Kong - * equity market, China equity market, and the commodity market. Session types per market: - - * U.S. equity market: \"PRE_MARKET\", \"REGULAR\", + * equity market, China equity market, the commodity market, and the FX market. Session types + * per market: - U.S. equity market: \"PRE_MARKET\", \"REGULAR\", * \"AFTER_MARKET\", \"OVERNIGHT\", \"NO_TRADING\". - Commodity * market: \"REGULAR\", \"NO_TRADING\". - Korean equity market: * \"REGULAR\", \"NO_TRADING\". - Hong Kong equity market: * \"REGULAR\", \"NO_TRADING\". - China equity market: - * \"REGULAR\", \"NO_TRADING\". Weight(IP): 5 + * \"REGULAR\", \"NO_TRADING\". - FX market: \"REGULAR\", + * \"NO_TRADING\". Weight(IP): 5 * * @return ApiResponse<TradingScheduleResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the @@ -2347,7 +2348,16 @@ public ApiResponse modifyMultipleOrders( * following situations: - when the order is in partially filled status and the new * `quantity` <= `executedQty` - When the order is `GTX` * and the new price will cause it to be executed immediately - One order can only be modfied - * for less than 10000 times + * for less than 10000 times - `reduceOnly` behavior: - `false` or omitted: + * behave as today — `min_notional` is enforced on the modified order. - + * `true` and the original order's `reduceOnly` attribute is also + * `true` (consistent): the `min_notional` check is skipped on the modified + * order, matching placement semantics. - `true` but the original order's + * `reduceOnly` attribute is `false` (inconsistent): the modify request is + * rejected with error code `-5047`, \"The original order is not a reduce-only + * order\". - `reduceOnly` is used purely for validation — passing + * `true` does not change the original order's `reduceOnly` attribute; + * that flag remains whatever it was set to at placement time. * * @param modifyOrderRequest (required) * @return ApiResponse<ModifyOrderResponse> 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 e858bed88..549e8074c 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/12.0.3 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/12.1.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; @@ -5230,13 +5230,14 @@ private okhttp3.Call tradingScheduleValidateBeforeCall() throws ApiException { * Trading Schedule Trading session schedules for the underlying assets of TradFi Perps are * provided for a one-week period forward and one-week period backward starting from the day * prior to the query time, covering the U.S. equity market, Korean equity market, Hong Kong - * equity market, China equity market, and the commodity market. Session types per market: - - * U.S. equity market: \"PRE_MARKET\", \"REGULAR\", + * equity market, China equity market, the commodity market, and the FX market. Session types + * per market: - U.S. equity market: \"PRE_MARKET\", \"REGULAR\", * \"AFTER_MARKET\", \"OVERNIGHT\", \"NO_TRADING\". - Commodity * market: \"REGULAR\", \"NO_TRADING\". - Korean equity market: * \"REGULAR\", \"NO_TRADING\". - Hong Kong equity market: * \"REGULAR\", \"NO_TRADING\". - China equity market: - * \"REGULAR\", \"NO_TRADING\". Weight(IP): 5 + * \"REGULAR\", \"NO_TRADING\". - FX market: \"REGULAR\", + * \"NO_TRADING\". Weight(IP): 5 * * @return ApiResponse<TradingScheduleResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the 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 c5698dcbd..f334e2c28 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/12.0.3 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/12.1.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 ef5abee67..a2bb69c95 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/12.0.3 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/12.1.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private static final boolean HAS_TIME_UNIT = false; @@ -3288,6 +3288,10 @@ private okhttp3.Call modifyOrderCall(ModifyOrderRequest modifyOrderRequest) localVarFormParams.put("modifyId", modifyOrderRequest.getModifyId()); } + if (modifyOrderRequest.getReduceOnly() != null) { + localVarFormParams.put("reduceOnly", modifyOrderRequest.getReduceOnly()); + } + if (modifyOrderRequest.getRecvWindow() != null) { localVarFormParams.put("recvWindow", modifyOrderRequest.getRecvWindow()); } @@ -3366,7 +3370,16 @@ private okhttp3.Call modifyOrderValidateBeforeCall(ModifyOrderRequest modifyOrde * following situations: - when the order is in partially filled status and the new * `quantity` <= `executedQty` - When the order is `GTX` * and the new price will cause it to be executed immediately - One order can only be modfied - * for less than 10000 times + * for less than 10000 times - `reduceOnly` behavior: - `false` or omitted: + * behave as today — `min_notional` is enforced on the modified order. - + * `true` and the original order's `reduceOnly` attribute is also + * `true` (consistent): the `min_notional` check is skipped on the modified + * order, matching placement semantics. - `true` but the original order's + * `reduceOnly` attribute is `false` (inconsistent): the modify request is + * rejected with error code `-5047`, \"The original order is not a reduce-only + * order\". - `reduceOnly` is used purely for validation — passing + * `true` does not change the original order's `reduceOnly` attribute; + * that flag remains whatever it was set to at placement time. * * @param modifyOrderRequest (required) * @return ApiResponse<ModifyOrderResponse> 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 67786bbcf..9fc82e70f 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/12.0.3 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/12.1.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/BatchOrdersInner.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/BatchOrdersInner.java index 6c4c8c444..5cba6a076 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/BatchOrdersInner.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/BatchOrdersInner.java @@ -497,8 +497,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti private PriceMatchEnum priceMatch; /** - * EXPIRE_TAKER:expire taker order when STP triggers/ EXPIRE_MAKER:expire taker order when STP - * triggers/ EXPIRE_BOTH:expire both orders when STP triggers; default NONE + * EXPIRE_TAKER: expire taker order when STP triggers/ EXPIRE_MAKER: expire taker order when STP + * triggers/ EXPIRE_BOTH: expire both orders when STP triggers; default NONE */ @JsonAdapter(SelfTradePreventionModeEnum.Adapter.class) public enum SelfTradePreventionModeEnum { @@ -793,8 +793,8 @@ public BatchOrdersInner selfTradePreventionMode( } /** - * EXPIRE_TAKER:expire taker order when STP triggers/ EXPIRE_MAKER:expire taker order when STP - * triggers/ EXPIRE_BOTH:expire both orders when STP triggers; default NONE + * EXPIRE_TAKER: expire taker order when STP triggers/ EXPIRE_MAKER: expire taker order when STP + * triggers/ EXPIRE_BOTH: expire both orders when STP triggers; default NONE * * @return selfTradePreventionMode */ diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/IncomeType.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/IncomeType.java index ee8dc998e..e70211b71 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/IncomeType.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/IncomeType.java @@ -66,7 +66,9 @@ public enum IncomeType { FEE_RETURN("FEE_RETURN"), - BFUSD_REWARD("BFUSD_REWARD"); + BFUSD_REWARD("BFUSD_REWARD"), + + SPECIAL_FUNDING_FEE("SPECIAL_FUNDING_FEE"); private String value; diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/ModifyOrderRequest.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/ModifyOrderRequest.java index 21979ff65..340cbe74d 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/ModifyOrderRequest.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/ModifyOrderRequest.java @@ -85,6 +85,12 @@ public class ModifyOrderRequest { @jakarta.annotation.Nullable private Long modifyId; + public static final String SERIALIZED_NAME_REDUCE_ONLY = "reduceOnly"; + + @SerializedName(SERIALIZED_NAME_REDUCE_ONLY) + @jakarta.annotation.Nullable + private ReduceOnly reduceOnly; + public static final String SERIALIZED_NAME_RECV_WINDOW = "recvWindow"; @SerializedName(SERIALIZED_NAME_RECV_WINDOW) @@ -255,6 +261,26 @@ public void setModifyId(@jakarta.annotation.Nullable Long modifyId) { this.modifyId = modifyId; } + public ModifyOrderRequest reduceOnly(@jakarta.annotation.Nullable ReduceOnly reduceOnly) { + this.reduceOnly = reduceOnly; + return this; + } + + /** + * Get reduceOnly + * + * @return reduceOnly + */ + @jakarta.annotation.Nullable + @Valid + public ReduceOnly getReduceOnly() { + return reduceOnly; + } + + public void setReduceOnly(@jakarta.annotation.Nullable ReduceOnly reduceOnly) { + this.reduceOnly = reduceOnly; + } + public ModifyOrderRequest recvWindow(@jakarta.annotation.Nullable Long recvWindow) { this.recvWindow = recvWindow; return this; @@ -292,6 +318,7 @@ public boolean equals(Object o) { && Objects.equals(this.price, modifyOrderRequest.price) && Objects.equals(this.priceMatch, modifyOrderRequest.priceMatch) && Objects.equals(this.modifyId, modifyOrderRequest.modifyId) + && Objects.equals(this.reduceOnly, modifyOrderRequest.reduceOnly) && Objects.equals(this.recvWindow, modifyOrderRequest.recvWindow); } @@ -306,6 +333,7 @@ public int hashCode() { price, priceMatch, modifyId, + reduceOnly, recvWindow); } @@ -321,6 +349,7 @@ public String toString() { sb.append(" price: ").append(toIndentedString(price)).append("\n"); sb.append(" priceMatch: ").append(toIndentedString(priceMatch)).append("\n"); sb.append(" modifyId: ").append(toIndentedString(modifyId)).append("\n"); + sb.append(" reduceOnly: ").append(toIndentedString(reduceOnly)).append("\n"); sb.append(" recvWindow: ").append(toIndentedString(recvWindow)).append("\n"); sb.append("}"); return sb.toString(); @@ -363,6 +392,10 @@ public String toUrlQueryString() { String modifyIdValueAsString = ""; modifyIdValueAsString = modifyIdValue.toString(); sb.append("modifyId=").append(urlEncode(modifyIdValueAsString)).append(""); + Object reduceOnlyValue = getReduceOnly(); + String reduceOnlyValueAsString = ""; + reduceOnlyValueAsString = reduceOnlyValue.toString(); + sb.append("reduceOnly=").append(urlEncode(reduceOnlyValueAsString)).append(""); Object recvWindowValue = getRecvWindow(); String recvWindowValueAsString = ""; recvWindowValueAsString = recvWindowValue.toString(); @@ -403,6 +436,7 @@ private String toIndentedString(Object o) { openapiFields.add("price"); openapiFields.add("priceMatch"); openapiFields.add("modifyId"); + openapiFields.add("reduceOnly"); openapiFields.add("recvWindow"); // a set of required properties/fields (JSON key names) @@ -463,6 +497,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (jsonObj.get("priceMatch") != null && !jsonObj.get("priceMatch").isJsonNull()) { PriceMatch.validateJsonElement(jsonObj.get("priceMatch")); } + // validate the optional field `reduceOnly` + if (jsonObj.get("reduceOnly") != null && !jsonObj.get("reduceOnly").isJsonNull()) { + ReduceOnly.validateJsonElement(jsonObj.get("reduceOnly")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/SelfTradePreventionMode.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/SelfTradePreventionMode.java index f7116c2cb..b781f653e 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/SelfTradePreventionMode.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/SelfTradePreventionMode.java @@ -22,8 +22,8 @@ import org.hibernate.validator.constraints.*; /** - * `EXPIRE_TAKER`:expire taker order when STP triggers / `EXPIRE_MAKER`:expire - * taker order when STP triggers/ `EXPIRE_BOTH`:expire both orders when STP triggers; + * `EXPIRE_TAKER`: expire taker order when STP triggers / `EXPIRE_MAKER`: expire + * taker order when STP triggers/ `EXPIRE_BOTH`: expire both orders when STP triggers; * default `NONE` */ @JsonAdapter(SelfTradePreventionMode.Adapter.class) diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedules.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedules.java index 10ef1f70e..ca85db233 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedules.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedules.java @@ -67,6 +67,12 @@ public class TradingScheduleResponseMarketSchedules { @jakarta.annotation.Nullable private TradingScheduleResponseMarketSchedulesHKEQUITY CN_EQUITY; + public static final String SERIALIZED_NAME_F_X = "FX"; + + @SerializedName(SERIALIZED_NAME_F_X) + @jakarta.annotation.Nullable + private TradingScheduleResponseMarketSchedulesFX FX; + public TradingScheduleResponseMarketSchedules() {} public TradingScheduleResponseMarketSchedules EQUITY( @@ -181,6 +187,27 @@ public void setCNEQUITY( this.CN_EQUITY = CN_EQUITY; } + public TradingScheduleResponseMarketSchedules FX( + @jakarta.annotation.Nullable TradingScheduleResponseMarketSchedulesFX FX) { + this.FX = FX; + return this; + } + + /** + * Get FX + * + * @return FX + */ + @jakarta.annotation.Nullable + @Valid + public TradingScheduleResponseMarketSchedulesFX getFX() { + return FX; + } + + public void setFX(@jakarta.annotation.Nullable TradingScheduleResponseMarketSchedulesFX FX) { + this.FX = FX; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -195,12 +222,13 @@ public boolean equals(Object o) { && Objects.equals(this.COMMODITY, tradingScheduleResponseMarketSchedules.COMMODITY) && Objects.equals(this.KR_EQUITY, tradingScheduleResponseMarketSchedules.KR_EQUITY) && Objects.equals(this.HK_EQUITY, tradingScheduleResponseMarketSchedules.HK_EQUITY) - && Objects.equals(this.CN_EQUITY, tradingScheduleResponseMarketSchedules.CN_EQUITY); + && Objects.equals(this.CN_EQUITY, tradingScheduleResponseMarketSchedules.CN_EQUITY) + && Objects.equals(this.FX, tradingScheduleResponseMarketSchedules.FX); } @Override public int hashCode() { - return Objects.hash(EQUITY, COMMODITY, KR_EQUITY, HK_EQUITY, CN_EQUITY); + return Objects.hash(EQUITY, COMMODITY, KR_EQUITY, HK_EQUITY, CN_EQUITY, FX); } @Override @@ -212,6 +240,7 @@ public String toString() { sb.append(" KR_EQUITY: ").append(toIndentedString(KR_EQUITY)).append("\n"); sb.append(" HK_EQUITY: ").append(toIndentedString(HK_EQUITY)).append("\n"); sb.append(" CN_EQUITY: ").append(toIndentedString(CN_EQUITY)).append("\n"); + sb.append(" FX: ").append(toIndentedString(FX)).append("\n"); sb.append("}"); return sb.toString(); } @@ -239,6 +268,10 @@ public String toUrlQueryString() { String CN_EQUITYValueAsString = ""; CN_EQUITYValueAsString = CN_EQUITYValue.toString(); sb.append("CN_EQUITY=").append(urlEncode(CN_EQUITYValueAsString)).append(""); + Object FXValue = getFX(); + String FXValueAsString = ""; + FXValueAsString = FXValue.toString(); + sb.append("FX=").append(urlEncode(FXValueAsString)).append(""); return sb.toString(); } @@ -272,6 +305,7 @@ private String toIndentedString(Object o) { openapiFields.add("KR_EQUITY"); openapiFields.add("HK_EQUITY"); openapiFields.add("CN_EQUITY"); + openapiFields.add("FX"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -321,6 +355,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti TradingScheduleResponseMarketSchedulesHKEQUITY.validateJsonElement( jsonObj.get("CN_EQUITY")); } + // validate the optional field `FX` + if (jsonObj.get("FX") != null && !jsonObj.get("FX").isJsonNull()) { + TradingScheduleResponseMarketSchedulesFX.validateJsonElement(jsonObj.get("FX")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedulesFX.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedulesFX.java new file mode 100644 index 000000000..7b6c77b29 --- /dev/null +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedulesFX.java @@ -0,0 +1,256 @@ +/* + * Futures (USDⓈ-M) REST API + * Access market data, manage accounts, and trade USDⓈ-M perpetual futures. + * + * 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.rest.model; + +import com.binance.connector.client.derivatives_trading_usds_futures.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.*; + +/** TradingScheduleResponseMarketSchedulesFX */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class TradingScheduleResponseMarketSchedulesFX { + public static final String SERIALIZED_NAME_SESSIONS = "sessions"; + + @SerializedName(SERIALIZED_NAME_SESSIONS) + @jakarta.annotation.Nullable + private List<@Valid TradingScheduleResponseMarketSchedulesFXSessionsInner> sessions; + + public TradingScheduleResponseMarketSchedulesFX() {} + + public TradingScheduleResponseMarketSchedulesFX sessions( + @jakarta.annotation.Nullable + List<@Valid TradingScheduleResponseMarketSchedulesFXSessionsInner> sessions) { + this.sessions = sessions; + return this; + } + + public TradingScheduleResponseMarketSchedulesFX addSessionsItem( + TradingScheduleResponseMarketSchedulesFXSessionsInner sessionsItem) { + if (this.sessions == null) { + this.sessions = new ArrayList<>(); + } + this.sessions.add(sessionsItem); + return this; + } + + /** + * Get sessions + * + * @return sessions + */ + @jakarta.annotation.Nullable + @Valid + public List<@Valid TradingScheduleResponseMarketSchedulesFXSessionsInner> getSessions() { + return sessions; + } + + public void setSessions( + @jakarta.annotation.Nullable + List<@Valid TradingScheduleResponseMarketSchedulesFXSessionsInner> sessions) { + this.sessions = sessions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TradingScheduleResponseMarketSchedulesFX tradingScheduleResponseMarketSchedulesFX = + (TradingScheduleResponseMarketSchedulesFX) o; + return Objects.equals(this.sessions, tradingScheduleResponseMarketSchedulesFX.sessions); + } + + @Override + public int hashCode() { + return Objects.hash(sessions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TradingScheduleResponseMarketSchedulesFX {\n"); + sb.append(" sessions: ").append(toIndentedString(sessions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object sessionsValue = getSessions(); + String sessionsValueAsString = ""; + sessionsValueAsString = + (String) + ((Collection) sessionsValue) + .stream().map(Object::toString).collect(Collectors.joining(",")); + sb.append("sessions=").append(urlEncode(sessionsValueAsString)).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("sessions"); + + // 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 + * TradingScheduleResponseMarketSchedulesFX + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TradingScheduleResponseMarketSchedulesFX.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " TradingScheduleResponseMarketSchedulesFX is not found in" + + " the empty JSON string", + TradingScheduleResponseMarketSchedulesFX.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("sessions") != null && !jsonObj.get("sessions").isJsonNull()) { + JsonArray jsonArraysessions = jsonObj.getAsJsonArray("sessions"); + if (jsonArraysessions != null) { + // ensure the json data is an array + if (!jsonObj.get("sessions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sessions` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("sessions").toString())); + } + + // validate the optional field `sessions` (array) + for (int i = 0; i < jsonArraysessions.size(); i++) { + TradingScheduleResponseMarketSchedulesFXSessionsInner.validateJsonElement( + jsonArraysessions.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TradingScheduleResponseMarketSchedulesFX.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'TradingScheduleResponseMarketSchedulesFX' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(TradingScheduleResponseMarketSchedulesFX.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, TradingScheduleResponseMarketSchedulesFX value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TradingScheduleResponseMarketSchedulesFX read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TradingScheduleResponseMarketSchedulesFX given an JSON string + * + * @param jsonString JSON string + * @return An instance of TradingScheduleResponseMarketSchedulesFX + * @throws IOException if the JSON string is invalid with respect to + * TradingScheduleResponseMarketSchedulesFX + */ + public static TradingScheduleResponseMarketSchedulesFX fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, TradingScheduleResponseMarketSchedulesFX.class); + } + + /** + * Convert an instance of TradingScheduleResponseMarketSchedulesFX to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedulesFXSessionsInner.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedulesFXSessionsInner.java new file mode 100644 index 000000000..3d3a05cea --- /dev/null +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/model/TradingScheduleResponseMarketSchedulesFXSessionsInner.java @@ -0,0 +1,301 @@ +/* + * Futures (USDⓈ-M) REST API + * Access market data, manage accounts, and trade USDⓈ-M perpetual futures. + * + * 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.rest.model; + +import com.binance.connector.client.derivatives_trading_usds_futures.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.*; + +/** TradingScheduleResponseMarketSchedulesFXSessionsInner */ +@jakarta.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.22.0") +public class TradingScheduleResponseMarketSchedulesFXSessionsInner { + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + + @SerializedName(SERIALIZED_NAME_START_TIME) + @jakarta.annotation.Nullable + private Long startTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + + @SerializedName(SERIALIZED_NAME_END_TIME) + @jakarta.annotation.Nullable + private Long endTime; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public TradingScheduleResponseMarketSchedulesFXSessionsInner() {} + + public TradingScheduleResponseMarketSchedulesFXSessionsInner startTime( + @jakarta.annotation.Nullable Long startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get startTime + * + * @return startTime + */ + @jakarta.annotation.Nullable + public Long getStartTime() { + return startTime; + } + + public void setStartTime(@jakarta.annotation.Nullable Long startTime) { + this.startTime = startTime; + } + + public TradingScheduleResponseMarketSchedulesFXSessionsInner endTime( + @jakarta.annotation.Nullable Long endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get endTime + * + * @return endTime + */ + @jakarta.annotation.Nullable + public Long getEndTime() { + return endTime; + } + + public void setEndTime(@jakarta.annotation.Nullable Long endTime) { + this.endTime = endTime; + } + + public TradingScheduleResponseMarketSchedulesFXSessionsInner 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; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TradingScheduleResponseMarketSchedulesFXSessionsInner + tradingScheduleResponseMarketSchedulesFXSessionsInner = + (TradingScheduleResponseMarketSchedulesFXSessionsInner) o; + return Objects.equals( + this.startTime, + tradingScheduleResponseMarketSchedulesFXSessionsInner.startTime) + && Objects.equals( + this.endTime, tradingScheduleResponseMarketSchedulesFXSessionsInner.endTime) + && Objects.equals( + this.type, tradingScheduleResponseMarketSchedulesFXSessionsInner.type); + } + + @Override + public int hashCode() { + return Objects.hash(startTime, endTime, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TradingScheduleResponseMarketSchedulesFXSessionsInner {\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public String toUrlQueryString() { + StringBuilder sb = new StringBuilder(); + + Object startTimeValue = getStartTime(); + String startTimeValueAsString = ""; + startTimeValueAsString = startTimeValue.toString(); + sb.append("startTime=").append(urlEncode(startTimeValueAsString)).append(""); + Object endTimeValue = getEndTime(); + String endTimeValueAsString = ""; + endTimeValueAsString = endTimeValue.toString(); + sb.append("endTime=").append(urlEncode(endTimeValueAsString)).append(""); + Object typeValue = getType(); + String typeValueAsString = ""; + typeValueAsString = typeValue.toString(); + sb.append("type=").append(urlEncode(typeValueAsString)).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("startTime"); + openapiFields.add("endTime"); + openapiFields.add("type"); + + // 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 + * TradingScheduleResponseMarketSchedulesFXSessionsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TradingScheduleResponseMarketSchedulesFXSessionsInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " TradingScheduleResponseMarketSchedulesFXSessionsInner is" + + " not found in the empty JSON string", + TradingScheduleResponseMarketSchedulesFXSessionsInner + .openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TradingScheduleResponseMarketSchedulesFXSessionsInner.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'TradingScheduleResponseMarketSchedulesFXSessionsInner' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + TradingScheduleResponseMarketSchedulesFXSessionsInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + TradingScheduleResponseMarketSchedulesFXSessionsInner value) + throws IOException { + JsonElement obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TradingScheduleResponseMarketSchedulesFXSessionsInner read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + // validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TradingScheduleResponseMarketSchedulesFXSessionsInner given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of TradingScheduleResponseMarketSchedulesFXSessionsInner + * @throws IOException if the JSON string is invalid with respect to + * TradingScheduleResponseMarketSchedulesFXSessionsInner + */ + public static TradingScheduleResponseMarketSchedulesFXSessionsInner fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, TradingScheduleResponseMarketSchedulesFXSessionsInner.class); + } + + /** + * Convert an instance of TradingScheduleResponseMarketSchedulesFXSessionsInner to an JSON + * string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} 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 e07f90df5..06edbdcfe 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/12.0.3 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/12.1.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private final ConnectionInterface connection; diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/api/TradeApi.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/api/TradeApi.java index 33431bc4c..e529df4ca 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/api/TradeApi.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/api/TradeApi.java @@ -191,7 +191,16 @@ private void cancelOrderValidateBeforeCall(CancelOrderRequest cancelOrderRequest * will be cancelled by the amendment in the following situations: - when the order is in * partially filled status and the new `quantity` <= `executedQty` - * When the order is `GTX` and the new price will cause it to be executed immediately - * - One order can only be modfied for less than 10000 times + * - One order can only be modfied for less than 10000 times - `reduceOnly` behavior: + * - `false` or omitted: behave as today — `min_notional` is enforced on the + * modified order. - `true` and the original order's `reduceOnly` + * attribute is also `true` (consistent): the `min_notional` check is + * skipped on the modified order, matching placement semantics. - `true` but the + * original order's `reduceOnly` attribute is `false` (inconsistent): + * the modify request is rejected with error code `-5047`, \"The original order + * is not a reduce-only order\". - `reduceOnly` is used purely for validation — + * passing `true` does not change the original order's `reduceOnly` + * attribute; that flag remains whatever it was set to at placement time. * * @param modifyOrderRequest (required) * @return ModifyOrderResponse diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/model/ModifyOrderRequest.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/model/ModifyOrderRequest.java index 70d3c0d45..a40f967af 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/model/ModifyOrderRequest.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/model/ModifyOrderRequest.java @@ -95,6 +95,12 @@ public class ModifyOrderRequest extends BaseDTO { @jakarta.annotation.Nullable private Long modifyId; + public static final String SERIALIZED_NAME_REDUCE_ONLY = "reduceOnly"; + + @SerializedName(SERIALIZED_NAME_REDUCE_ONLY) + @jakarta.annotation.Nullable + private ReduceOnly reduceOnly; + public static final String SERIALIZED_NAME_RECV_WINDOW = "recvWindow"; @SerializedName(SERIALIZED_NAME_RECV_WINDOW) @@ -284,6 +290,26 @@ public void setModifyId(@jakarta.annotation.Nullable Long modifyId) { this.modifyId = modifyId; } + public ModifyOrderRequest reduceOnly(@jakarta.annotation.Nullable ReduceOnly reduceOnly) { + this.reduceOnly = reduceOnly; + return this; + } + + /** + * Get reduceOnly + * + * @return reduceOnly + */ + @jakarta.annotation.Nullable + @Valid + public ReduceOnly getReduceOnly() { + return reduceOnly; + } + + public void setReduceOnly(@jakarta.annotation.Nullable ReduceOnly reduceOnly) { + this.reduceOnly = reduceOnly; + } + public ModifyOrderRequest recvWindow(@jakarta.annotation.Nullable Long recvWindow) { this.recvWindow = recvWindow; return this; @@ -321,6 +347,7 @@ public boolean equals(Object o) { && Objects.equals(this.price, modifyOrderRequest.price) && Objects.equals(this.priceMatch, modifyOrderRequest.priceMatch) && Objects.equals(this.modifyId, modifyOrderRequest.modifyId) + && Objects.equals(this.reduceOnly, modifyOrderRequest.reduceOnly) && Objects.equals(this.recvWindow, modifyOrderRequest.recvWindow); } @@ -336,6 +363,7 @@ public int hashCode() { price, priceMatch, modifyId, + reduceOnly, recvWindow); } @@ -352,6 +380,7 @@ public String toString() { sb.append(" price: ").append(toIndentedString(price)).append("\n"); sb.append(" priceMatch: ").append(toIndentedString(priceMatch)).append("\n"); sb.append(" modifyId: ").append(toIndentedString(modifyId)).append("\n"); + sb.append(" reduceOnly: ").append(toIndentedString(reduceOnly)).append("\n"); sb.append(" recvWindow: ").append(toIndentedString(recvWindow)).append("\n"); sb.append("}"); return sb.toString(); @@ -406,6 +435,11 @@ public String toUrlQueryString() { String modifyIdValueAsString = modifyIdValue.toString(); valMap.put("modifyId", modifyIdValueAsString); } + ReduceOnly reduceOnlyValue = getReduceOnly(); + if (reduceOnlyValue != null) { + String reduceOnlyValueAsString = reduceOnlyValue.toString(); + valMap.put("reduceOnly", reduceOnlyValueAsString); + } Long recvWindowValue = getRecvWindow(); if (recvWindowValue != null) { String recvWindowValueAsString = recvWindowValue.toString(); @@ -458,6 +492,10 @@ public Map toMap() { if (modifyIdValue != null) { valMap.put("modifyId", modifyIdValue); } + Object reduceOnlyValue = getReduceOnly(); + if (reduceOnlyValue != null) { + valMap.put("reduceOnly", reduceOnlyValue); + } Object recvWindowValue = getRecvWindow(); if (recvWindowValue != null) { valMap.put("recvWindow", recvWindowValue); @@ -497,6 +535,7 @@ private String toIndentedString(Object o) { openapiFields.add("price"); openapiFields.add("priceMatch"); openapiFields.add("modifyId"); + openapiFields.add("reduceOnly"); openapiFields.add("recvWindow"); // a set of required properties/fields (JSON key names) @@ -577,6 +616,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (jsonObj.get("priceMatch") != null && !jsonObj.get("priceMatch").isJsonNull()) { PriceMatch.validateJsonElement(jsonObj.get("priceMatch")); } + // validate the optional field `reduceOnly` + if (jsonObj.get("reduceOnly") != null && !jsonObj.get("reduceOnly").isJsonNull()) { + ReduceOnly.validateJsonElement(jsonObj.get("reduceOnly")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/model/SelfTradePreventionMode.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/model/SelfTradePreventionMode.java index 304d07602..267464af9 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/model/SelfTradePreventionMode.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/model/SelfTradePreventionMode.java @@ -22,8 +22,8 @@ import org.hibernate.validator.constraints.*; /** - * `NONE`:No STP / `EXPIRE_TAKER`:expire taker order when STP triggers/ - * `EXPIRE_MAKER`:expire taker order when STP triggers/ `EXPIRE_BOTH`:expire + * `NONE`: No STP / `EXPIRE_TAKER`: expire taker order when STP triggers/ + * `EXPIRE_MAKER`: expire taker order when STP triggers/ `EXPIRE_BOTH`: expire * both orders when STP triggers; default `NONE` */ @JsonAdapter(SelfTradePreventionMode.Adapter.class) 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 65838164e..4cf98ae39 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,7 +60,7 @@ public class DerivativesTradingUsdsFuturesWebSocketStreams { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/12.0.3 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/12.1.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private WebSocketClientConfiguration clientConfiguration; 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 index 6e74cda0e..f36d1f5a5 100644 --- 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 @@ -67,7 +67,7 @@ public class MarketApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/12.0.3 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/12.1.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private StreamConnectionInterface connection; @@ -1380,17 +1380,19 @@ private void markPriceStreamForAllMarketValidateBeforeCall( /** * Trading Session Stream Trading session information for the underlying assets of TradFi * Perpetual contracts, covering the U.S. equity market, Korean equity market, Hong Kong equity - * market, China equity market, and the commodity market, is updated every second. Trading - * session information for different underlying markets is pushed in separate messages. **Event - * type:** - `EquityUpdate`: Session types for the U.S. equity market include - * \"PRE_MARKET\", \"REGULAR\", \"AFTER_MARKET\", + * market, China equity market, the commodity market, and the FX market, is updated every + * second. Trading session information for different underlying markets is pushed in separate + * messages. **Event type:** - `EquityUpdate`: Session types for the U.S. equity + * market include \"PRE_MARKET\", \"REGULAR\", \"AFTER_MARKET\", * \"OVERNIGHT\", and \"NO_TRADING\". - `CommodityUpdate`: Session * types for the commodity market include \"REGULAR\" and \"NO_TRADING\". - * `KR_EquityUpdate`: Session types for the Korean equity market include * \"REGULAR\" and \"NO_TRADING\". - `HK_EquityUpdate`: Session * types for the Hong Kong equity market include \"REGULAR\" and * \"NO_TRADING\". - `CN_EquityUpdate`: Session types for the China equity - * market include \"REGULAR\" and \"NO_TRADING\". Update Speed: 1s + * market include \"REGULAR\" and \"NO_TRADING\". - `FXUpdate`: + * Session types for the FX market include \"REGULAR\" and \"NO_TRADING\". + * Update Speed: 1s * * @param tradingSessionStreamRequest (required) * @return TradingSessionStreamResponse 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 index 113209515..b2e0a89f4 100644 --- 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 @@ -47,7 +47,7 @@ public class PublicApi { private static final String USER_AGENT = String.format( - "binance-derivatives-trading-usds-futures/12.0.3 (Java/%s; %s; %s)", + "binance-derivatives-trading-usds-futures/12.1.0 (Java/%s; %s; %s)", SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch()); private StreamConnectionInterface connection; diff --git a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/TradingSessionStreamResponse.java b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/TradingSessionStreamResponse.java index d54d26b95..33cdc65cf 100644 --- a/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/TradingSessionStreamResponse.java +++ b/clients/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/stream/model/TradingSessionStreamResponse.java @@ -77,7 +77,8 @@ public TradingSessionStreamResponse eLowerCase(@jakarta.annotation.Nullable Stri } /** - * Event type, can also be CommodityUpdate, KR_EquityUpdate, HK_EquityUpdate or CN_EquityUpdate + * Event type, can also be CommodityUpdate, KR_EquityUpdate, HK_EquityUpdate, CN_EquityUpdate or + * FXUpdate * * @return eLowerCase */ diff --git a/examples/derivatives-trading-usds-futures/pom.xml b/examples/derivatives-trading-usds-futures/pom.xml index 25120e0dd..cdf1989c6 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 - 12.0.3 + 12.1.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/rest/marketdata/TradingScheduleExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/marketdata/TradingScheduleExample.java index f3ef595c1..b5a4aaac5 100644 --- a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/marketdata/TradingScheduleExample.java +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/marketdata/TradingScheduleExample.java @@ -32,13 +32,14 @@ public DerivativesTradingUsdsFuturesRestApi getApi() { *

Trading session schedules for the underlying assets of TradFi Perps are provided for a * one-week period forward and one-week period backward starting from the day prior to the query * time, covering the U.S. equity market, Korean equity market, Hong Kong equity market, China - * equity market, and the commodity market. Session types per market: - U.S. equity market: - * \"PRE_MARKET\", \"REGULAR\", \"AFTER_MARKET\", + * equity market, the commodity market, and the FX market. Session types per market: - U.S. + * equity market: \"PRE_MARKET\", \"REGULAR\", \"AFTER_MARKET\", * \"OVERNIGHT\", \"NO_TRADING\". - Commodity market: \"REGULAR\", * \"NO_TRADING\". - Korean equity market: \"REGULAR\", * \"NO_TRADING\". - Hong Kong equity market: \"REGULAR\", * \"NO_TRADING\". - China equity market: \"REGULAR\", - * \"NO_TRADING\". Weight(IP): 5 + * \"NO_TRADING\". - FX market: \"REGULAR\", \"NO_TRADING\". + * Weight(IP): 5 * * @throws ApiException if the Api call fails */ diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/trade/ModifyOrderExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/trade/ModifyOrderExample.java index fd740da16..a4c5db3ce 100644 --- a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/trade/ModifyOrderExample.java +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/rest/trade/ModifyOrderExample.java @@ -43,7 +43,16 @@ public DerivativesTradingUsdsFuturesRestApi getApi() { * following situations: - when the order is in partially filled status and the new * `quantity` <= `executedQty` - When the order is `GTX` * and the new price will cause it to be executed immediately - One order can only be modfied - * for less than 10000 times + * for less than 10000 times - `reduceOnly` behavior: - `false` or omitted: + * behave as today — `min_notional` is enforced on the modified order. - + * `true` and the original order's `reduceOnly` attribute is also + * `true` (consistent): the `min_notional` check is skipped on the modified + * order, matching placement semantics. - `true` but the original order's + * `reduceOnly` attribute is `false` (inconsistent): the modify request is + * rejected with error code `-5047`, \"The original order is not a reduce-only + * order\". - `reduceOnly` is used purely for validation — passing + * `true` does not change the original order's `reduceOnly` attribute; + * that flag remains whatever it was set to at placement time. * * @throws ApiException if the Api call fails */ diff --git a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/trade/ModifyOrderExample.java b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/trade/ModifyOrderExample.java index 8efb26a54..e8890ab8e 100644 --- a/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/trade/ModifyOrderExample.java +++ b/examples/derivatives-trading-usds-futures/src/main/java/com/binance/connector/client/derivatives_trading_usds_futures/websocket/api/trade/ModifyOrderExample.java @@ -44,7 +44,16 @@ public DerivativesTradingUsdsFuturesWebSocketApi getApi() { * will be cancelled by the amendment in the following situations: - when the order is in * partially filled status and the new `quantity` <= `executedQty` - * When the order is `GTX` and the new price will cause it to be executed immediately - * - One order can only be modfied for less than 10000 times + * - One order can only be modfied for less than 10000 times - `reduceOnly` behavior: + * - `false` or omitted: behave as today — `min_notional` is enforced on the + * modified order. - `true` and the original order's `reduceOnly` + * attribute is also `true` (consistent): the `min_notional` check is + * skipped on the modified order, matching placement semantics. - `true` but the + * original order's `reduceOnly` attribute is `false` (inconsistent): + * the modify request is rejected with error code `-5047`, \"The original order + * is not a reduce-only order\". - `reduceOnly` is used purely for validation — + * passing `true` does not change the original order's `reduceOnly` + * attribute; that flag remains whatever it was set to at placement time. */ public void modifyOrderExampleAsync() { ModifyOrderRequest modifyOrderRequest = new ModifyOrderRequest(); @@ -78,7 +87,16 @@ public void modifyOrderExampleAsync() { * will be cancelled by the amendment in the following situations: - when the order is in * partially filled status and the new `quantity` <= `executedQty` - * When the order is `GTX` and the new price will cause it to be executed immediately - * - One order can only be modfied for less than 10000 times + * - One order can only be modfied for less than 10000 times - `reduceOnly` behavior: + * - `false` or omitted: behave as today — `min_notional` is enforced on the + * modified order. - `true` and the original order's `reduceOnly` + * attribute is also `true` (consistent): the `min_notional` check is + * skipped on the modified order, matching placement semantics. - `true` but the + * original order's `reduceOnly` attribute is `false` (inconsistent): + * the modify request is rejected with error code `-5047`, \"The original order + * is not a reduce-only order\". - `reduceOnly` is used purely for validation — + * passing `true` does not change the original order's `reduceOnly` + * attribute; that flag remains whatever it was set to at placement time. */ public void modifyOrderExampleSync() { ModifyOrderRequest modifyOrderRequest = new ModifyOrderRequest(); 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 index 7ab4bb75a..c1fb2df03 100644 --- 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 @@ -26,9 +26,9 @@ public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { * *

Trading session information for the underlying assets of TradFi Perpetual contracts, * covering the U.S. equity market, Korean equity market, Hong Kong equity market, China equity - * market, and the commodity market, is updated every second. Trading session information for - * different underlying markets is pushed in separate messages. **Event type:** - - * `EquityUpdate`: Session types for the U.S. equity market include + * market, the commodity market, and the FX market, is updated every second. Trading session + * information for different underlying markets is pushed in separate messages. **Event type:** + * - `EquityUpdate`: Session types for the U.S. equity market include * \"PRE_MARKET\", \"REGULAR\", \"AFTER_MARKET\", * \"OVERNIGHT\", and \"NO_TRADING\". - `CommodityUpdate`: Session * types for the commodity market include \"REGULAR\" and \"NO_TRADING\". - @@ -36,7 +36,9 @@ public DerivativesTradingUsdsFuturesWebSocketStreams getApi() { * \"REGULAR\" and \"NO_TRADING\". - `HK_EquityUpdate`: Session * types for the Hong Kong equity market include \"REGULAR\" and * \"NO_TRADING\". - `CN_EquityUpdate`: Session types for the China equity - * market include \"REGULAR\" and \"NO_TRADING\". Update Speed: 1s + * market include \"REGULAR\" and \"NO_TRADING\". - `FXUpdate`: + * Session types for the FX market include \"REGULAR\" and \"NO_TRADING\". + * Update Speed: 1s * * @throws ApiException if the Api call fails */