Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions clients/derivatives-trading-coin-futures/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.2.1 - 2025-06-24

### Changed (1)

- Fixed cases where the response can be an object or an array

## 1.2.0 - 2025-05-13

- Add proxy authentication for websocket
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ With the transition to a modularized structure, the Binance Connector has been s
<dependency>
<groupId>io.github.binance</groupId>
<artifactId>binance-derivatives-trading-coin-futures</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
</dependency>
```

Expand Down Expand Up @@ -91,7 +91,7 @@ by:
<dependency>
<groupId>io.github.binance</groupId>
<artifactId>binance-derivatives-trading-coin-futures</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion clients/derivatives-trading-coin-futures/example_rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

[PUT /dapi/v1/batchOrders](https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Multiple-Orders) - modifyMultipleOrders - [ModifyMultipleOrdersExample.java:52](/examples/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/trade/ModifyMultipleOrdersExample.java#L52)

[PUT /dapi/v1/order](https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Order) - modifyOrder - [ModifyOrderExample.java:59](/examples/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/trade/ModifyOrderExample.java#L59)
[PUT /dapi/v1/order](https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Order) - modifyOrder - [ModifyOrderExample.java:58](/examples/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/trade/ModifyOrderExample.java#L58)

[POST /dapi/v1/order](https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/New-Order) - newOrder - [NewOrderExample.java:85](/examples/derivatives-trading-coin-futures/src/main/java/com/binance/connector/client/derivatives_trading_coin_futures/rest/trade/NewOrderExample.java#L85)

Expand Down
4 changes: 2 additions & 2 deletions clients/derivatives-trading-coin-futures/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>binance-derivatives-trading-coin-futures</artifactId>
<name>derivatives-trading-coin-futures</name>
<version>1.2.0</version>
<version>1.2.1</version>
<packaging>jar</packaging>

<parent>
Expand All @@ -31,7 +31,7 @@
<dependency>
<groupId>io.github.binance</groupId>
<artifactId>binance-common</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class AccountApi {

private static final String USER_AGENT =
String.format(
"binance-derivatives-trading-coin-futures/1.2.0 (Java/%s; %s; %s)",
"binance-derivatives-trading-coin-futures/1.2.1 (Java/%s; %s; %s)",
SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch());
private static final boolean HAS_TIME_UNIT = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1721,8 +1721,8 @@ public ApiResponse<ModifyMultipleOrdersResponse> modifyMultipleOrders(
* However the order will be cancelled by the amendment in the following situations: * when the
* order is in partially filled status and the new &#x60;quantity&#x60; &lt;&#x3D;
* &#x60;executedQty&#x60; * When the order is &#x60;GTX&#x60; and the new price will cause it
* to be executed immediately * One order can only be modfied for less than 10000 times * Modify
* order will set &#x60;selfTradePreventionMode&#x60; to &#x60;NONE&#x60; Weight: 1
* to be executed immediately * One order can only be modfied for less than 10000 times Weight:
* 1
*
* @param modifyOrderRequest (required)
* @return ApiResponse&lt;ModifyOrderResponse&gt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class MarketDataApi {

private static final String USER_AGENT =
String.format(
"binance-derivatives-trading-coin-futures/1.2.0 (Java/%s; %s; %s)",
"binance-derivatives-trading-coin-futures/1.2.1 (Java/%s; %s; %s)",
SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch());
private static final boolean HAS_TIME_UNIT = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class PortfolioMarginEndpointsApi {

private static final String USER_AGENT =
String.format(
"binance-derivatives-trading-coin-futures/1.2.0 (Java/%s; %s; %s)",
"binance-derivatives-trading-coin-futures/1.2.1 (Java/%s; %s; %s)",
SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch());
private static final boolean HAS_TIME_UNIT = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class TradeApi {

private static final String USER_AGENT =
String.format(
"binance-derivatives-trading-coin-futures/1.2.0 (Java/%s; %s; %s)",
"binance-derivatives-trading-coin-futures/1.2.1 (Java/%s; %s; %s)",
SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch());
private static final boolean HAS_TIME_UNIT = false;

Expand Down Expand Up @@ -2692,8 +2692,8 @@ private okhttp3.Call modifyOrderValidateBeforeCall(ModifyOrderRequest modifyOrde
* However the order will be cancelled by the amendment in the following situations: * when the
* order is in partially filled status and the new &#x60;quantity&#x60; &lt;&#x3D;
* &#x60;executedQty&#x60; * When the order is &#x60;GTX&#x60; and the new price will cause it
* to be executed immediately * One order can only be modfied for less than 10000 times * Modify
* order will set &#x60;selfTradePreventionMode&#x60; to &#x60;NONE&#x60; Weight: 1
* to be executed immediately * One order can only be modfied for less than 10000 times Weight:
* 1
*
* @param modifyOrderRequest (required)
* @return ApiResponse&lt;ModifyOrderResponse&gt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class UserDataStreamsApi {

private static final String USER_AGENT =
String.format(
"binance-derivatives-trading-coin-futures/1.2.0 (Java/%s; %s; %s)",
"binance-derivatives-trading-coin-futures/1.2.1 (Java/%s; %s; %s)",
SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch());
private static final boolean HAS_TIME_UNIT = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.hibernate.validator.constraints.*;

Expand Down Expand Up @@ -383,18 +381,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
AccountInformationResponse.openapiRequiredFields.toString()));
}
}

Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!AccountInformationResponse.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(
String.format(
"The field `%s` in the JSON string is not defined in the"
+ " `AccountInformationResponse` properties. JSON: %s",
entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if (jsonObj.get("assets") != null && !jsonObj.get("assets").isJsonNull()) {
JsonArray jsonArrayassets = jsonObj.getAsJsonArray("assets");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.hibernate.validator.constraints.*;

/** AccountInformationResponseAssetsInner */
Expand Down Expand Up @@ -594,19 +592,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
.toString()));
}
}

Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!AccountInformationResponseAssetsInner.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(
String.format(
"The field `%s` in the JSON string is not defined in the"
+ " `AccountInformationResponseAssetsInner` properties. JSON:"
+ " %s",
entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("asset") != null && !jsonObj.get("asset").isJsonNull())
&& !jsonObj.get("asset").isJsonPrimitive()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.hibernate.validator.constraints.*;

/** AccountInformationResponsePositionsInner */
Expand Down Expand Up @@ -656,19 +654,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
.toString()));
}
}

Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!AccountInformationResponsePositionsInner.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(
String.format(
"The field `%s` in the JSON string is not defined in the"
+ " `AccountInformationResponsePositionsInner` properties."
+ " JSON: %s",
entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull())
&& !jsonObj.get("symbol").isJsonPrimitive()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import com.binance.connector.client.derivatives_trading_coin_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;
Expand All @@ -28,9 +29,7 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.hibernate.validator.constraints.*;

/** AccountTradeListResponse */
Expand Down Expand Up @@ -108,6 +107,18 @@ private String toIndentedString(Object o) {
* @throws IOException if the JSON Element is invalid with respect to AccountTradeListResponse
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (!jsonElement.isJsonArray()) {
throw new IllegalArgumentException(
String.format(
"Expected json element to be a array type in the JSON string but got"
+ " `%s`",
jsonElement.toString()));
}
JsonArray array = jsonElement.getAsJsonArray();
// validate array items
for (JsonElement element : array) {
AccountTradeListResponseInner.validateJsonElement(element);
}
if (jsonElement == null) {
if (!AccountTradeListResponse.openapiRequiredFields
.isEmpty()) { // has required fields but JSON element is null
Expand All @@ -118,18 +129,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
AccountTradeListResponse.openapiRequiredFields.toString()));
}
}

Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!AccountTradeListResponse.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(
String.format(
"The field `%s` in the JSON string is not defined in the"
+ " `AccountTradeListResponse` properties. JSON: %s",
entry.getKey(), jsonElement.toString()));
}
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
Expand Down
Loading