Skip to content

Commit e85d0d8

Browse files
committed
release spot 6.0.0
1 parent 1bb6972 commit e85d0d8

File tree

136 files changed

+9951
-100
lines changed

Some content is hidden

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

136 files changed

+9951
-100
lines changed

MIGRATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ For Spot (Spot package):
3737
<dependency>
3838
<groupId>io.github.binance</groupId>
3939
<artifactId>binance-spot</artifactId>
40-
<version>5.0.1</version>
40+
<version>6.0.0</version>
4141
</dependency>
4242
```
4343

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Each connector is published as a separate maven dependency. For example:
5454
<dependency>
5555
<groupId>io.github.binance</groupId>
5656
<artifactId>binance-spot</artifactId>
57-
<version>5.0.1</version>
57+
<version>6.0.0</version>
5858
</dependency>
5959
```
6060

clients/common/CHANGELOG.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
# Changelog
22

3+
## 2.0.1 - 2025-08-20
4+
5+
- Inject session log on and log out method names.
6+
- Auto re-logon after reconnect.
7+
8+
## 2.0.0 - 2025-08-07
9+
10+
- authNames param as Set instead of array of String.
11+
12+
## 1.4.0 - 2025-07-17
13+
14+
- Handle streams through WebSocket API
15+
316
## 1.3.0 - 2025-07-08
417

518
- Support custom headers for REST API requests (`customHeaders` option on `ClientConfiguration`).
619
- Added `messageMaxSize` configuration for websocket.
7-
- Added getter for `RateLimits` in `ApiResponse`
20+
- Added getter for `RateLimits` in `ApiResponse`.
821

922
## 1.2.0 - 2025-05-13
1023

11-
- Add proxy authentication for websocket
24+
- Add proxy authentication for websocket.
1225

1326
## 1.1.0 - 2025-05-02
1427

@@ -17,4 +30,4 @@
1730

1831
## 1.0.0 - 2025-04-24
1932

20-
- Initial release
33+
- Initial release.

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>2.0.0</version>
13+
<version>2.0.1</version>
1414
<packaging>jar</packaging>
1515
</project>

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

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

33
import com.binance.connector.client.common.websocket.dtos.ApiRequestWrapperDTO;
44
import com.binance.connector.client.common.websocket.dtos.RequestWrapperDTO;
5+
6+
import java.util.List;
57
import java.util.concurrent.BlockingQueue;
68

79
public interface ConnectionInterface {
@@ -16,4 +18,9 @@ public interface ConnectionInterface {
1618
void setUserAgent(String userAgent);
1719

1820
boolean isConnected();
21+
22+
void setLogonMethods(List<String> logonMethods);
23+
24+
void setLogoutMethods(List<String> logoutMethods);
25+
1926
}

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

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import com.binance.connector.client.common.websocket.dtos.ApiRequestWrapperDTO;
1111
import com.binance.connector.client.common.websocket.dtos.BaseRequestDTO;
1212
import com.binance.connector.client.common.websocket.dtos.RequestWrapperDTO;
13-
import com.binance.connector.client.common.websocket.dtos.SessionLogonResponse;
13+
import com.binance.connector.client.common.websocket.dtos.SessionResponse;
1414
import com.binance.connector.client.common.websocket.service.DeserializeExclusionStrategy;
1515
import com.binance.connector.client.common.websocket.service.SerializeExclusionStrategy;
1616
import com.google.gson.Gson;
@@ -64,13 +64,13 @@ public class ConnectionWrapper implements WebSocketListener, ConnectionInterface
6464
// -2015 for wrong API Keys, -1022 for wrong signature
6565
private static final List<Integer> ERROR_CODE_WRONG_CREDENTIALS = Arrays.asList(-2015, -1022);
6666

67-
private static final String LOGON_METHOD = "session.logon";
68-
private static final String LOGOUT_METHOD = "session.logout";
69-
7067
protected Map<String, RequestWrapperDTO> pendingRequest = new HashMap<>();
7168
protected Session session;
7269
protected Session oldSession;
7370

71+
protected List<String> logonMethods = new ArrayList<>();
72+
protected List<String> logoutMethods = new ArrayList<>();
73+
7474
private String userAgent =
7575
String.format(
7676
"binance-connector-java/1.0.0 (Java/%s; %s; %s)",
@@ -193,7 +193,7 @@ public void connect() {
193193
public void connect(Consumer<Session> customCallback)
194194
throws IOException, URISyntaxException, InterruptedException {
195195
pendingReconnect = false;
196-
boolean autoLogon = configuration.getAutoLogon();
196+
boolean autoLogon = !logonMethods.isEmpty() && (configuration.getAutoLogon() || isLoggedOn);
197197

198198
// For LogOn mode, we need the logon to be completed before changing the session
199199
countDownLatch = new CountDownLatch(autoLogon ? 1 : 0);
@@ -399,12 +399,12 @@ public void logOn(Session session) throws CryptoException {
399399
.build();
400400

401401
build.setSignature(signatureGenerator.signAsString(build.toString()));
402-
RequestWrapperDTO<? extends BaseRequestDTO, SessionLogonResponse> request =
403-
new RequestWrapperDTO.Builder<BaseRequestDTO, SessionLogonResponse>()
402+
RequestWrapperDTO<? extends BaseRequestDTO, SessionResponse> request =
403+
new RequestWrapperDTO.Builder<BaseRequestDTO, SessionResponse>()
404404
.id(UUID.randomUUID().toString())
405-
.method("session.logon")
405+
.method(logonMethods.get(0))
406406
.params(build)
407-
.responseType(SessionLogonResponse.class)
407+
.responseType(SessionResponse.class)
408408
.build();
409409

410410
request.getResponseCallback()
@@ -462,13 +462,13 @@ public void onWebSocketText(String message) {
462462
Object responseResult = gson.fromJson(root, responseType);
463463
pendingRequest.remove(id);
464464

465-
if (LOGON_METHOD.equals(requestWrapperDTO.getMethod())) {
465+
if (this.logonMethods.contains(requestWrapperDTO.getMethod())) {
466466
if (obj.get("status").getAsInt() == 200) {
467467
isLoggedOn = true;
468468
}
469469
}
470470

471-
if (LOGOUT_METHOD.equals(requestWrapperDTO.getMethod())) {
471+
if (this.logoutMethods.contains(requestWrapperDTO.getMethod())) {
472472
if (obj.get("status").getAsInt() == 200) {
473473
isLoggedOn = false;
474474
}
@@ -509,6 +509,16 @@ public boolean isConnected() {
509509
return session != null && session.isOpen();
510510
}
511511

512+
@Override
513+
public void setLogonMethods(List<String> logonMethods) {
514+
this.logonMethods = logonMethods;
515+
}
516+
517+
@Override
518+
public void setLogoutMethods(List<String> logoutMethods) {
519+
this.logoutMethods = logoutMethods;
520+
}
521+
512522
public URI getUri(String uri) throws URISyntaxException {
513523
URI oldUri = new URI(uri);
514524

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
import com.binance.connector.client.common.websocket.dtos.ApiRequestWrapperDTO;
66
import com.binance.connector.client.common.websocket.dtos.RequestWrapperDTO;
77
import com.google.gson.Gson;
8+
9+
import java.util.ArrayList;
810
import java.util.LinkedList;
11+
import java.util.List;
912
import java.util.ListIterator;
1013
import java.util.Timer;
1114
import java.util.TimerTask;
@@ -22,6 +25,9 @@ public class PoolConnectionWrapper implements ConnectionInterface {
2225
"binance-connector-java/1.0.0 (Java/%s; %s; %s)",
2326
SystemUtil.getJavaVersion(), SystemUtil.getOs(), SystemUtil.getArch());
2427

28+
protected List<String> logonMethod = new ArrayList<>();
29+
protected List<String> logoutMethod = new ArrayList<>();
30+
2531
public PoolConnectionWrapper(WebSocketClientConfiguration clientConfiguration) {
2632
this(clientConfiguration, null);
2733
}
@@ -73,6 +79,8 @@ public void run() {
7379
public void connect() {
7480
for (ConnectionWrapper connectionWrapper : connectionList) {
7581
connectionWrapper.setUserAgent(userAgent);
82+
connectionWrapper.setLogonMethods(logonMethod);
83+
connectionWrapper.setLogoutMethods(logoutMethod);
7684
connectionWrapper.connect();
7785
}
7886
isConnected = true;
@@ -113,7 +121,19 @@ public ConnectionWrapper getConnection() {
113121
}
114122

115123
@Override
116-
public void setUserAgent(String userAgent) {}
124+
public void setUserAgent(String userAgent) {
125+
this.userAgent = userAgent;
126+
}
127+
128+
@Override
129+
public void setLogonMethods(List<String> logonMethods) {
130+
this.logonMethod = logonMethods;
131+
}
132+
133+
@Override
134+
public void setLogoutMethods(List<String> logoutMethods) {
135+
this.logoutMethod = logoutMethods;
136+
}
117137

118138
@Override
119139
public boolean isConnected() {

clients/common/src/main/java/com/binance/connector/client/common/websocket/dtos/BaseRequestDTO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void setTimestamp(String timestamp) {
3939
}
4040

4141
public String toUrlQueryString() {
42-
return "timestamp=" + getTimestamp();
42+
return "apiKey=" + apiKey + "&timestamp=" + timestamp;
4343
}
4444

4545
@Override

0 commit comments

Comments
 (0)