Skip to content

Commit ae1bb6b

Browse files
authored
Merge pull request #156 from binance/generate_products_2.0.0
regenerate products v2.0.0
2 parents 5ec79eb + 0721520 commit ae1bb6b

File tree

153 files changed

+4102
-12308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+4102
-12308
lines changed

clients/common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
<artifactId>binance-common</artifactId>
1212
<name>common</name>
13-
<version>1.2.0</version>
13+
<version>1.2.1</version>
1414
<packaging>jar</packaging>
1515
</project>

clients/common/src/main/AndroidManifest.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

clients/common/src/main/java/com/binance/connector/client/common/ApiClient.java

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,18 @@ public class ApiClient {
8989

9090
private static final int DIFF_TILL_POSITION_INDEX = 1;
9191

92-
private static final Pattern PATTERN_USED_WEIGHT =
93-
Pattern.compile("x-mbx-used-weight-([0-9]+)([shmd])");
94-
private static final Pattern PATTERN_ORDER_COUNT =
95-
Pattern.compile("x-mbx-order-count-([0-9]+)([smhd])");
92+
private static final Map<RateLimitType, Pattern> RATE_LIMIT_PATTERN_MAP =
93+
Map.of(
94+
RateLimitType.REQUEST_WEIGHT,
95+
Pattern.compile("x-mbx-used-weight-([0-9]+)([shmd])"),
96+
RateLimitType.ORDERS, Pattern.compile("x-mbx-order-count-([0-9]+)([smhd])"));
9697

9798
private static final String HEADER_TIMEUNIT = "X-MBX-TIME-UNIT";
9899
private static final String HEADER_API_KEY = "X-MBX-APIKEY";
99100

101+
private static final String BINANCE_SIGNATURE = "binanceSignature";
102+
private static final String BINANCE_API_KEY_ONLY = "binanceApiKeyOnly";
103+
100104
private String basePath = "https://api.binance.com";
101105
protected List<ServerConfiguration> servers =
102106
new ArrayList<ServerConfiguration>(
@@ -202,14 +206,14 @@ public ApiClient(
202206
Authentication authentication =
203207
binanceAuthenticationFactory.getAuthentication(signatureConfiguration);
204208
if (authentication != null) {
205-
authentications.put("binanceSignature", authentication);
209+
authentications.put(BINANCE_SIGNATURE, authentication);
206210
}
207211

208212
Authentication binanceApiKeyOnly =
209213
(queryParams, headerParams, cookieParams, payload, method, uri) -> {
210214
headerParams.put(HEADER_API_KEY, signatureConfiguration.getApiKey());
211215
};
212-
authentications.put("binanceApiKeyOnly", binanceApiKeyOnly);
216+
authentications.put(BINANCE_API_KEY_ONLY, binanceApiKeyOnly);
213217
}
214218
}
215219

@@ -1531,6 +1535,11 @@ public void updateParamsForAuth(
15311535
for (String authName : authNames) {
15321536
Authentication auth = authentications.get(authName);
15331537
if (auth == null) {
1538+
if (BINANCE_SIGNATURE.equals(authName)) {
1539+
throw new RuntimeException(
1540+
"Request is signed, please add signatureConfiguration to"
1541+
+ " clientConfiguration");
1542+
}
15341543
throw new RuntimeException("Authentication undefined: " + authName);
15351544
}
15361545
try {
@@ -1778,32 +1787,35 @@ private Map<RateLimitType, RateLimit> getRateLimit(Integer responseCode, Headers
17781787
HashMap<RateLimitType, RateLimit> rateLimitMap = new HashMap<>();
17791788
Integer retryAfter = null;
17801789
if (Arrays.asList(HTTP_TEA_POT, HTTP_TOO_MANY_REQS).contains(responseCode)) {
1781-
retryAfter = Integer.valueOf(headers.get("retry-after"));
1790+
String retryAfterHeaderVal = headers.get("retry-after");
1791+
if (retryAfterHeaderVal != null) {
1792+
retryAfter = Integer.valueOf(retryAfterHeaderVal);
1793+
}
17821794
}
17831795
for (String name : headers.names()) {
17841796
if (name.startsWith("x-mbx-used-weight-")) {
17851797
RateLimit usedWeightRateLimit =
17861798
getRateLimitFromHeader(
1787-
name, headers.get(name), PATTERN_USED_WEIGHT, retryAfter);
1799+
name, headers.get(name), RateLimitType.REQUEST_WEIGHT, retryAfter);
17881800
rateLimitMap.put(RateLimitType.REQUEST_WEIGHT, usedWeightRateLimit);
17891801
}
17901802

17911803
if (name.startsWith("x-mbx-order-count-")) {
17921804
RateLimit orderCountRateLimit =
17931805
getRateLimitFromHeader(
1794-
name, headers.get(name), PATTERN_ORDER_COUNT, retryAfter);
1806+
name, headers.get(name), RateLimitType.ORDERS, retryAfter);
17951807
rateLimitMap.put(RateLimitType.ORDERS, orderCountRateLimit);
17961808
}
17971809
}
17981810
return rateLimitMap;
17991811
}
18001812

18011813
private RateLimit getRateLimitFromHeader(
1802-
String headerName, String value, Pattern pattern, Integer retryAfter) {
1814+
String headerName, String value, RateLimitType rateLimitType, Integer retryAfter) {
18031815
RateLimit rateLimit = new RateLimit();
1804-
rateLimit.setRateLimitType(RateLimitType.REQUEST_WEIGHT);
1816+
rateLimit.setRateLimitType(rateLimitType);
18051817

1806-
Matcher usedWeightMatcher = pattern.matcher(headerName);
1818+
Matcher usedWeightMatcher = RATE_LIMIT_PATTERN_MAP.get(rateLimitType).matcher(headerName);
18071819
if (usedWeightMatcher.find()) {
18081820
String intervalCount = usedWeightMatcher.group(1);
18091821
String intervalType = usedWeightMatcher.group(2);

clients/common/src/main/java/com/binance/connector/client/common/auth/BinanceBaseAuthentication.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.binance.connector.client.common.auth;
22

33
import com.binance.connector.client.common.Pair;
4-
54
import java.net.URLEncoder;
65
import java.nio.charset.StandardCharsets;
76
import java.util.List;

clients/common/src/main/java/com/binance/connector/client/common/configuration/ClientConfiguration.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.binance.connector.client.common.dtos.TimeUnit;
44
import java.net.Proxy;
5-
65
import okhttp3.Authenticator;
76
import okhttp3.CertificatePinner;
87

clients/common/src/main/java/com/binance/connector/client/common/websocket/adapter/ConnectionWrapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ public ConnectionWrapper(
114114
if (configuration.getWebSocketProxy() != null) {
115115
httpClient.getProxyConfiguration().addProxy(configuration.getWebSocketProxy());
116116
if (configuration.getWebSocketProxyAuthentication() != null) {
117-
httpClient.getAuthenticationStore().addAuthentication(configuration.getWebSocketProxyAuthentication());
117+
httpClient
118+
.getAuthenticationStore()
119+
.addAuthentication(configuration.getWebSocketProxyAuthentication());
118120
}
119121
}
120122
webSocketClient = new WebSocketClient(httpClient);

clients/common/src/main/java/com/binance/connector/client/common/websocket/configuration/SessionMode.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

clients/crypto-loan/CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## 2.0.0 - 2025-06-02
4+
5+
### Removed (8)
6+
7+
- `flexibleLoanCollateralRepayment()` (`POST /sapi/v2/loan/flexible/repay/collateral`)
8+
- `cryptoLoanAdjustLtv()` (`POST /sapi/v1/loan/adjust/ltv`)
9+
- `cryptoLoanBorrow()` (`POST /sapi/v1/loan/borrow`)
10+
- `cryptoLoanCustomizeMarginCall()` (`POST /sapi/v1/loan/customize/margin_call`)
11+
- `cryptoLoanRepay()` (`POST /sapi/v1/loan/repay`)
12+
- `getCollateralAssetsData()` (`GET /sapi/v1/loan/collateral/data`)
13+
- `getLoanOngoingOrders()` (`GET /sapi/v1/loan/ongoing/orders`)
14+
- `getLoanableAssetsData()` (`GET /sapi/v1/loan/loanable/data`)
15+
316
## 1.1.0 - 2025-05-02
417

518
- Update `binance/common` module to version `1.1.0`.
@@ -8,4 +21,4 @@
821

922
## 1.0.0 - 2025-04-24
1023

11-
- Initial release
24+
- Initial release

clients/crypto-loan/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Then add dependency to pom.xml:
4141
<dependency>
4242
<groupId>io.github.binance</groupId>
4343
<artifactId>binance-crypto-loan</artifactId>
44-
<version>1.1.0</version>
44+
<version>2.0.0</version>
4545
</dependency>
4646
```
4747

clients/crypto-loan/docs/FlexibleLoanRepayRequest.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
|**repayAmount** | **Double** | | |
1313
|**collateralReturn** | **Boolean** | | [optional] |
1414
|**fullRepayment** | **Boolean** | | [optional] |
15+
|**repaymentType** | **Long** | | [optional] |
1516
|**recvWindow** | **Long** | | [optional] |
1617

1718

0 commit comments

Comments
 (0)