Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gateio] [gateio-streaming] Add gate.io api v4, gate.io streaming support #4766

Merged
merged 155 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 152 commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
d2b171f
[core] Code cleanup
bigscoop Mar 22, 2023
738316a
[general] Change the scope of lombok to provided
bigscoop Mar 23, 2023
300ae5a
Merge branch 'develop' into code-cleanup
bigscoop Mar 23, 2023
bbe29e7
[general] Code cleanup
bigscoop Mar 24, 2023
67f4bae
Merge commit '1a9e577670' into code-cleanup
bigscoop Apr 15, 2023
2b93b7d
Merge remote-tracking branch 'github/develop' into code-cleanup
bigscoop Apr 15, 2023
75d3e6d
Merge remote-tracking branch 'github/develop' into develop
bigscoop May 9, 2023
ccf8467
Replace constructors in DefaultWithdrawFundsParams with according bui…
bigscoop May 11, 2023
cab5df2
Merge branch 'add-builder-to-DefaultWithdrawFundsParams-MR' into develop
bigscoop May 11, 2023
5abd58c
Change pom versions
bigscoop May 11, 2023
027a711
Merge remote-tracking branch 'github/develop' into develop-fork
bigscoop May 20, 2023
9691eec
Merge branch 'gateio-refactoring' into develop-fork
bigscoop May 20, 2023
e759200
[gateio-v4] Create module skeleton
bigscoop May 20, 2023
6a0994f
[gateio-v4] Disable wiremock recording
bigscoop May 20, 2023
9d78d04
[gateio-v4] Add sortpom plugin
bigscoop May 21, 2023
aa3d791
[gateio-v4] Add getWithdrawalStatus endpoint
bigscoop May 21, 2023
d1bf544
[gateio-v4] Add getWithdrawalStatus endpoint
bigscoop May 21, 2023
a100619
[gateio-v4] Update withdraw/deposit enabled status
bigscoop May 28, 2023
5a666ca
[core] Add support for junit 5
bigscoop May 29, 2023
fb1f6ef
Merge branch 'introduce-junit5' into develop-fork
bigscoop May 29, 2023
c337863
Merge branch 'develop-fork' into gateio-v4
bigscoop May 29, 2023
e91b5bf
[core] Add support for junit 5
bigscoop May 29, 2023
82a0a8c
[core] Fix wrong parent version
bigscoop May 29, 2023
f642e66
[gateio-v4] Add error adapter, migrate to junit 5, add tests
bigscoop May 29, 2023
6db270a
[gateio-v4] Add getAccountInfo
bigscoop May 29, 2023
4c32e02
[gateio-v4] Add error mapping
bigscoop May 29, 2023
c97ea0b
[gateio-v4] Add more endpoints, refactor
bigscoop May 31, 2023
34b72d3
[gateio-v4] Add getting deposit address
bigscoop May 31, 2023
5408d88
[core] Set code level to java 11
bigscoop Jun 3, 2023
93d615e
Merge branch 'introduce-junit5' into gateio-v4
bigscoop Jun 3, 2023
768df22
[gateio-v4] Add getting orders list
bigscoop Jun 3, 2023
67dc03e
[gateio-v4] Add placing of market order
bigscoop Jun 3, 2023
eb2ffbe
[gateio-v4] Fix wiremocks
bigscoop Jun 3, 2023
a5fdf58
[gateio-v4] Add order endpoints
bigscoop Jun 3, 2023
50d8775
[gateio-v4] Add orders to TradeService
bigscoop Jun 3, 2023
f40f459
[gateio-v4] Add orders to TradeService
bigscoop Jun 4, 2023
f978df6
[gateio-v4] Add withdrawing funds
bigscoop Jun 4, 2023
3018115
[gateio-v4] Add withdrawing funds
bigscoop Jun 4, 2023
91b226c
Merge remote-tracking branch 'origin/gateio-v4' into gateio-v4
bigscoop Jun 4, 2023
d2e3410
[gateio-v4] Add saved addresses
bigscoop Jun 4, 2023
5c69cc8
[gateio-v4] Code cleanup
bigscoop Jun 5, 2023
4ea1914
[gateio-v4] Add request for idea http client
bigscoop Jun 6, 2023
4835ebe
[gateio-v4] Fix tests
bigscoop Jun 7, 2023
5a09f21
[kucoin] Extend kucoin support
bigscoop Jun 7, 2023
920af34
Merge branch 'kucoin-extend' into gateio-v4
bigscoop Jun 7, 2023
daa2cd0
[core] Make AddressWithTag writable
bigscoop Jun 7, 2023
abead83
[gateio-v4] Code cleanup
bigscoop Jun 8, 2023
0de634b
[gateio-v4] Code cleanup
bigscoop Jun 8, 2023
e5f7d80
[gateio-v4] Map rate limit exception
bigscoop Jun 11, 2023
92c2d20
Merge remote-tracking branch 'github/develop' into develop-fork
bigscoop Jun 11, 2023
6139c44
Merge branch 'develop-fork' into gateio-v4
bigscoop Jun 11, 2023
5ed7349
[gateio-v4] Code cleanup
bigscoop Jun 11, 2023
0835196
[gateio-v4] Add more error mappings
bigscoop Jun 12, 2023
864b00e
[gateio-v4] Update http requests
bigscoop Jun 12, 2023
909d159
[gateio-v4] Code cleanup
bigscoop Jun 12, 2023
bf6eaed
[gateio-v4] Add tickers endpoint
bigscoop Jun 12, 2023
90499c0
[gateio-v4] Code cleanup
bigscoop Jun 12, 2023
118558a
[gateio-v4] Add mapping of HTTP 500
bigscoop Jun 29, 2023
a6b049a
[gateio-v4] Implement limit orders
bigscoop Jul 27, 2023
94b995b
[core] Revert version to snapshot
bigscoop Jul 31, 2023
7485407
[core] Revert version to snapshot
bigscoop Jul 31, 2023
4c2540b
Merge github/develop
bigscoop Jul 31, 2023
abb60fd
[core] Change version
bigscoop Jul 31, 2023
658ac94
[core] Merge develop-fork
bigscoop Jul 31, 2023
4e27207
[gateio-v4] Extend tests
bigscoop Aug 2, 2023
3af754f
[core] Add order cancelling
bigscoop Aug 2, 2023
0208faa
[gateio-v4] Add price mapping for limit orders
bigscoop Aug 3, 2023
93d0b2d
[gateio-stream] Code cleanup, organize packages
bigscoop Aug 6, 2023
6319994
[gateio-stream] Code cleanup
bigscoop Aug 6, 2023
87b4c4b
[gateio-streaming] Add test for oder book
bigscoop Aug 9, 2023
f2a4e44
[gateio-streaming] Add test for trades
bigscoop Aug 9, 2023
36e96f7
[gateio-streaming] Remove unneeded ProductSubscription at connect
bigscoop Aug 9, 2023
d78b2ee
[gateio-streaming] Add ticker stream
bigscoop Aug 9, 2023
e90938f
[gateio-streaming] Refactor
bigscoop Aug 9, 2023
b813af2
[gateio-streaming] Improve processing of control events
bigscoop Aug 10, 2023
2a4487a
[gateio-streaming] Add deserialization based on channel
bigscoop Aug 10, 2023
ab3c4c7
[gateio-streaming] Add enum for event
bigscoop Aug 10, 2023
7770724
[gateio-streaming] Add suffix to message
bigscoop Aug 10, 2023
e4e9659
[gateio-streaming] Add lombok annotation
bigscoop Aug 10, 2023
3801e5e
[gateio-streaming] Refactor streaming service to accept gate-specific…
bigscoop Aug 10, 2023
8679f56
[gateio-v4] Fix passing of parameters
bigscoop Aug 10, 2023
d268f6b
[gateio-v4] Fix passing of parameters
bigscoop Aug 10, 2023
cd4d5e7
[gateio-v4] Fix parsing to instant
bigscoop Aug 10, 2023
a9a0d83
[gateio-streaming] Add user trades
bigscoop Aug 10, 2023
8345a62
[gateio-streaming] Extend test
bigscoop Aug 10, 2023
a3c4dee
[gateio-streaming] Add idea rest client files
bigscoop Aug 10, 2023
10b29d9
[gateio-v4] Add empty payload to subscribe messages
bigscoop Aug 10, 2023
f914ed5
[gateio-streaming] Add balance changes
bigscoop Aug 10, 2023
945a9eb
[gateio-streaming] Refactor config
bigscoop Aug 11, 2023
c29ae9b
[gateio-streaming] Add clock, IdGenerator, archunit test
bigscoop Aug 11, 2023
d6efa05
[gateio-streaming] Add unit tests for Market data
bigscoop Aug 11, 2023
7d22acf
[gateio-streaming] Code cleanup
bigscoop Aug 11, 2023
8341dd1
[gateio-streaming] Add unit tests
bigscoop Aug 11, 2023
00296b8
[gateio-v4] Add test for digest
bigscoop Aug 11, 2023
6ac9d2f
[gateio-streaming] Add getting currency/currencypairs
bigscoop Aug 11, 2023
58c1685
[gateio-v4] Implement user trades
bigscoop Aug 11, 2023
d8239e2
[gateio-v4] Implement history of sub-account transfers
bigscoop Aug 11, 2023
38dbf0b
[gateio-v4] Extend parameters for withdrawals history
bigscoop Aug 11, 2023
606a570
[gateio-v4] Add StringToCurrencyConverter
bigscoop Aug 11, 2023
82c3043
[gateio-v4] Implement deposits history
bigscoop Aug 11, 2023
b08a34c
[gateio-v4] Parse payload as Currency
bigscoop Aug 11, 2023
613c73f
[gateio-v4] Rename class
bigscoop Aug 12, 2023
c0e43ee
[gateio-v4] Implement account book and funding history
bigscoop Aug 12, 2023
d988b35
Merge branch 'gateio-streaming' into gateio-v4
bigscoop Aug 12, 2023
b1a25cc
[gateio-v4] Add converters between CurrencyPair and String
bigscoop Aug 12, 2023
ca2f8a6
[gateio-v4] Add enum for deposit record status
bigscoop Aug 12, 2023
38e2147
[gateio-v4] Improve type parsing of FundingRecord
bigscoop Aug 13, 2023
d5669b0
[gateio-v4] Improve type parsing
bigscoop Aug 13, 2023
0c3e774
[gateio-v4] Move converters to separate package
bigscoop Aug 13, 2023
0e1fe8f
[gateio-streaming] Move converters to separate package
bigscoop Aug 13, 2023
706b4c5
[gateio-streaming] Reference converters from xchange-gateio-v4
bigscoop Aug 13, 2023
c2c16a4
[gateio-streaming] Rename classes
bigscoop Aug 13, 2023
f1171dd
[gateio-streaming] Extract signature script
bigscoop Aug 13, 2023
dead07b
Revert version
bigscoop Aug 13, 2023
10e3e4e
Revert version
bigscoop Aug 13, 2023
57e70f7
Revert code style to java 8
bigscoop Aug 13, 2023
dcc8d9f
Merge remote-tracking branch 'github/develop' into gateio-v4
bigscoop Aug 13, 2023
0119ea4
Revert "[kucoin] Extend kucoin support"
bigscoop Aug 13, 2023
37a2765
Revert "Replace constructors in DefaultWithdrawFundsParams with accor…
bigscoop Aug 13, 2023
7f67aef
Remove unrelated changes
bigscoop Aug 13, 2023
23a0962
Merge develop branch
bigscoop Aug 13, 2023
3133061
Merge branch 'knowm-develop' into gateio-v4
bigscoop Aug 13, 2023
dd2300e
[gateio-v4] Add error mapping
bigscoop Aug 14, 2023
7f2441a
[core] Add mvn wrapper files to .gitignore
bigscoop Aug 15, 2023
b997c03
[gateio-v4] Add raw data for user trades
bigscoop Aug 16, 2023
ac2a90c
[gateio-v4] Add role field to user trade
bigscoop Aug 16, 2023
958bd75
[gateio-v4] Fix string representation of child classes
bigscoop Aug 16, 2023
1446687
[gateio-v4] Add getting all pages
bigscoop Aug 16, 2023
f3411f3
[gateio-v4] Add enum for withdrawal status
bigscoop Aug 17, 2023
f140cf2
[gateio-v4] Fix wrong query param
bigscoop Aug 17, 2023
46ed4e1
[gateio-streaming] Add enums for side and role
bigscoop Aug 17, 2023
ccb2e5c
[gateio-v4] Add config for custom RestProxyFactory with example
bigscoop Aug 17, 2023
917162c
[gateio-v4] Fix method visibility
bigscoop Aug 23, 2023
6ebe462
[gateio-v4] Add constructors
bigscoop Aug 23, 2023
3e8c11b
[gateio-streaming] Fix default specification
bigscoop Aug 24, 2023
600875b
[gateio-streaming] Code cleanup
bigscoop Aug 24, 2023
c0b58cc
[gateio-streaming] Fix wrong order side mapping
bigscoop Aug 29, 2023
3fcbe72
[gateio-v4] Add RestProxyFactory to authenticated client
bigscoop Aug 29, 2023
45f41cc
[gateio-v4] Pom housekeeping
bigscoop Sep 6, 2023
c894035
[gateio-v4] Pom housekeeping
bigscoop Sep 6, 2023
9895f1b
[gateio-v4] Add exception mapping
bigscoop Oct 15, 2023
9400af4
[gateio-v4] Extend api
bigscoop Oct 26, 2023
2bc4db1
[gateio-v4] Add Currency deserializer
bigscoop Oct 26, 2023
71c9f57
[gateio-v4] Fix amount mapping for sell orders
bigscoop Nov 2, 2023
0e77fae
Merge remote-tracking branch 'github/develop' into gateio-v4
bigscoop Nov 13, 2023
c426a3b
Merge remote-tracking branch 'github/develop' into gateio-v4
bigscoop Dec 1, 2023
a3512a6
[gateio-v4] Merge develop branch
bigscoop Dec 1, 2023
2fdd1a6
[gateio-v4] Merge develop branch
bigscoop Dec 1, 2023
b94c532
Merge remote-tracking branch 'github/develop' into gateio-v4
bigscoop Dec 7, 2023
849c71d
[gateio-v4] Add error mapping
bigscoop Dec 8, 2023
b53e3df
Merge remote-tracking branch 'github/develop' into gateio-v4
bigscoop Jan 26, 2024
8201b1d
[gateio-v4] Disable test with example code
bigscoop Jan 26, 2024
bd48331
Merge remote-tracking branch 'github/develop' into gateio-v4
bigscoop Feb 21, 2024
6ed9321
Merge remote-tracking branch 'github/develop' into gateio-v4
bigscoop Apr 15, 2024
cb2198f
Merge remote-tracking branch 'github/develop' into gateio-v4
bigscoop Apr 16, 2024
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ bin/
log/
classes/

# maven wrapper
.mvn
mvnw
mvnw.cmd


# Misc.
.DS_Store
*.swp
Expand Down
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
<module>xchange-examples</module>
<module>xchange-ftx</module>
<module>xchange-gateio</module>
<module>xchange-gateio-v4</module>
<module>xchange-globitex</module>
<module>xchange-gemini</module>
<module>xchange-hitbtc</module>
Expand Down Expand Up @@ -327,6 +328,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
bigscoop marked this conversation as resolved.
Show resolved Hide resolved
<version>${version.junit}</version>
<scope>test</scope>
</dependency>

<!-- SLF4J implementation for use in examples -->
<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import java.math.BigDecimal;
import lombok.Value;
import lombok.experimental.NonFinal;
import lombok.experimental.SuperBuilder;
import org.knowm.xchange.currency.Currency;
import org.knowm.xchange.dto.account.AddressWithTag;

@Value
@NonFinal
@SuperBuilder
public class DefaultWithdrawFundsParams implements WithdrawFundsParams {

String address;
Expand Down
1 change: 1 addition & 0 deletions xchange-gateio-v4/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http-client.private.env.json
8 changes: 8 additions & 0 deletions xchange-gateio-v4/api-specification.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Gate.io Exchange API V4 specification
================================

Public API

Documentation
-------------
https://www.gate.io/docs/developers/apiv4
6 changes: 6 additions & 0 deletions xchange-gateio-v4/example.http-client.private.env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"default": {
"api_key": "replace_me",
"api_secret": "replace_me"
}
}
5 changes: 5 additions & 0 deletions xchange-gateio-v4/http-client.env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"default": {
"api_v4": "https://api.gateio.ws/api/v4"
}
}
2 changes: 2 additions & 0 deletions xchange-gateio-v4/lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lombok.equalsAndHashCode.callSuper = call
lombok.tostring.callsuper = call
130 changes: 130 additions & 0 deletions xchange-gateio-v4/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.knowm.xchange</groupId>
<artifactId>xchange-parent</artifactId>
<version>5.1.2-SNAPSHOT</version>
</parent>

<artifactId>xchange-gateio-v4</artifactId>

<name>XChange Gate.io V4</name>
<description>XChange implementation for the Gate.io Exchange</description>

<properties>
<version.maven-enforcer-plugin>3.2.1</version.maven-enforcer-plugin>
<version.mockito>5.3.1</version.mockito>
<version.sortpom-maven-plugin>3.2.0</version.sortpom-maven-plugin>
</properties>

<dependencies>

<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${version.fasterxml}</version>
</dependency>

<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-ratelimiter</artifactId>
<version>${version.resilience4j}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-retry</artifactId>
<version>${version.resilience4j}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.knowm.xchange</groupId>
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${version.mockito}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>${version.sortpom-maven-plugin}</version>
<configuration>
<sortProperties>true</sortProperties>
<createBackupFile>false</createBackupFile>
<sortDependencies>groupId,artifactId</sortDependencies>
<sortModules>true</sortModules>
<nrOfIndentSpace>4</nrOfIndentSpace>
<sortPlugins>groupId,artifactId</sortPlugins>
<expandEmptyElements>false</expandEmptyElements>
</configuration>
<executions>
<execution>
<goals>
<goal>sort</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${version.maven-enforcer-plugin}</version>
<executions>
<execution>
<id>enforce</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<dependencyConvergence/>
<banDuplicatePomDependencyVersions/>
<reactorModuleConvergence/>
</rules>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package org.knowm.xchange.gateio;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import org.knowm.xchange.gateio.dto.GateioException;
import org.knowm.xchange.gateio.dto.marketdata.*;

import java.io.IOException;
import java.util.List;

@Path("api/v4")
@Produces(MediaType.APPLICATION_JSON)
public interface Gateio {

@GET
@Path("spot/currencies")
List<GateioCurrencyInfo> getCurrencies() throws IOException, GateioException;


@GET
@Path("spot/order_book")
GateioOrderBook getOrderBook(
@QueryParam("currency_pair") String currencyPair,
@QueryParam("with_id") Boolean withId
) throws IOException, GateioException;


@GET
@Path("wallet/currency_chains")
List<GateioCurrencyChain> getCurrencyChains(@QueryParam("currency") String currency) throws IOException, GateioException;


@GET
@Path("spot/currency_pairs")
List<GateioCurrencyPairDetails> getCurrencyPairDetails() throws IOException, GateioException;


@GET
@Path("spot/currency_pairs/{currency_pair}")
GateioCurrencyPairDetails getCurrencyPairDetails(@PathParam("currency_pair") String currencyPair) throws IOException, GateioException;


@GET
@Path("spot/tickers")
List<GateioTicker> getTickers(@QueryParam("currency_pair") String currencyPair) throws IOException, GateioException;


}
Loading
Loading