Skip to content

Commit 47ad69e

Browse files
committed
syncing fork
2 parents cd40338 + 1974f41 commit 47ad69e

203 files changed

Lines changed: 8534 additions & 640 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish Java Package to Maven Central
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
packages: write
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up JDK
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '11'
22+
distribution: 'temurin'
23+
cache: 'maven'
24+
server-id: ossrh
25+
server-username: OSSRH_USERNAME
26+
server-password: OSSRH_PASSWORD
27+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
28+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
29+
30+
- name: Publish to Apache Maven Central
31+
run: mvn deploy -DskipTests
32+
env:
33+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
34+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
35+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
# JAVA SDK for KuCoin API
22
The detailed document [https://docs.kucoin.com](https://docs.kucoin.com).
33

4-
[![Latest Version](https://img.shields.io/github/release/foundationer/kucoin-java-sdk.svg?style=flat-square)](https://github.com/foundationer/kucoin-java-sdk/releases)
4+
[![Latest Version](https://img.shields.io/github/release/Kucoin/kucoin-java-sdk.svg?style=flat-square)](https://github.com/Kucoin/kucoin-java-sdk/releases)
55

66
[![Build Status](https://travis-ci.org/Kucoin/kucoin-java-sdk.svg?branch=master)](https://travis-ci.org/Kucoin/kucoin-java-sdk)
77

88
## Installation
99
1. Install library into your Maven's local repository by running `mvn clean install`
1010
2. Add the following **Maven dependency** to your project's pom.xml:
1111

12-
```java
12+
```
1313
<dependency>
1414
<groupId>com.kucoin</groupId>
1515
<artifactId>kucoin-java-sdk</artifactId>
16-
<version>1.0.9</version>
16+
<version>1.0.18</version>
1717
</dependency>
1818
```
1919
## Usage
2020
### Build Client
2121
```java
22-
KucoinClientBuilder builder = new KucoinClientBuilder().withBaseUrl("https://openapi-sandbox.kucoin.com").withApiKey("YOUR_API_KEY", "YOUR_SECRET", "YOUR_PASS_PHRASE");
22+
KucoinClientBuilder builder = new KucoinClientBuilder().withBaseUrl("https://openapi-v2.kucoin.com").withApiKey("YOUR_API_KEY", "YOUR_SECRET", "YOUR_PASS_PHRASE");
2323
KucoinRestClient kucoinRestClient = builder.buildRestClient();
2424
KucoinPrivateWSClient kucoinPrivateWSClient = builder.buildPrivateWSClient();
2525
KucoinPublicWSClient kucoinPublicWSClient = builder.buildPublicWSClient();
@@ -30,7 +30,6 @@ You can use `withBaseUrl` method to change evironment.
3030
| **Environment** | **BaseUri** |
3131
| -------- | -------- |
3232
| *Production* `DEFAULT` | https://openapi-v2.kucoin.com |
33-
| *Sandbox* | https://openapi-sandbox.kucoin.com |
3433

3534
If you only need to use the public web socket client or REST client public method, you can igonre `withApiKey` method. To customize your own API implementation, you may use the `with*API` method we provided for you.
3635

pom.xml

Lines changed: 133 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,57 @@
66

77
<groupId>com.kucoin</groupId>
88
<artifactId>kucoin-java-sdk</artifactId>
9-
<version>1.0.9</version>
9+
<version>1.0.6</version>
1010

1111
<name>kucoin-java-sdk</name>
12-
<url>http://www.kucoin.com</url>
12+
<description>kucoin-java-sdk</description>
13+
<url>https://www.kucoin.com</url>
14+
15+
<licenses>
16+
<license>
17+
<name>BSD 3-Clause</name>
18+
<url>https://spdx.org/licenses/BSD-3-Clause.html</url>
19+
</license>
20+
</licenses>
21+
<scm>
22+
<connection>scm:git:git@github.com:Kucoin/kucoin-java-sdk.git</connection>
23+
<developerConnection>scm:git:git@github.com:Kucoin/kucoin-java-sdk.git</developerConnection>
24+
<url>https://github.com/Kucoin/kucoin-java-sdk</url>
25+
</scm>
26+
<developers>
27+
<developer>
28+
<name>Blaze Tan</name>
29+
<email>blaze.tan@kupotech.com</email>
30+
<roles>
31+
<role>Developer</role>
32+
</roles>
33+
<timezone>+8</timezone>
34+
</developer>
35+
<developer>
36+
<name>Jason Yao</name>
37+
<email>jason.yao@kupotech.com</email>
38+
<roles>
39+
<role>Developer</role>
40+
</roles>
41+
<timezone>+8</timezone>
42+
</developer>
43+
<developer>
44+
<name>Colt Han</name>
45+
<email>colt.han@kupotech.com</email>
46+
<roles>
47+
<role>Developer</role>
48+
</roles>
49+
<timezone>+8</timezone>
50+
</developer>
51+
</developers>
1352

1453
<properties>
1554
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1655
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
17-
<java.version>17</java.version>
56+
<java.version>1.8</java.version>
1857
<com.squareup.retrofit2.version>2.5.0</com.squareup.retrofit2.version>
1958
</properties>
2059

21-
<distributionManagement>
22-
<repository>
23-
<id>github</id>
24-
<name>GitHub Packages</name>
25-
<url>https://maven.pkg.github.com/foundationer/kucoin-java-sdk</url>
26-
</repository>
27-
</distributionManagement>
28-
2960
<dependencies>
3061
<dependency>
3162
<groupId>com.squareup.retrofit2</groupId>
@@ -52,34 +83,34 @@
5283
<dependency>
5384
<groupId>com.google.guava</groupId>
5485
<artifactId>guava</artifactId>
55-
<version>31.1-jre</version>
86+
<version>19.0</version>
5687
</dependency>
5788
<dependency>
5889
<groupId>org.projectlombok</groupId>
5990
<artifactId>lombok</artifactId>
60-
<version>1.18.26</version>
91+
<version>1.16.18</version>
6192
<scope>compile</scope>
6293
</dependency>
6394
<dependency>
6495
<groupId>org.slf4j</groupId>
6596
<artifactId>jcl-over-slf4j</artifactId>
66-
<version>1.7.25</version>
97+
<version>2.0.13</version>
6798
</dependency>
6899
<dependency>
69100
<groupId>org.slf4j</groupId>
70101
<artifactId>slf4j-simple</artifactId>
71-
<version>1.7.25</version>
102+
<version>2.0.13</version>
72103
<scope>test</scope>
73104
</dependency>
74105
<dependency>
75106
<groupId>commons-codec</groupId>
76107
<artifactId>commons-codec</artifactId>
77-
<version>1.10</version>
108+
<version>1.17.0</version>
78109
</dependency>
79110
<dependency>
80111
<groupId>org.apache.commons</groupId>
81112
<artifactId>commons-lang3</artifactId>
82-
<version>3.6</version>
113+
<version>3.14.0</version>
83114
</dependency>
84115
<dependency>
85116
<groupId>org.apache.commons</groupId>
@@ -98,6 +129,91 @@
98129
<target>${java.version}</target>
99130
</configuration>
100131
</plugin>
132+
<plugin>
133+
<groupId>org.apache.maven.plugins</groupId>
134+
<artifactId>maven-jar-plugin</artifactId>
135+
<configuration>
136+
<archive>
137+
<addMavenDescriptor>false</addMavenDescriptor>
138+
</archive>
139+
</configuration>
140+
</plugin>
141+
<plugin>
142+
<groupId>org.apache.maven.plugins</groupId>
143+
<artifactId>maven-source-plugin</artifactId>
144+
<version>2.2.1</version>
145+
<executions>
146+
<execution>
147+
<id>attach-sources</id>
148+
<goals>
149+
<goal>jar-no-fork</goal>
150+
</goals>
151+
</execution>
152+
</executions>
153+
</plugin>
154+
<plugin>
155+
<groupId>org.apache.maven.plugins</groupId>
156+
<artifactId>maven-javadoc-plugin</artifactId>
157+
<version>2.10.3</version>
158+
<executions>
159+
<execution>
160+
<id>attach-javadocs</id>
161+
<goals>
162+
<goal>jar</goal>
163+
</goals>
164+
</execution>
165+
</executions>
166+
</plugin>
167+
<plugin>
168+
<groupId>org.sonatype.plugins</groupId>
169+
<artifactId>nexus-staging-maven-plugin</artifactId>
170+
<version>1.6.7</version>
171+
<extensions>true</extensions>
172+
<configuration>
173+
<serverId>ossrh</serverId>
174+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
175+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
176+
</configuration>
177+
</plugin>
178+
<plugin>
179+
<groupId>org.apache.maven.plugins</groupId>
180+
<artifactId>maven-gpg-plugin</artifactId>
181+
<version>3.2.7</version>
182+
<executions>
183+
<execution>
184+
<id>sign-artifacts</id>
185+
<phase>verify</phase>
186+
<goals>
187+
<goal>sign</goal>
188+
</goals>
189+
<configuration>
190+
<gpgArguments>
191+
<arg>--pinentry-mode</arg>
192+
<arg>loopback</arg>
193+
</gpgArguments>
194+
</configuration>
195+
</execution>
196+
</executions>
197+
</plugin>
101198
</plugins>
102199
</build>
200+
<repositories>
201+
<repository>
202+
<id>maven_central</id>
203+
<name>Maven Central</name>
204+
<url>https://repo.maven.apache.org/maven2/</url>
205+
</repository>
206+
</repositories>
207+
208+
<distributionManagement>
209+
<snapshotRepository>
210+
<id>ossrh</id>
211+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
212+
</snapshotRepository>
213+
<repository>
214+
<id>ossrh</id>
215+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
216+
</repository>
217+
</distributionManagement>
218+
103219
</project>

src/main/java/com/kucoin/sdk/KucoinClientBuilder.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ public class KucoinClientBuilder {
6969

7070
private LoanAPI loanAPI;
7171

72+
private IsolatedAPI isolatedAPI;
73+
74+
private OcoOrderAPI ocoOrderAPI;
75+
76+
private EarnAPI earnAPI;
77+
78+
private VipLendingAPI vipLendingAPI;
79+
80+
private HFMarginAPI hfMarginAPI;
81+
7282
public KucoinRestClient buildRestClient() {
7383
if (StringUtils.isBlank(baseUrl)) baseUrl = APIConstants.API_BASE_URL;
7484
if (userAPI == null) userAPI = new UserAPIAdapter(baseUrl, apiKey, secret, passPhrase, apiKeyVersion);
@@ -80,12 +90,17 @@ public KucoinRestClient buildRestClient() {
8090
if (stopOrderAPI == null) stopOrderAPI = new StopOrderAPIAdapter(baseUrl, apiKey, secret, passPhrase, apiKeyVersion);
8191
if (marginAPI == null) marginAPI = new MarginAPIAdapter(baseUrl, apiKey, secret, passPhrase, apiKeyVersion);
8292
if (loanAPI == null) loanAPI = new LoanAPIAdapter(baseUrl, apiKey, secret, passPhrase, apiKeyVersion);
93+
if (isolatedAPI == null) isolatedAPI = new IsolatedAPIAdapter(baseUrl, apiKey, secret, passPhrase, apiKeyVersion);
8394
if (currencyAPI == null) currencyAPI = new CurrencyAPIAdaptor(baseUrl);
8495
if (timeAPI == null) timeAPI = new TimeAPIAdapter(baseUrl);
8596
if (commonAPI == null) commonAPI = new CommonAPIAdapter(baseUrl);
8697
if (symbolAPI == null) symbolAPI = new SymbolAPIAdaptor(baseUrl);
87-
if (orderBookAPI == null) orderBookAPI = new OrderBookAPIAdapter(baseUrl);
98+
if (orderBookAPI == null) orderBookAPI = new OrderBookAPIAdapter(baseUrl, apiKey, secret, passPhrase, apiKeyVersion);
8899
if (historyAPI == null) historyAPI = new HistoryAPIAdapter(baseUrl);
100+
if (ocoOrderAPI == null) ocoOrderAPI = new OcoOrderAPIAdapter(baseUrl, apiKey, secret, passPhrase, apiKeyVersion);
101+
if (earnAPI == null) earnAPI = new EarnAPIAdapter(baseUrl, apiKey, secret, passPhrase, apiKeyVersion);
102+
if (vipLendingAPI == null) vipLendingAPI = new VipLendingAdapter(baseUrl, apiKey, secret, passPhrase, apiKeyVersion);
103+
if (hfMarginAPI == null) hfMarginAPI = new HFMarginAPIAdapter(baseUrl, apiKey, secret, passPhrase, apiKeyVersion);
89104
return new KucoinRestClientImpl(this);
90105
}
91106

@@ -142,6 +157,11 @@ public KucoinClientBuilder withStopOrderAPI(StopOrderAPI stopOrderAPI) {
142157
return this;
143158
}
144159

160+
public KucoinClientBuilder withOcoOrderAPI(OcoOrderAPI ocoOrderAPI) {
161+
this.ocoOrderAPI = ocoOrderAPI;
162+
return this;
163+
}
164+
145165
public KucoinClientBuilder withWithdrawalAPI(WithdrawalAPI withdrawalAPI) {
146166
this.withdrawalAPI = withdrawalAPI;
147167
return this;

src/main/java/com/kucoin/sdk/KucoinObjectMapper.java

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

33
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
44

5+
import com.fasterxml.jackson.annotation.JsonInclude;
56
import com.fasterxml.jackson.databind.ObjectMapper;
67

78
public class KucoinObjectMapper {
@@ -10,6 +11,7 @@ public class KucoinObjectMapper {
1011

1112
static {
1213
INSTANCE = new ObjectMapper();
14+
INSTANCE.setSerializationInclusion(JsonInclude.Include.NON_NULL);
1315
INSTANCE.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
1416
}
1517

src/main/java/com/kucoin/sdk/KucoinPrivateWSClient.java

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public interface KucoinPrivateWSClient {
2020
* @param callback
2121
* @param symbols
2222
* @return The subscription UUID, or null if sending failed.
23-
* @deprecated instead use the method <code>onStopOrderChange(KucoinAPICallback<KucoinEvent<OrderChangeEvent>> callback, String... symbols)</code>
23+
* @deprecated instead use the method {@code onStopOrderChange(KucoinAPICallback<KucoinEvent<OrderChangeEvent>> callback, String... symbols)}
2424
*/
2525
@Deprecated
2626
String onOrderActivate(KucoinAPICallback<KucoinEvent<OrderActivateEvent>> callback, String... symbols);
@@ -37,10 +37,44 @@ public interface KucoinPrivateWSClient {
3737
* You will receive the message when order changes. The message contains the details of the change.
3838
*
3939
* @param callback
40-
* @param symbols
4140
* @return The subscription UUID, or null if sending failed.
4241
*/
43-
String onOrderChange(KucoinAPICallback<KucoinEvent<OrderChangeEvent>> callback, String... symbols);
42+
String onOrderChange(KucoinAPICallback<KucoinEvent<OrderChangeEvent>> callback);
43+
44+
/**
45+
* You will receive the message when order changes. The message contains the details of the change.
46+
*
47+
* @param callback
48+
* @return The subscription UUID, or null if sending failed.
49+
*/
50+
String onOrderV2Change(KucoinAPICallback<KucoinEvent<OrderChangeEvent>> callback);
51+
52+
/**
53+
* When the position status changes, a status change event will be pushed.
54+
* When there is a liability, the system will push the current liability information at regular intervals.
55+
*
56+
* @param callback
57+
* @return
58+
*/
59+
String onMarginPosition(KucoinAPICallback<KucoinEvent<MarginPositionEvent>> callback);
60+
61+
/**
62+
* Isolated Margin Position Event
63+
* <a href="https://www.kucoin.com/docs/websocket/margin-trading/private-channels/isoleted-margin-position-event">ApiDoc</a>
64+
*
65+
* @param callback callback
66+
* @return String
67+
*/
68+
String onMarginIsolatedPosition(KucoinAPICallback<KucoinEvent<MarginIsolatedPositionEvent>> callback);
69+
70+
/**
71+
* Borrowing change message push
72+
*
73+
* @param callback
74+
* @param symbol
75+
* @return
76+
*/
77+
String onMarginLoan(KucoinAPICallback<KucoinEvent<MarginLoanEvent>> callback, String symbol);
4478

4579
/**
4680
* You will receive the message when the status of advanced order changes. The message contains the details of the change.

0 commit comments

Comments
 (0)