Skip to content

Commit 529b2f0

Browse files
committed
initial commit
0 parents  commit 529b2f0

49 files changed

Lines changed: 10442 additions & 0 deletions

Some content is hidden

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

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
11+
# exclude jar for gradle wrapper
12+
!gradle/wrapper/*.jar
13+
14+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
15+
hs_err_pid*
16+
17+
# build files
18+
**/target
19+
target
20+
.gradle
21+
build

.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.3.1

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Generated by: https://openapi-generator.tech
3+
#
4+
language: java
5+
jdk:
6+
- oraclejdk8
7+
- oraclejdk7
8+
before_install:
9+
# ensure gradlew has proper permission
10+
- chmod a+x ./gradlew
11+
script:
12+
# test using maven
13+
- mvn test
14+
# uncomment below to test using gradle
15+
# - gradle test
16+
# uncomment below to test using sbt
17+
# - sbt test

README.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# gate-client
2+
3+
Gate API v4
4+
- API version: 1.0.0
5+
6+
APIv4 futures provides all sorts of futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf.
7+
8+
For more information, please visit [https://gate.io/page/contacts](https://gate.io/page/contacts)
9+
10+
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
11+
12+
13+
## Requirements
14+
15+
Building the API client library requires:
16+
1. Java 1.8+
17+
2. Maven/Gradle
18+
19+
## Installation
20+
21+
To install the API client library to your local Maven repository, simply execute:
22+
23+
```shell
24+
mvn clean install
25+
```
26+
27+
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
28+
29+
```shell
30+
mvn clean deploy
31+
```
32+
33+
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
34+
35+
### Maven users
36+
37+
Add this dependency to your project's POM:
38+
39+
```xml
40+
<dependency>
41+
<groupId>io.gate</groupId>
42+
<artifactId>gate-client</artifactId>
43+
<version>1.0.0</version>
44+
<scope>compile</scope>
45+
</dependency>
46+
```
47+
48+
### Gradle users
49+
50+
Add this dependency to your project's build file:
51+
52+
```groovy
53+
compile "io.gate:gate-client:1.0.0"
54+
```
55+
56+
### Others
57+
58+
At first generate the JAR by executing:
59+
60+
```shell
61+
mvn clean package
62+
```
63+
64+
Then manually install the following JARs:
65+
66+
* `target/gate-client-1.0.0.jar`
67+
* `target/lib/*.jar`
68+
69+
## Getting Started
70+
71+
Please follow the [installation](#installation) instruction and execute the following Java code:
72+
73+
```java
74+
75+
import io.gate.gateclient.*;
76+
import io.gate.gateclient.auth.*;
77+
import io.gate.gateclient.models.*;
78+
import io.gate.gateclient.api.FuturesApi;
79+
80+
import java.io.File;
81+
import java.util.*;
82+
83+
public class FuturesApiExample {
84+
85+
public static void main(String[] args) {
86+
ApiClient defaultClient = Configuration.getDefaultApiClient();
87+
88+
// Configure API key authorization: api_key
89+
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
90+
api_key.setApiKey("YOUR API KEY");
91+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
92+
//api_key.setApiKeyPrefix("Token");
93+
94+
// Configure API key authorization: api_sign
95+
ApiKeyAuth api_sign = (ApiKeyAuth) defaultClient.getAuthentication("api_sign");
96+
api_sign.setApiKey("YOUR API KEY");
97+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
98+
//api_sign.setApiKeyPrefix("Token");
99+
100+
// Configure API key authorization: api_timestamp
101+
ApiKeyAuth api_timestamp = (ApiKeyAuth) defaultClient.getAuthentication("api_timestamp");
102+
api_timestamp.setApiKey("YOUR API KEY");
103+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
104+
//api_timestamp.setApiKeyPrefix("Token");
105+
106+
FuturesApi apiInstance = new FuturesApi();
107+
String orderId = "orderId_example"; // String | order id
108+
try {
109+
apiInstance.cancelOrder(orderId);
110+
} catch (ApiException e) {
111+
System.err.println("Exception when calling FuturesApi#cancelOrder");
112+
e.printStackTrace();
113+
}
114+
}
115+
}
116+
117+
```
118+
119+
## Documentation for API Endpoints
120+
121+
All URIs are relative to *https://fx-api.gateio.io/api/v4*
122+
123+
Class | Method | HTTP request | Description
124+
------------ | ------------- | ------------- | -------------
125+
*FuturesApi* | [**cancelOrder**](docs/FuturesApi.md#cancelOrder) | **DELETE** /futures/orders/{order_id} | Cancel a single order
126+
*FuturesApi* | [**cancelOrders**](docs/FuturesApi.md#cancelOrders) | **DELETE** /futures/orders | Cancel all &#x60;open&#x60; orders matched
127+
*FuturesApi* | [**createOrder**](docs/FuturesApi.md#createOrder) | **POST** /futures/orders | Create a futures order
128+
*FuturesApi* | [**getMyTrades**](docs/FuturesApi.md#getMyTrades) | **GET** /futures/my_trades | List personal trading history
129+
*FuturesApi* | [**getOrder**](docs/FuturesApi.md#getOrder) | **GET** /futures/orders/{order_id} | Get a single order
130+
*FuturesApi* | [**listFuturesAccounts**](docs/FuturesApi.md#listFuturesAccounts) | **GET** /futures/accounts | Query futures account
131+
*FuturesApi* | [**listFuturesCandlesticks**](docs/FuturesApi.md#listFuturesCandlesticks) | **GET** /futures/candlesticks | Get futures candlesticks
132+
*FuturesApi* | [**listFuturesContracts**](docs/FuturesApi.md#listFuturesContracts) | **GET** /futures/contracts | List all futures contracts
133+
*FuturesApi* | [**listFuturesFundingRateHistory**](docs/FuturesApi.md#listFuturesFundingRateHistory) | **GET** /futures/funding_rate | Funding rate history
134+
*FuturesApi* | [**listFuturesInsuranceLedger**](docs/FuturesApi.md#listFuturesInsuranceLedger) | **GET** /futures/insurance | Futures insurance balance history
135+
*FuturesApi* | [**listFuturesOrderBook**](docs/FuturesApi.md#listFuturesOrderBook) | **GET** /futures/order_book | Futures order book
136+
*FuturesApi* | [**listFuturesTickers**](docs/FuturesApi.md#listFuturesTickers) | **GET** /futures/tickers | List futures tickers
137+
*FuturesApi* | [**listFuturesTrades**](docs/FuturesApi.md#listFuturesTrades) | **GET** /futures/trades | Futures trading history
138+
*FuturesApi* | [**listOrders**](docs/FuturesApi.md#listOrders) | **GET** /futures/orders | List futures orders
139+
*FuturesApi* | [**listPositions**](docs/FuturesApi.md#listPositions) | **GET** /futures/positions | List all positions
140+
*FuturesApi* | [**updatePositionLeverage**](docs/FuturesApi.md#updatePositionLeverage) | **POST** /futures/positions/{contract}/leverage | Update position leverage
141+
*FuturesApi* | [**updatePositionMargin**](docs/FuturesApi.md#updatePositionMargin) | **POST** /futures/positions/{contract}/margin | Update position margin
142+
*FuturesApi* | [**updatePositionRiskLimit**](docs/FuturesApi.md#updatePositionRiskLimit) | **POST** /futures/positions/{contract}/risk_limit | Update poisition risk limit
143+
144+
145+
## Documentation for Models
146+
147+
- [Contract](docs/Contract.md)
148+
- [FundingRateRecord](docs/FundingRateRecord.md)
149+
- [FuturesAccount](docs/FuturesAccount.md)
150+
- [FuturesCandlestick](docs/FuturesCandlestick.md)
151+
- [FuturesErrorResponse](docs/FuturesErrorResponse.md)
152+
- [FuturesOrder](docs/FuturesOrder.md)
153+
- [FuturesOrderBook](docs/FuturesOrderBook.md)
154+
- [FuturesOrderBookItem](docs/FuturesOrderBookItem.md)
155+
- [FuturesTicker](docs/FuturesTicker.md)
156+
- [FuturesTrade](docs/FuturesTrade.md)
157+
- [InsuranceRecord](docs/InsuranceRecord.md)
158+
- [MyFuturesTrade](docs/MyFuturesTrade.md)
159+
- [Position](docs/Position.md)
160+
161+
162+
## Documentation for Authorization
163+
164+
Authentication schemes defined for the API:
165+
### api_key
166+
167+
- **Type**: API key
168+
- **API key parameter name**: KEY
169+
- **Location**: HTTP header
170+
171+
### api_sign
172+
173+
- **Type**: API key
174+
- **API key parameter name**: SIGN
175+
- **Location**: HTTP header
176+
177+
### api_timestamp
178+
179+
- **Type**: API key
180+
- **API key parameter name**: Timestamp
181+
- **Location**: HTTP header
182+
183+
184+
## Recommendation
185+
186+
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
187+
188+
## Author
189+
190+
support@mail.gate.io
191+

build.gradle

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
apply plugin: 'idea'
2+
apply plugin: 'eclipse'
3+
4+
group = 'io.gate'
5+
version = '1.0.0'
6+
7+
buildscript {
8+
repositories {
9+
jcenter()
10+
}
11+
dependencies {
12+
classpath 'com.android.tools.build:gradle:2.3.+'
13+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
14+
}
15+
}
16+
17+
repositories {
18+
jcenter()
19+
}
20+
21+
22+
if(hasProperty('target') && target == 'android') {
23+
24+
apply plugin: 'com.android.library'
25+
apply plugin: 'com.github.dcendents.android-maven'
26+
27+
android {
28+
compileSdkVersion 25
29+
buildToolsVersion '25.0.2'
30+
defaultConfig {
31+
minSdkVersion 14
32+
targetSdkVersion 25
33+
}
34+
compileOptions {
35+
sourceCompatibility JavaVersion.VERSION_1_8
36+
targetCompatibility JavaVersion.VERSION_1_8
37+
}
38+
39+
// Rename the aar correctly
40+
libraryVariants.all { variant ->
41+
variant.outputs.each { output ->
42+
def outputFile = output.outputFile
43+
if (outputFile != null && outputFile.name.endsWith('.aar')) {
44+
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
45+
output.outputFile = new File(outputFile.parent, fileName)
46+
}
47+
}
48+
}
49+
50+
dependencies {
51+
provided 'javax.annotation:jsr250-api:1.0'
52+
}
53+
}
54+
55+
afterEvaluate {
56+
android.libraryVariants.all { variant ->
57+
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
58+
task.description = "Create jar artifact for ${variant.name}"
59+
task.dependsOn variant.javaCompile
60+
task.from variant.javaCompile.destinationDir
61+
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
62+
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
63+
artifacts.add('archives', task);
64+
}
65+
}
66+
67+
task sourcesJar(type: Jar) {
68+
from android.sourceSets.main.java.srcDirs
69+
classifier = 'sources'
70+
}
71+
72+
artifacts {
73+
archives sourcesJar
74+
}
75+
76+
} else {
77+
78+
apply plugin: 'java'
79+
apply plugin: 'maven'
80+
81+
sourceCompatibility = JavaVersion.VERSION_1_8
82+
targetCompatibility = JavaVersion.VERSION_1_8
83+
84+
install {
85+
repositories.mavenInstaller {
86+
pom.artifactId = 'gate-client'
87+
}
88+
}
89+
90+
task execute(type:JavaExec) {
91+
main = System.getProperty('mainClass')
92+
classpath = sourceSets.main.runtimeClasspath
93+
}
94+
}
95+
96+
dependencies {
97+
compile 'io.swagger:swagger-annotations:1.5.17'
98+
compile 'com.squareup.okhttp:okhttp:2.7.5'
99+
compile 'com.squareup.okhttp:logging-interceptor:2.7.5'
100+
compile 'com.google.code.gson:gson:2.8.1'
101+
compile 'io.gsonfire:gson-fire:1.8.0'
102+
compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1'
103+
testCompile 'junit:junit:4.12'
104+
}

build.sbt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
lazy val root = (project in file(".")).
2+
settings(
3+
organization := "io.gate",
4+
name := "gate-client",
5+
version := "1.0.0",
6+
scalaVersion := "2.11.4",
7+
scalacOptions ++= Seq("-feature"),
8+
javacOptions in compile ++= Seq("-Xlint:deprecation"),
9+
publishArtifact in (Compile, packageDoc) := false,
10+
resolvers += Resolver.mavenLocal,
11+
libraryDependencies ++= Seq(
12+
"io.swagger" % "swagger-annotations" % "1.5.17",
13+
"com.squareup.okhttp" % "okhttp" % "2.7.5",
14+
"com.squareup.okhttp" % "logging-interceptor" % "2.7.5",
15+
"com.google.code.gson" % "gson" % "2.8.1",
16+
"io.gsonfire" % "gson-fire" % "1.8.0" % "compile",
17+
"junit" % "junit" % "4.12" % "test",
18+
"com.novocode" % "junit-interface" % "0.10" % "test"
19+
)
20+
)

0 commit comments

Comments
 (0)