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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ generate: setup-logs
$(call generate-code,python,/kucoin_universal_sdk/generate)
$(call generate-code,node,/src/generate)
$(call generate-code,php,/src/Generate,0.1.3-alpha)
$(call generate-code,java,/src/main/java/com/kucoin/universal/sdk/generate,0.1.0-alpha)
$(call generate-code,java,/src/main/java/com/kucoin/universal/sdk/generate,0.1.1-alpha)

.PHONY: gen-postman
gen-postman: preprocessor
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ npm install kucoin-universal-sdk
composer require kucoin/kucoin-universal-sdk=0.1.3-alpha
```

### Java Installation(0.1.0-alpha)
### Java Installation(0.1.1-alpha)
**Note**: This SDK is currently in the Alpha phase. We are actively iterating and improving its features, stability, and documentation. Feedback and contributions are highly encouraged to help us refine the SDK.
```bash
<dependency>
<groupId>com.kucoin</groupId>
<artifactId>kucoin-universal-sdk</artifactId>
<version>0.1.0-alpha</version>
<version>0.1.1-alpha</version>
</dependency>
```

Expand Down
5 changes: 4 additions & 1 deletion sdk/java/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ API documentation [Changelog](https://www.kucoin.com/docs-new/change-log)

Current synchronized API documentation version [20250529](https://www.kucoin.com/docs-new/change-log#20250529)

## 2025-11-04(Java 0.1.1-alpha)
- Bug fix

## 2025-07-30(Java 0.1.0-alpha)
- Release Java implementation

## 2025-06-11(PHP 0.1.3-alpha)
- Add compatibility for PHP versions from 7.4 to 8.x
- Add compatibility for PHP versions from 7.4 to 8.x

## 2025-06-11(1.3.0)
- Update the latest APIs, documentation, etc
Expand Down
4 changes: 2 additions & 2 deletions sdk/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ For an overview of the project and SDKs in other languages, refer to the [Main R

## 📦 Installation

### Latest Version: `0.1.0-alpha`
### Latest Version: `0.1.1-alpha`

**Note**: This SDK is currently in the Alpha phase. We are actively iterating and improving its features, stability, and documentation. Feedback and contributions are highly encouraged to help us refine the SDK.

```xml
<dependency>
<groupId>com.kucoin</groupId>
<artifactId>kucoin-universal-sdk</artifactId>
<version>0.1.0-alpha</version>
<version>0.1.1-alpha</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion sdk/java/example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>com.kucoin</groupId>
<artifactId>kucoin-universal-sdk</artifactId>
<version>0.1.0-alpha</version>
<version>0.1.1-alpha</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.kucoin.universal.sdk.generate.futures.futurespublic.FuturesPublicWs;
import com.kucoin.universal.sdk.generate.spot.market.GetAllSymbolsData;
import com.kucoin.universal.sdk.generate.spot.market.GetAllSymbolsReq;
import com.kucoin.universal.sdk.generate.spot.spotprivate.SpotPrivateWs;
import com.kucoin.universal.sdk.generate.spot.spotpublic.SpotPublicWs;
import com.kucoin.universal.sdk.model.ClientOption;
import com.kucoin.universal.sdk.model.Constants;
Expand Down Expand Up @@ -54,6 +55,7 @@ public static void runReconnectTest() {
.collect(Collectors.toList());

spotWsExample(wsSvc.newSpotPublicWS(), symbols);
privateWsExample(wsSvc.newSpotPrivateWS());
futuresWsExample(wsSvc.newFuturesPublicWS());

log.info("Total subscribe: 53");
Expand All @@ -77,6 +79,11 @@ public static void spotWsExample(SpotPublicWs ws, List<String> symbols) {
ws.ticker(new String[] {"BTC-USDT", "ETH-USDT"}, RunReconnectTest::noop);
}

public static void privateWsExample(SpotPrivateWs ws) {
ws.start();
ws.orderV2(RunReconnectTest::noop);
}

public static void futuresWsExample(FuturesPublicWs ws) {
ws.start();
ws.tickerV2("XBTUSDTM", RunReconnectTest::noop);
Expand Down
2 changes: 1 addition & 1 deletion sdk/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.kucoin</groupId>
<artifactId>kucoin-universal-sdk</artifactId>
<version>0.1.0-alpha</version>
<version>0.1.1-alpha</version>

<name>kucoin-universal-sdk</name>
<url>https://www.kucoin.com</url>
Expand Down
2 changes: 1 addition & 1 deletion sdk/java/script/release_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

if [[ "${USE_LOCAL,,}" == "true" ]]; then
cd /src
mvn clean install -DskipTests
mvn clean install -DskipTests -Dgpg.skip=true
echo "Local jars installed."
else
echo "USE_LOCAL is not true, skipping local jar installation."
Expand Down
2 changes: 1 addition & 1 deletion sdk/java/script/run_forever_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

if [[ "${USE_LOCAL,,}" == "true" ]]; then
cd /src
mvn clean install -DskipTests
mvn clean install -DskipTests -Dgpg.skip=true
echo "Local jars installed."
else
echo "USE_LOCAL is not true, skipping local jar installation."
Expand Down
2 changes: 1 addition & 1 deletion sdk/java/script/ws_reconnect_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

if [[ "${USE_LOCAL,,}" == "true" ]]; then
cd /src
mvn clean install -DskipTests
mvn clean install -DskipTests -Dgpg.skip=true
echo "Local jars installed."
else
echo "USE_LOCAL is not true, skipping local jar installation."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.kucoin.universal.sdk.generate;

public class Version {
public static final String SDK_VERSION = "0.1.0-alpha";
public static final String SDK_GENERATE_DATE = "2025-07-29";
public static final String SDK_VERSION = "0.1.1-alpha";
public static final String SDK_GENERATE_DATE = "2025-11-04";
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,16 @@ List<SubInfo> getSubInfo() {

for (String topic : topics) {
int idx = topic.indexOf(':');
if (idx == -1) { // no arg => treat as "all"
continue;
}
String arg = topic.substring(idx + 1);
if (!"all".equals(arg)) {
args.add(arg);
if (idx != -1) {
String arg = topic.substring(idx + 1);
if (!"all".equals(arg)) {
args.add(arg);
}
}
// pick callback from any topic (they’re identical for this id)
if (cb == null) {
Callback holder = topicCbs.get(topic);
if (holder != null) cb = holder.callback;
Callback holder = topicCbs.get(topic);
if (holder != null) {
cb = holder.callback;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.kucoin.universal.sdk.generate.spot.market.GetAllSymbolsData;
import com.kucoin.universal.sdk.generate.spot.market.GetAllSymbolsReq;
import com.kucoin.universal.sdk.generate.spot.market.GetAllSymbolsResp;
import com.kucoin.universal.sdk.generate.spot.spotprivate.OrderV2Event;
import com.kucoin.universal.sdk.generate.spot.spotprivate.SpotPrivateWs;
import com.kucoin.universal.sdk.generate.spot.spotpublic.AllTickersEvent;
import com.kucoin.universal.sdk.generate.spot.spotpublic.SpotPublicWs;
import com.kucoin.universal.sdk.generate.spot.spotpublic.TradeEvent;
Expand Down Expand Up @@ -184,4 +186,45 @@ public void testReconnect2() throws Exception {
Thread.sleep(1000 * 12000);
spotPublicWs.stop();
}

@Test
public void testReconnect3() throws Exception {
String key = System.getenv("API_KEY");
String secret = System.getenv("API_SECRET");
String passphrase = System.getenv("API_PASSPHRASE");

AtomicInteger atomicInteger = new AtomicInteger();

ClientOption clientOpt =
ClientOption.builder()
.key(key)
.secret(secret)
.passphrase(passphrase)
.spotEndpoint(Constants.GLOBAL_API_ENDPOINT)
.futuresEndpoint(Constants.GLOBAL_FUTURES_API_ENDPOINT)
.brokerEndpoint(Constants.GLOBAL_BROKER_API_ENDPOINT)
.transportOption(TransportOption.defaults())
.websocketClientOption(
WebSocketClientOption.builder()
.eventCallback(
((event, message) -> {
atomicInteger.incrementAndGet();
log.info("Event: {}, {}", event, message);
}))
.build())
.build();

KucoinClient kucoinClient = new DefaultKucoinClient(clientOpt);

SpotPrivateWs spotPrivateWs = kucoinClient.getWsService().newSpotPrivateWS();
spotPrivateWs.start();

spotPrivateWs.orderV2(
(String topic, String subject, OrderV2Event data) -> {
log.info("OrderV2: {}, {}, {}", topic, subject, data);
});

Thread.sleep(1000 * 12000);
spotPrivateWs.stop();
}
}