Gate API v4
- API version: 4.11.0
APIv4 provides spot, margin and 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://www.gate.io/page/contacts
Automatically generated by the OpenAPI Generator
BREAKING change:
4.8.0 add new support with different settle currency for futures API(BTC is the only one allowed before), which makes ALL methods in FuturesApi REQUIRE an additional settle parameter.
But previous /futures/xxx APIs are still preserved for compatibility usage(will be treated as BTC), so if one of the following condition is met:
- Changing all your futures method call to include
settleis not a big issue for you - You need to use futures settled in non-BTC currency
then you'd better move to 4.8.0 and changes all your futures method call to pass in settle parameter. Otherwise, you can stick to version<=4.7.3,
but will not receive any future API upgrade support
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>4.11.0</version>
<scope>compile</scope>
</dependency>Add this dependency to your project's build file:
compile "io.gate:gate-api:4.11.0"At first generate the JAR by executing:
mvn clean packageThen manually install the following JARs:
target/gate-api-4.11.0.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 settle = "btc"; // String | Settle currency
String orderId = "12345"; // String | ID returned on order successfully being created
try {
FuturesOrder result = apiInstance.cancelFuturesOrder(settle, orderId);
System.out.println(result);
} catch (ApiException e) {
System.err.println(e.getResponseBody());
e.printStackTrace();
}
}
}All URIs are relative to https://api.gateio.ws/api/v4
| Class | Method | HTTP request | Description |
|---|---|---|---|
| FuturesApi | cancelFuturesOrder | DELETE /futures/{settle}/orders/{order_id} | Cancel a single order |
| FuturesApi | cancelFuturesOrders | DELETE /futures/{settle}/orders | Cancel all `open` orders matched |
| FuturesApi | cancelPriceTriggeredOrder | DELETE /futures/{settle}/price_orders/{order_id} | Cancel a single order |
| FuturesApi | cancelPriceTriggeredOrderList | DELETE /futures/{settle}/price_orders | Cancel all open orders |
| FuturesApi | createFuturesOrder | POST /futures/{settle}/orders | Create a futures order |
| FuturesApi | createPriceTriggeredOrder | POST /futures/{settle}/price_orders | Create a price-triggered order |
| FuturesApi | getFuturesContract | GET /futures/{settle}/contracts/{contract} | Get a single contract |
| FuturesApi | getFuturesOrder | GET /futures/{settle}/orders/{order_id} | Get a single order |
| FuturesApi | getMyTrades | GET /futures/{settle}/my_trades | List personal trading history |
| FuturesApi | getPosition | GET /futures/{settle}/positions/{contract} | Get single position |
| FuturesApi | getPriceTriggeredOrder | GET /futures/{settle}/price_orders/{order_id} | Get a single order |
| FuturesApi | listFuturesAccountBook | GET /futures/{settle}/account_book | Query account book |
| FuturesApi | listFuturesAccounts | GET /futures/{settle}/accounts | Query futures account |
| FuturesApi | listFuturesCandlesticks | GET /futures/{settle}/candlesticks | Get futures candlesticks |
| FuturesApi | listFuturesContracts | GET /futures/{settle}/contracts | List all futures contracts |
| FuturesApi | listFuturesFundingRateHistory | GET /futures/{settle}/funding_rate | Funding rate history |
| FuturesApi | listFuturesInsuranceLedger | GET /futures/{settle}/insurance | Futures insurance balance history |
| FuturesApi | listFuturesOrderBook | GET /futures/{settle}/order_book | Futures order book |
| FuturesApi | listFuturesOrders | GET /futures/{settle}/orders | List futures orders |
| FuturesApi | listFuturesTickers | GET /futures/{settle}/tickers | List futures tickers |
| FuturesApi | listFuturesTrades | GET /futures/{settle}/trades | Futures trading history |
| FuturesApi | listLiquidates | GET /futures/{settle}/liquidates | List liquidation history |
| FuturesApi | listPositionClose | GET /futures/{settle}/position_close | List position close history |
| FuturesApi | listPositions | GET /futures/{settle}/positions | List all positions of a user |
| FuturesApi | listPriceTriggeredOrders | GET /futures/{settle}/price_orders | List all auto orders |
| FuturesApi | updatePositionLeverage | POST /futures/{settle}/positions/{contract}/leverage | Update position leverage |
| FuturesApi | updatePositionMargin | POST /futures/{settle}/positions/{contract}/margin | Update position margin |
| FuturesApi | updatePositionRiskLimit | POST /futures/{settle}/positions/{contract}/risk_limit | Update position risk limit |
| MarginApi | cancelLoan | DELETE /margin/loans/{loan_id} | Cancel lending loan |
| MarginApi | createLoan | POST /margin/loans | Lend or borrow |
| MarginApi | getLoan | GET /margin/loans/{loan_id} | Retrieve one single loan detail |
| MarginApi | getLoanRecord | GET /margin/loan_records/{loan_record_id} | Get one single loan record |
| MarginApi | listFundingAccounts | GET /margin/funding_accounts | Funding account list |
| MarginApi | listFundingBook | GET /margin/funding_book | Order book of lending loans |
| MarginApi | listLoanRecords | GET /margin/loan_records | List repayment records of specified loan |
| MarginApi | listLoanRepayments | GET /margin/loans/{loan_id}/repayment | List loan repayment records |
| MarginApi | listLoans | GET /margin/loans | List all loans |
| MarginApi | listMarginAccounts | GET /margin/accounts | Margin account list |
| MarginApi | listMarginCurrencyPairs | GET /margin/currency_pairs | List all supported currency pairs supported in margin trading |
| MarginApi | mergeLoans | POST /margin/merged_loans | Merge multiple lending loans |
| MarginApi | repayLoan | POST /margin/loans/{loan_id}/repayment | Repay a loan |
| MarginApi | updateLoan | PATCH /margin/loans/{loan_id} | Modify a loan |
| MarginApi | updateLoanRecord | PATCH /margin/loan_records/{loan_record_id} | Modify a loan record |
| SpotApi | cancelBatchOrders | POST /spot/cancel_batch_orders | Cancel a batch of orders with an ID list |
| SpotApi | cancelOrder | DELETE /spot/orders/{order_id} | Cancel a single order |
| SpotApi | cancelOrders | DELETE /spot/orders | Cancel all `open` orders in specified currency pair |
| SpotApi | createBatchOrders | POST /spot/batch_orders | Create a batch of orders |
| SpotApi | createOrder | POST /spot/orders | Create an order |
| SpotApi | getCurrencyPair | GET /spot/currency_pairs/{currency_pair} | Get detail of one single order |
| SpotApi | getOrder | GET /spot/orders/{order_id} | Get a single order |
| SpotApi | listCandlesticks | GET /spot/candlesticks | Market candlesticks |
| SpotApi | listCurrencyPairs | GET /spot/currency_pairs | List all currency pairs supported |
| SpotApi | listMyTrades | GET /spot/my_trades | List personal trading history |
| SpotApi | listOrderBook | GET /spot/order_book | Retrieve order book |
| SpotApi | listOrders | GET /spot/orders | List orders |
| SpotApi | listSpotAccounts | GET /spot/accounts | List spot accounts |
| SpotApi | listTickers | GET /spot/tickers | Retrieve ticker information |
| SpotApi | listTrades | GET /spot/trades | Retrieve market trades |
| WalletApi | transfer | POST /wallet/transfers | Transfer between accounts |
- BatchOrder
- CancelOrder
- CancelOrderResult
- Contract
- CurrencyPair
- FundingAccount
- FundingBookItem
- FundingRateRecord
- FuturesAccount
- FuturesAccountBook
- FuturesCandlestick
- FuturesInitialOrder
- FuturesLiquidate
- FuturesOrder
- FuturesOrderBook
- FuturesOrderBookItem
- FuturesPriceTrigger
- FuturesPriceTriggeredOrder
- FuturesTicker
- FuturesTrade
- InsuranceRecord
- Loan
- LoanPatch
- LoanRecord
- MarginAccount
- MarginAccountCurrency
- MarginCurrencyPair
- MyFuturesTrade
- Order
- OrderBook
- Position
- PositionClose
- PositionCloseOrder
- RepayRequest
- Repayment
- SpotAccount
- Ticker
- Trade
- Transfer
- TriggerOrderResponse
It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.