|
| 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 `open` 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 | + |
0 commit comments