Gate API v4
- API version: 1.2.1
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.
For more information, please visit https://gate.io/page/contacts
Automatically generated by the OpenAPI Generator
Building the API client library requires:
- Java 1.8+
- Maven/Gradle
To install the API client library to your local Maven repository, simply execute:
mvn clean installTo deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn clean deployRefer to the OSSRH Guide for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>io.gate</groupId>
<artifactId>gate-api</artifactId>
<version>1.2.1</version>
<scope>compile</scope>
</dependency>Add this dependency to your project's build file:
compile "io.gate:gate-api:1.2.1"At first generate the JAR by executing:
mvn clean packageThen manually install the following JARs:
target/gate-api-1.2.1.jartarget/lib/*.jar
Please follow the installation instruction and execute the following Java code:
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
import java.io.File;
import java.util.*;
public class FuturesApiExample {
public static void main(String[] args) {
ApiClient client = new ApiClient("YOUR_API_KEY", "YOUR_API_SECRET");
// uncomment the next line if testing the API with other host
// apiClient.setBasePath("https://some-other-host");
FuturesApi apiInstance = new FuturesApi(client);
String orderId = "12345"; // String | ID returned on order successfully being created
try {
FuturesOrder result = apiInstance.cancelOrder(orderId);
System.out.println(result);
} catch (ApiException e) {
System.err.println(e.getResponseBody());
e.printStackTrace();
}
}
}All URIs are relative to https://fx-api.gateio.io/api/v4
| Class | Method | HTTP request | Description |
|---|---|---|---|
| FuturesApi | cancelOrder | DELETE /futures/orders/{order_id} | Cancel a single order |
| FuturesApi | cancelOrders | DELETE /futures/orders | Cancel all `open` orders matched |
| FuturesApi | createOrder | POST /futures/orders | Create a futures order |
| FuturesApi | getFuturesContract | GET /futures/contracts/{contract} | Get a single contract |
| FuturesApi | getMyTrades | GET /futures/my_trades | List personal trading history |
| FuturesApi | getOrder | GET /futures/orders/{order_id} | Get a single order |
| FuturesApi | getPosition | GET /futures/positions/{contract} | Get single position |
| FuturesApi | listFuturesAccountBook | GET /futures/account_book | Query account book |
| FuturesApi | listFuturesAccounts | GET /futures/accounts | Query futures account |
| FuturesApi | listFuturesCandlesticks | GET /futures/candlesticks | Get futures candlesticks |
| FuturesApi | listFuturesContracts | GET /futures/contracts | List all futures contracts |
| FuturesApi | listFuturesFundingRateHistory | GET /futures/funding_rate | Funding rate history |
| FuturesApi | listFuturesInsuranceLedger | GET /futures/insurance | Futures insurance balance history |
| FuturesApi | listFuturesOrderBook | GET /futures/order_book | Futures order book |
| FuturesApi | listFuturesTickers | GET /futures/tickers | List futures tickers |
| FuturesApi | listFuturesTrades | GET /futures/trades | Futures trading history |
| FuturesApi | listOrders | GET /futures/orders | List futures orders |
| FuturesApi | listPositionClose | GET /futures/position_close | List position close history |
| FuturesApi | listPositions | GET /futures/positions | List all positions of a user |
| FuturesApi | updatePositionLeverage | POST /futures/positions/{contract}/leverage | Update position leverage |
| FuturesApi | updatePositionMargin | POST /futures/positions/{contract}/margin | Update position margin |
| FuturesApi | updatePositionRiskLimit | POST /futures/positions/{contract}/risk_limit | Update position risk limit |
- Contract
- FundingRateRecord
- FuturesAccount
- FuturesAccountBook
- FuturesCandlestick
- FuturesOrder
- FuturesOrderBook
- FuturesOrderBookItem
- FuturesTicker
- FuturesTrade
- InsuranceRecord
- MyFuturesTrade
- Position
- PositionClose
- PositionCloseOrder
It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.