Skip to content

Commit 62d9202

Browse files
committed
modularize connectors
1 parent b850208 commit 62d9202

File tree

6,332 files changed

+1190032
-37402
lines changed

Some content is hidden

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

6,332 files changed

+1190032
-37402
lines changed

CHANGELOG.md

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

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Binance
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

LICENSE.md

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

MIGRATION.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# **Migration Guide: Transition from Monolithic Binance Connector**
2+
3+
With the move towards modularization, Binance connectors are now split into smaller, product-specific libraries. This guide explains how to migrate from the monolithic `binance-connector-java` for Spot and `binance-futures-connector-java` for Futures to the new modular connectors.
4+
5+
## **Overview of Changes**
6+
7+
| Feature | Monolithic Connector | Modular Connector |
8+
|---------|----------------------|-------------------------------------------------------------------|
9+
| Package Name | `binance-connector-java`, `binance-futures-connector-java` | `binance-<product>` |
10+
| API Coverage | All Binance APIs | Individual APIs (Spot, Futures, Wallet, Algo Trading, Mining etc.) |
11+
| Imports | Single package import | Separate package per product |
12+
| Code Structure | One large client | Smaller, focused clients |
13+
14+
## **Migration Steps**
15+
16+
### **Step 1: Replace maven dependencies**
17+
18+
If you were using the old connector, remove it from your project:
19+
```xml
20+
<dependency>
21+
<groupId>io.github.binance</groupId>
22+
<artifactId>binance-connector-java</artifactId>
23+
<version>3.0.5</version>
24+
</dependency>
25+
```
26+
or
27+
```xml
28+
<dependency>
29+
<groupId>io.github.binance</groupId>
30+
<artifactId>binance-futures-connector-java</artifactId>
31+
<version>3.0.5</version>
32+
</dependency>
33+
```
34+
And replace it with the new connector(s):
35+
For Spot (Spot package):
36+
```xml
37+
<dependency>
38+
<groupId>io.github.binance</groupId>
39+
<artifactId>binance-spot</artifactId>
40+
<version>1.0.0</version>
41+
</dependency>
42+
```
43+
44+
For Futures (COIN-M Futures package):
45+
46+
```xml
47+
<dependency>
48+
<groupId>io.github.binance</groupId>
49+
<artifactId>binance-derivatives-trading-coin-futures</artifactId>
50+
<version>1.0.0</version>
51+
</dependency>
52+
```
53+
54+
### **Step 3: Update Imports**
55+
56+
Update your import paths:
57+
58+
**Old (Spot):**
59+
60+
```java
61+
import com.binance.connector.client.SpotClient;
62+
```
63+
64+
**New (Spot):**
65+
66+
```java
67+
import com.binance.connector.client.spot.rest.api.SpotRestApi;
68+
```
69+
70+
**Old (CMFutures):**
71+
72+
```java
73+
import com.binance.connector.futures.client.impl.CMFuturesClientImpl;
74+
```
75+
76+
**New (COIN-M Futures):**
77+
78+
```java
79+
import com.binance.connector.client.derivatives_trading_coin_futures.rest.api.DerivativesTradingCoinFuturesRestApi;
80+
```
81+
82+
### **Step 4: Update Client Initialization**
83+
84+
The new structure introduces a more modular approach to client initialization.
85+
86+
**Old (Spot - Monolithic Connector):**
87+
88+
```java
89+
SpotClient client = new SpotClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY);
90+
Map<String, Object> parameters = new LinkedHashMap<>();
91+
String result = client.createTrade().account(parameters);
92+
System.out.println(result);
93+
```
94+
95+
**New (Spot - Modular Connector):**
96+
97+
```java
98+
ClientConfiguration clientConfiguration = SpotRestApiUtil.getClientConfiguration();
99+
SignatureConfiguration signatureConfiguration = new SignatureConfiguration();
100+
signatureConfiguration.setApiKey("apiKey");
101+
signatureConfiguration.setPrivateKey("path/to/private.key");
102+
clientConfiguration.setSignatureConfiguration(signatureConfiguration);
103+
104+
SpotRestApi api = new SpotRestApi(clientConfiguration);
105+
106+
Boolean omitZeroBalances = true;
107+
Long recvWindow = 5000L;
108+
ApiResponse<GetAccountResponse> response = api.getAccount(omitZeroBalances, recvWindow);
109+
System.out.println(response.getData());
110+
```
111+
112+
**Old (Futures - Monolithic Connector):**
113+
114+
```java
115+
CMFuturesClientImpl client = new CMFuturesClientImpl(PrivateConfig.API_KEY, PrivateConfig.SECRET_KEY);
116+
LinkedHashMap<String, Object> parameters = new LinkedHashMap<>();
117+
String result = client.account().accountInformation(parameters);
118+
System.out.println(result);
119+
```
120+
121+
**New (Futures - Modular Connector):**
122+
123+
```java
124+
ClientConfiguration clientConfiguration = DerivativesTradingCoinFuturesRestApiUtil.getClientConfiguration();
125+
SignatureConfiguration signatureConfiguration = new SignatureConfiguration();
126+
signatureConfiguration.setApiKey("apiKey");
127+
signatureConfiguration.setPrivateKey("path/to/private.key");
128+
clientConfiguration.setSignatureConfiguration(signatureConfiguration);
129+
DerivativesTradingCoinFuturesRestApi api = new DerivativesTradingCoinFuturesRestApi(clientConfiguration);
130+
131+
Long recvWindow = 5000L;
132+
ApiResponse<AccountInformationResponse> response = getApi().accountInformation(recvWindow);
133+
System.out.println(response.getData());
134+
```
135+
136+
### **Step 5: Check for API Differences**
137+
138+
Some function names or response structures may have changed. Refer to the modular connector's documentation for details.
139+
140+
## **Backward Compatibility**
141+
142+
- If a modular connector is **not yet available** for your use case, continue using the monolithic connector (`binance-futures-connector-java`, or `binance-connector-java`).
143+
- The monolithic connector will remain available, but it is **recommended** to migrate when modular versions are released.
144+
145+
---
146+
147+
## **FAQs**
148+
149+
### **What if my product does not have a modular connector yet?**
150+
151+
You can continue using the monolithic connector until the modular version is released.
152+
153+
### **Will the monolithic connector still receive updates?**
154+
155+
Critical bug fixes will be provided, but feature updates will focus on the modular connectors.
156+
157+
### **Where can I find more examples?**
158+
159+
Check the modular connector's documentation for detailed examples.

0 commit comments

Comments
 (0)