Skip to content

Commit

Permalink
Merge pull request #4766 from bigscoop/gateio-v4
Browse files Browse the repository at this point in the history
[gateio] [gateio-streaming] Add gate.io api v4, gate.io streaming support
  • Loading branch information
timmolter authored Apr 17, 2024
2 parents e6df06a + cb2198f commit 81bb32a
Show file tree
Hide file tree
Showing 218 changed files with 7,814 additions and 667 deletions.
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 @@ -328,6 +329,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<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

0 comments on commit 81bb32a

Please sign in to comment.