Gate API v4
- API version: 4.22.4
- SDK version: 6.22.4
Welcome to Gate.io API
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
Trying our best to follow the semantic versioning, while enjoying recent features provided by programming language and libraries, from 4.15.2, one major versioning difference will be introduced:
If extra code rewrite is required when you upgrade the SDK, such as:
- some outdated programming language version support is dropped
- API method signature has breaking changes.
the MAJOR version will be incremented, but the MINOR and PATCH version are still following REST API's instead of resetting to 0, so that you can recognize it has some breaking changes, but still getting the idea of from which REST API version the change is introduced.
For example, the previous REST API and SDK version are both 4.14.0. But if we decide to introduce some breaking changes in SDK along with REST API 4.15.2 upgrade, then the version of next SDK release will be 5.15.2(the MAJOR version is incremented to denote breaking changes, but the MINOR and PATCH version are identical to REST API's instead of resetting them to 0)
If MAJOR version is incremented, make sure you read the release note on Releases page
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 install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn clean deploy
Refer 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>6.22.4</version>
<scope>compile</scope>
</dependency>
Add this dependency to your project's build file:
compile "io.gate:gate-api:6.22.4"
At first generate the JAR by executing:
mvn clean package
Then manually install the following JARs:
target/gate-api-6.22.4.jar
target/lib/*.jar
Please follow the installation instruction and execute the following Java code:
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.DeliveryApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApi apiInstance = new DeliveryApi(defaultClient);
String settle = "usdt"; // String | Settle currency
try {
List<DeliveryContract> result = apiInstance.listDeliveryContracts(settle);
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling DeliveryApi#listDeliveryContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
For a more complete API usage example, refer to the demo application in example directory
All URIs are relative to https://api.gateio.ws/api/v4
Class | Method | HTTP request | Description |
---|---|---|---|
DeliveryApi | listDeliveryContracts | GET /delivery/{settle}/contracts | List all futures contracts |
DeliveryApi | getDeliveryContract | GET /delivery/{settle}/contracts/{contract} | Get a single contract |
DeliveryApi | listDeliveryOrderBook | GET /delivery/{settle}/order_book | Futures order book |
DeliveryApi | listDeliveryTrades | GET /delivery/{settle}/trades | Futures trading history |
DeliveryApi | listDeliveryCandlesticks | GET /delivery/{settle}/candlesticks | Get futures candlesticks |
DeliveryApi | listDeliveryTickers | GET /delivery/{settle}/tickers | List futures tickers |
DeliveryApi | listDeliveryInsuranceLedger | GET /delivery/{settle}/insurance | Futures insurance balance history |
DeliveryApi | listDeliveryAccounts | GET /delivery/{settle}/accounts | Query futures account |
DeliveryApi | listDeliveryAccountBook | GET /delivery/{settle}/account_book | Query account book |
DeliveryApi | listDeliveryPositions | GET /delivery/{settle}/positions | List all positions of a user |
DeliveryApi | getDeliveryPosition | GET /delivery/{settle}/positions/{contract} | Get single position |
DeliveryApi | updateDeliveryPositionMargin | POST /delivery/{settle}/positions/{contract}/margin | Update position margin |
DeliveryApi | updateDeliveryPositionLeverage | POST /delivery/{settle}/positions/{contract}/leverage | Update position leverage |
DeliveryApi | updateDeliveryPositionRiskLimit | POST /delivery/{settle}/positions/{contract}/risk_limit | Update position risk limit |
DeliveryApi | listDeliveryOrders | GET /delivery/{settle}/orders | List futures orders |
DeliveryApi | createDeliveryOrder | POST /delivery/{settle}/orders | Create a futures order |
DeliveryApi | cancelDeliveryOrders | DELETE /delivery/{settle}/orders | Cancel all `open` orders matched |
DeliveryApi | getDeliveryOrder | GET /delivery/{settle}/orders/{order_id} | Get a single order |
DeliveryApi | cancelDeliveryOrder | DELETE /delivery/{settle}/orders/{order_id} | Cancel a single order |
DeliveryApi | getMyDeliveryTrades | GET /delivery/{settle}/my_trades | List personal trading history |
DeliveryApi | listDeliveryPositionClose | GET /delivery/{settle}/position_close | List position close history |
DeliveryApi | listDeliveryLiquidates | GET /delivery/{settle}/liquidates | List liquidation history |
DeliveryApi | listDeliverySettlements | GET /delivery/{settle}/settlements | List settlement history |
DeliveryApi | listPriceTriggeredDeliveryOrders | GET /delivery/{settle}/price_orders | List all auto orders |
DeliveryApi | createPriceTriggeredDeliveryOrder | POST /delivery/{settle}/price_orders | Create a price-triggered order |
DeliveryApi | cancelPriceTriggeredDeliveryOrderList | DELETE /delivery/{settle}/price_orders | Cancel all open orders |
DeliveryApi | getPriceTriggeredDeliveryOrder | GET /delivery/{settle}/price_orders/{order_id} | Get a single order |
DeliveryApi | cancelPriceTriggeredDeliveryOrder | DELETE /delivery/{settle}/price_orders/{order_id} | Cancel a single order |
FuturesApi | listFuturesContracts | GET /futures/{settle}/contracts | List all futures contracts |
FuturesApi | getFuturesContract | GET /futures/{settle}/contracts/{contract} | Get a single contract |
FuturesApi | listFuturesOrderBook | GET /futures/{settle}/order_book | Futures order book |
FuturesApi | listFuturesTrades | GET /futures/{settle}/trades | Futures trading history |
FuturesApi | listFuturesCandlesticks | GET /futures/{settle}/candlesticks | Get futures candlesticks |
FuturesApi | listFuturesTickers | GET /futures/{settle}/tickers | List futures tickers |
FuturesApi | listFuturesFundingRateHistory | GET /futures/{settle}/funding_rate | Funding rate history |
FuturesApi | listFuturesInsuranceLedger | GET /futures/{settle}/insurance | Futures insurance balance history |
FuturesApi | listContractStats | GET /futures/{settle}/contract_stats | Futures stats |
FuturesApi | listLiquidatedOrders | GET /futures/{settle}/liq_orders | Retrieve liquidation history |
FuturesApi | listFuturesAccounts | GET /futures/{settle}/accounts | Query futures account |
FuturesApi | listFuturesAccountBook | GET /futures/{settle}/account_book | Query account book |
FuturesApi | listPositions | GET /futures/{settle}/positions | List all positions of a user |
FuturesApi | getPosition | GET /futures/{settle}/positions/{contract} | Get single position |
FuturesApi | updatePositionMargin | POST /futures/{settle}/positions/{contract}/margin | Update position margin |
FuturesApi | updatePositionLeverage | POST /futures/{settle}/positions/{contract}/leverage | Update position leverage |
FuturesApi | updatePositionRiskLimit | POST /futures/{settle}/positions/{contract}/risk_limit | Update position risk limit |
FuturesApi | setDualMode | POST /futures/{settle}/dual_mode | Enable or disable dual mode |
FuturesApi | getDualModePosition | GET /futures/{settle}/dual_comp/positions/{contract} | Retrieve position detail in dual mode |
FuturesApi | updateDualModePositionMargin | POST /futures/{settle}/dual_comp/positions/{contract}/margin | Update position margin in dual mode |
FuturesApi | updateDualModePositionLeverage | POST /futures/{settle}/dual_comp/positions/{contract}/leverage | Update position leverage in dual mode |
FuturesApi | updateDualModePositionRiskLimit | POST /futures/{settle}/dual_comp/positions/{contract}/risk_limit | Update position risk limit in dual mode |
FuturesApi | listFuturesOrders | GET /futures/{settle}/orders | List futures orders |
FuturesApi | createFuturesOrder | POST /futures/{settle}/orders | Create a futures order |
FuturesApi | cancelFuturesOrders | DELETE /futures/{settle}/orders | Cancel all `open` orders matched |
FuturesApi | getFuturesOrder | GET /futures/{settle}/orders/{order_id} | Get a single order |
FuturesApi | cancelFuturesOrder | DELETE /futures/{settle}/orders/{order_id} | Cancel a single order |
FuturesApi | getMyTrades | GET /futures/{settle}/my_trades | List personal trading history |
FuturesApi | listPositionClose | GET /futures/{settle}/position_close | List position close history |
FuturesApi | listLiquidates | GET /futures/{settle}/liquidates | List liquidation history |
FuturesApi | listPriceTriggeredOrders | GET /futures/{settle}/price_orders | List all auto orders |
FuturesApi | createPriceTriggeredOrder | POST /futures/{settle}/price_orders | Create a price-triggered order |
FuturesApi | cancelPriceTriggeredOrderList | DELETE /futures/{settle}/price_orders | Cancel all open orders |
FuturesApi | getPriceTriggeredOrder | GET /futures/{settle}/price_orders/{order_id} | Get a single order |
FuturesApi | cancelPriceTriggeredOrder | DELETE /futures/{settle}/price_orders/{order_id} | Cancel a single order |
MarginApi | listMarginCurrencyPairs | GET /margin/currency_pairs | List all supported currency pairs supported in margin trading |
MarginApi | getMarginCurrencyPair | GET /margin/currency_pairs/{currency_pair} | Query one single margin currency pair |
MarginApi | listFundingBook | GET /margin/funding_book | Order book of lending loans |
MarginApi | listMarginAccounts | GET /margin/accounts | Margin account list |
MarginApi | listMarginAccountBook | GET /margin/account_book | List margin account balance change history |
MarginApi | listFundingAccounts | GET /margin/funding_accounts | Funding account list |
MarginApi | listLoans | GET /margin/loans | List all loans |
MarginApi | createLoan | POST /margin/loans | Lend or borrow |
MarginApi | mergeLoans | POST /margin/merged_loans | Merge multiple lending loans |
MarginApi | getLoan | GET /margin/loans/{loan_id} | Retrieve one single loan detail |
MarginApi | cancelLoan | DELETE /margin/loans/{loan_id} | Cancel lending loan |
MarginApi | updateLoan | PATCH /margin/loans/{loan_id} | Modify a loan |
MarginApi | listLoanRepayments | GET /margin/loans/{loan_id}/repayment | List loan repayment records |
MarginApi | repayLoan | POST /margin/loans/{loan_id}/repayment | Repay a loan |
MarginApi | listLoanRecords | GET /margin/loan_records | List repayment records of a specific loan |
MarginApi | getLoanRecord | GET /margin/loan_records/{loan_record_id} | Get one single loan record |
MarginApi | updateLoanRecord | PATCH /margin/loan_records/{loan_record_id} | Modify a loan record |
MarginApi | getAutoRepayStatus | GET /margin/auto_repay | Retrieve user auto repayment setting |
MarginApi | setAutoRepay | POST /margin/auto_repay | Update user's auto repayment setting |
MarginApi | getMarginTransferable | GET /margin/transferable | Get the max transferable amount for a specific margin currency |
MarginApi | getMarginBorrowable | GET /margin/borrowable | Get the max borrowable amount for a specific margin currency |
MarginApi | listCrossMarginCurrencies | GET /margin/cross/currencies | Currencies supported by cross margin. |
MarginApi | getCrossMarginCurrency | GET /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin |
MarginApi | getCrossMarginAccount | GET /margin/cross/accounts | Retrieve cross margin account |
MarginApi | listCrossMarginAccountBook | GET /margin/cross/account_book | Retrieve cross margin account change history |
MarginApi | listCrossMarginLoans | GET /margin/cross/loans | List cross margin borrow history |
MarginApi | createCrossMarginLoan | POST /margin/cross/loans | Create a cross margin borrow loan |
MarginApi | getCrossMarginLoan | GET /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail |
MarginApi | listCrossMarginRepayments | GET /margin/cross/repayments | Retrieve cross margin repayments |
MarginApi | repayCrossMarginLoan | POST /margin/cross/repayments | Repay cross margin loan |
MarginApi | getCrossMarginTransferable | GET /margin/cross/transferable | Get the max transferable amount for a specific cross margin currency |
MarginApi | getCrossMarginBorrowable | GET /margin/cross/borrowable | Get the max borrowable amount for a specific cross margin currency |
SpotApi | listCurrencies | GET /spot/currencies | List all currencies' details |
SpotApi | getCurrency | GET /spot/currencies/{currency} | Get details of a specific currency |
SpotApi | listCurrencyPairs | GET /spot/currency_pairs | List all currency pairs supported |
SpotApi | getCurrencyPair | GET /spot/currency_pairs/{currency_pair} | Get details of a specifc order |
SpotApi | listTickers | GET /spot/tickers | Retrieve ticker information |
SpotApi | listOrderBook | GET /spot/order_book | Retrieve order book |
SpotApi | listTrades | GET /spot/trades | Retrieve market trades |
SpotApi | listCandlesticks | GET /spot/candlesticks | Market candlesticks |
SpotApi | getFee | GET /spot/fee | Query user trading fee rates |
SpotApi | listSpotAccounts | GET /spot/accounts | List spot accounts |
SpotApi | createBatchOrders | POST /spot/batch_orders | Create a batch of orders |
SpotApi | listAllOpenOrders | GET /spot/open_orders | List all open orders |
SpotApi | listOrders | GET /spot/orders | List orders |
SpotApi | createOrder | POST /spot/orders | Create an order |
SpotApi | cancelOrders | DELETE /spot/orders | Cancel all `open` orders in specified currency pair |
SpotApi | cancelBatchOrders | POST /spot/cancel_batch_orders | Cancel a batch of orders with an ID list |
SpotApi | getOrder | GET /spot/orders/{order_id} | Get a single order |
SpotApi | cancelOrder | DELETE /spot/orders/{order_id} | Cancel a single order |
SpotApi | listMyTrades | GET /spot/my_trades | List personal trading history |
SpotApi | listSpotPriceTriggeredOrders | GET /spot/price_orders | Retrieve running auto order list |
SpotApi | createSpotPriceTriggeredOrder | POST /spot/price_orders | Create a price-triggered order |
SpotApi | cancelSpotPriceTriggeredOrderList | DELETE /spot/price_orders | Cancel all open orders |
SpotApi | getSpotPriceTriggeredOrder | GET /spot/price_orders/{order_id} | Get a single order |
SpotApi | cancelSpotPriceTriggeredOrder | DELETE /spot/price_orders/{order_id} | Cancel a single order |
WalletApi | getDepositAddress | GET /wallet/deposit_address | Generate currency deposit address |
WalletApi | listWithdrawals | GET /wallet/withdrawals | Retrieve withdrawal records |
WalletApi | listDeposits | GET /wallet/deposits | Retrieve deposit records |
WalletApi | transfer | POST /wallet/transfers | Transfer between trading accounts |
WalletApi | listSubAccountTransfers | GET /wallet/sub_account_transfers | Retrieve transfer records between main and sub accounts |
WalletApi | transferWithSubAccount | POST /wallet/sub_account_transfers | Transfer between main and sub accounts |
WalletApi | listWithdrawStatus | GET /wallet/withdraw_status | Retrieve withdrawal status |
WalletApi | listSubAccountBalances | GET /wallet/sub_account_balances | Retrieve sub account balances |
WalletApi | getTradeFee | GET /wallet/fee | Retrieve personal trading fee |
WalletApi | getTotalBalance | GET /wallet/total_balance | Retrieve user's total balances |
WithdrawalApi | withdraw | POST /withdrawals | Withdraw |
WithdrawalApi | cancelWithdrawal | DELETE /withdrawals/{withdrawal_id} | Cancel withdrawal with specified ID |
- AccountBalance
- AutoRepaySetting
- BatchOrder
- CancelOrder
- CancelOrderResult
- Contract
- ContractStat
- CrossMarginAccount
- CrossMarginAccountBook
- CrossMarginBalance
- CrossMarginBorrowable
- CrossMarginCurrency
- CrossMarginLoan
- CrossMarginRepayRequest
- CrossMarginRepayment
- CrossMarginTransferable
- Currency
- CurrencyPair
- DeliveryContract
- DeliverySettlement
- DepositAddress
- FundingAccount
- FundingBookItem
- FundingRateRecord
- FuturesAccount
- FuturesAccountBook
- FuturesCandlestick
- FuturesInitialOrder
- FuturesLiquidate
- FuturesOrder
- FuturesOrderBook
- FuturesOrderBookItem
- FuturesPriceTrigger
- FuturesPriceTriggeredOrder
- FuturesTicker
- FuturesTrade
- InsuranceRecord
- LedgerRecord
- Loan
- LoanPatch
- LoanRecord
- MarginAccount
- MarginAccountBook
- MarginAccountCurrency
- MarginBorrowable
- MarginCurrencyPair
- MarginTransferable
- MultiChainAddressItem
- MyFuturesTrade
- OpenOrders
- Order
- OrderBook
- Position
- PositionClose
- PositionCloseOrder
- RepayRequest
- Repayment
- SpotAccount
- SpotPricePutOrder
- SpotPriceTrigger
- SpotPriceTriggeredOrder
- SubAccountBalance
- SubAccountTransfer
- Ticker
- TotalBalance
- Trade
- TradeFee
- Transfer
- TriggerOrderResponse
- WithdrawStatus
Authentication schemes defined for the API:
- Type: Gate APIv4
It's recommended to create an instance of ApiClient
per thread in a multi-threaded environment to avoid any potential issues.