All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| listFuturesContracts | GET /futures/{settle}/contracts | List all futures contracts |
| getFuturesContract | GET /futures/{settle}/contracts/{contract} | Get a single contract |
| listFuturesOrderBook | GET /futures/{settle}/order_book | Futures order book |
| listFuturesTrades | GET /futures/{settle}/trades | Futures trading history |
| listFuturesCandlesticks | GET /futures/{settle}/candlesticks | Get futures candlesticks |
| listFuturesTickers | GET /futures/{settle}/tickers | List futures tickers |
| listFuturesFundingRateHistory | GET /futures/{settle}/funding_rate | Funding rate history |
| listFuturesInsuranceLedger | GET /futures/{settle}/insurance | Futures insurance balance history |
| listFuturesAccounts | GET /futures/{settle}/accounts | Query futures account |
| listFuturesAccountBook | GET /futures/{settle}/account_book | Query account book |
| listPositions | GET /futures/{settle}/positions | List all positions of a user |
| getPosition | GET /futures/{settle}/positions/{contract} | Get single position |
| updatePositionMargin | POST /futures/{settle}/positions/{contract}/margin | Update position margin |
| updatePositionLeverage | POST /futures/{settle}/positions/{contract}/leverage | Update position leverage |
| updatePositionRiskLimit | POST /futures/{settle}/positions/{contract}/risk_limit | Update position risk limit |
| listFuturesOrders | GET /futures/{settle}/orders | List futures orders |
| createFuturesOrder | POST /futures/{settle}/orders | Create a futures order |
| cancelFuturesOrders | DELETE /futures/{settle}/orders | Cancel all `open` orders matched |
| getFuturesOrder | GET /futures/{settle}/orders/{order_id} | Get a single order |
| cancelFuturesOrder | DELETE /futures/{settle}/orders/{order_id} | Cancel a single order |
| getMyTrades | GET /futures/{settle}/my_trades | List personal trading history |
| listPositionClose | GET /futures/{settle}/position_close | List position close history |
| listLiquidates | GET /futures/{settle}/liquidates | List liquidation history |
| listPriceTriggeredOrders | GET /futures/{settle}/price_orders | List all auto orders |
| createPriceTriggeredOrder | POST /futures/{settle}/price_orders | Create a price-triggered order |
| cancelPriceTriggeredOrderList | DELETE /futures/{settle}/price_orders | Cancel all open orders |
| getPriceTriggeredOrder | GET /futures/{settle}/price_orders/{order_id} | Get a single order |
| cancelPriceTriggeredOrder | DELETE /futures/{settle}/price_orders/{order_id} | Cancel a single order |
List<Contract> listFuturesContracts(settle)
List all futures contracts
// 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.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
try {
List<Contract> result = apiInstance.listFuturesContracts(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 FuturesApi#listFuturesContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
Contract getFuturesContract(settle, contract)
Get a single contract
// 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.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
try {
Contract result = apiInstance.getFuturesContract(settle, contract);
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 FuturesApi#getFuturesContract");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Contract information | - |
FuturesOrderBook listFuturesOrderBook(settle, contract).interval(interval).limit(limit).execute();
Futures order book
Bids will be sorted by price from high to low, while asks sorted reversely
// 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.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
String interval = "0"; // String | Order depth. 0 means no aggregation is applied. default to 0
Integer limit = 10; // Integer | Maximum number of order depth data in asks or bids
try {
FuturesOrderBook result = apiInstance.listFuturesOrderBook(settle, contract)
.interval(interval)
.limit(limit)
.execute();
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 FuturesApi#listFuturesOrderBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract | |
| interval | String | Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to 0] [enum: 0, 0.1, 0.01] |
| limit | Integer | Maximum number of order depth data in asks or bids | [optional] [default to 10] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order book retrieved | - |
List<FuturesTrade> listFuturesTrades(settle, contract).limit(limit).lastId(lastId).from(from).to(to).execute();
Futures trading history
// 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.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
Integer limit = 100; // Integer | Maximum number of records returned in one list
String lastId = "12345"; // String | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range
Long from = 1546905600L; // Long | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned.
Long to = 1546935600L; // Long | Specify end time in Unix seconds, default to current time
try {
List<FuturesTrade> result = apiInstance.listFuturesTrades(settle, contract)
.limit(limit)
.lastId(lastId)
.from(from)
.to(to)
.execute();
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 FuturesApi#listFuturesTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract | |
| limit | Integer | Maximum number of records returned in one list | [optional] [default to 100] |
| lastId | String | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional] |
| from | Long | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. | [optional] |
| to | Long | Specify end time in Unix seconds, default to current time | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
List<FuturesCandlestick> listFuturesCandlesticks(settle, contract).from(from).to(to).limit(limit).interval(interval).execute();
Get futures candlesticks
Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval`
// 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.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
Long from = 1546905600L; // Long | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified
Long to = 1546935600L; // Long | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time
Integer limit = 100; // Integer | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected.
String interval = "5m"; // String | Interval time between data points
try {
List<FuturesCandlestick> result = apiInstance.listFuturesCandlesticks(settle, contract)
.from(from)
.to(to)
.limit(limit)
.interval(interval)
.execute();
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 FuturesApi#listFuturesCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract | |
| from | Long | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] |
| to | Long | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] |
| limit | Integer | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] |
| interval | String | Interval time between data points | [optional] [default to 5m] [enum: 10s, 1m, 5m, 15m, 30m, 1h, 4h, 8h, 1d, 7d] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<FuturesTicker> listFuturesTickers(settle).contract(contract).execute();
List futures tickers
// 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.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract, return related data only if specified
try {
List<FuturesTicker> result = apiInstance.listFuturesTickers(settle)
.contract(contract)
.execute();
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 FuturesApi#listFuturesTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract, return related data only if specified | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<FundingRateRecord> listFuturesFundingRateHistory(settle, contract).limit(limit).execute();
Funding rate history
// 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.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
Integer limit = 100; // Integer | Maximum number of records returned in one list
try {
List<FundingRateRecord> result = apiInstance.listFuturesFundingRateHistory(settle, contract)
.limit(limit)
.execute();
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 FuturesApi#listFuturesFundingRateHistory");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract | |
| limit | Integer | Maximum number of records returned in one list | [optional] [default to 100] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | History retrieved | - |
List<InsuranceRecord> listFuturesInsuranceLedger(settle).limit(limit).execute();
Futures insurance balance history
// 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.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
Integer limit = 100; // Integer | Maximum number of records returned in one list
try {
List<InsuranceRecord> result = apiInstance.listFuturesInsuranceLedger(settle)
.limit(limit)
.execute();
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 FuturesApi#listFuturesInsuranceLedger");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| limit | Integer | Maximum number of records returned in one list | [optional] [default to 100] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
FuturesAccount listFuturesAccounts(settle)
Query futures account
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
try {
FuturesAccount result = apiInstance.listFuturesAccounts(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 FuturesApi#listFuturesAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
List<FuturesAccountBook> listFuturesAccountBook(settle).limit(limit).from(from).to(to).type(type).execute();
Query account book
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
Integer limit = 100; // Integer | Maximum number of records returned in one list
Long from = 1547706332L; // Long | Start timestamp
Long to = 1547706332L; // Long | End timestamp
String type = "dnw"; // String | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate
try {
List<FuturesAccountBook> result = apiInstance.listFuturesAccountBook(settle)
.limit(limit)
.from(from)
.to(to)
.type(type)
.execute();
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 FuturesApi#listFuturesAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| limit | Integer | Maximum number of records returned in one list | [optional] [default to 100] |
| from | Long | Start timestamp | [optional] |
| to | Long | End timestamp | [optional] |
| type | String | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | [optional] [enum: dnw, pnl, fee, refr, fund, point_dnw, point_fee, point_refr] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
List<Position> listPositions(settle)
List all positions of a user
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
try {
List<Position> result = apiInstance.listPositions(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 FuturesApi#listPositions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
Position getPosition(settle, contract)
Get single position
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
try {
Position result = apiInstance.getPosition(settle, contract);
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 FuturesApi#getPosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Position information | - |
Position updatePositionMargin(settle, contract, change)
Update position margin
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
String change = "0.01"; // String | Margin change. Use positive number to increase margin, negative number otherwise.
try {
Position result = apiInstance.updatePositionMargin(settle, contract, change);
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 FuturesApi#updatePositionMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract | |
| change | String | Margin change. Use positive number to increase margin, negative number otherwise. |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Position information | - |
Position updatePositionLeverage(settle, contract, leverage)
Update position leverage
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
String leverage = "10"; // String | New position leverage
try {
Position result = apiInstance.updatePositionLeverage(settle, contract, leverage);
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 FuturesApi#updatePositionLeverage");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract | |
| leverage | String | New position leverage |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Position information | - |
Position updatePositionRiskLimit(settle, contract, riskLimit)
Update position risk limit
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
String riskLimit = "10"; // String | New position risk limit
try {
Position result = apiInstance.updatePositionRiskLimit(settle, contract, riskLimit);
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 FuturesApi#updatePositionRiskLimit");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract | |
| riskLimit | String | New position risk limit |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Position information | - |
List<FuturesOrder> listFuturesOrders(settle, contract, status).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();
List futures orders
Zero-fill order cannot be retrieved 60 seconds after cancellation
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
String status = "open"; // String | List orders based on status
Integer limit = 100; // Integer | Maximum number of records returned in one list
Integer offset = 0; // Integer | List offset, starting from 0
String lastId = "12345"; // String | Specify list staring point using the `id` of last record in previous list-query results
Integer countTotal = 0; // Integer | Whether to return total number matched. Default to 0(no return)
try {
List<FuturesOrder> result = apiInstance.listFuturesOrders(settle, contract, status)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
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 FuturesApi#listFuturesOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract | |
| status | String | List orders based on status | [enum: open, finished] |
| limit | Integer | Maximum number of records returned in one list | [optional] [default to 100] |
| offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
| lastId | String | Specify list staring point using the `id` of last record in previous list-query results | [optional] |
| countTotal | Integer | Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] [enum: 0, 1] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | * X-Pagination-Limit - Request limit specified * X-Pagination-Offset - Request offset specified * X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1 |
FuturesOrder createFuturesOrder(settle, futuresOrder)
Create a futures order
Zero-fill order cannot be retrieved 60 seconds after cancellation
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
FuturesOrder futuresOrder = new FuturesOrder(); // FuturesOrder |
try {
FuturesOrder result = apiInstance.createFuturesOrder(settle, futuresOrder);
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 FuturesApi#createFuturesOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| futuresOrder | FuturesOrder |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 201 | Order details | - |
List<FuturesOrder> cancelFuturesOrders(settle, contract, side)
Cancel all `open` orders matched
Zero-fill order cannot be retrieved 60 seconds after cancellation
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
String side = "ask"; // String | All bids or asks. Both included in not specified
try {
List<FuturesOrder> result = apiInstance.cancelFuturesOrders(settle, contract, side);
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 FuturesApi#cancelFuturesOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract | |
| side | String | All bids or asks. Both included in not specified | [optional] [enum: ask, bid] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | All orders matched cancelled | - |
FuturesOrder getFuturesOrder(settle, orderId)
Get a single order
Zero-fill order cannot be retrieved 60 seconds after cancellation
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String orderId = "12345"; // String | ID returned on order successfully being created
try {
FuturesOrder result = apiInstance.getFuturesOrder(settle, orderId);
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 FuturesApi#getFuturesOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| orderId | String | ID returned on order successfully being created |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order details | - |
FuturesOrder cancelFuturesOrder(settle, orderId)
Cancel a single order
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
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 (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 FuturesApi#cancelFuturesOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| orderId | String | ID returned on order successfully being created |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order details | - |
List<MyFuturesTrade> getMyTrades(settle).contract(contract).order(order).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();
List personal trading history
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract, return related data only if specified
Long order = 12345L; // Long | Futures order ID, return related data only if specified
Integer limit = 100; // Integer | Maximum number of records returned in one list
Integer offset = 0; // Integer | List offset, starting from 0
String lastId = "12345"; // String | Specify list staring point using the `id` of last record in previous list-query results
Integer countTotal = 0; // Integer | Whether to return total number matched. Default to 0(no return)
try {
List<MyFuturesTrade> result = apiInstance.getMyTrades(settle)
.contract(contract)
.order(order)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
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 FuturesApi#getMyTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract, return related data only if specified | [optional] |
| order | Long | Futures order ID, return related data only if specified | [optional] |
| limit | Integer | Maximum number of records returned in one list | [optional] [default to 100] |
| offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
| lastId | String | Specify list staring point using the `id` of last record in previous list-query results | [optional] |
| countTotal | Integer | Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] [enum: 0, 1] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | * X-Pagination-Limit - Request limit specified * X-Pagination-Offset - Request offset specified * X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1 |
List<PositionClose> listPositionClose(settle).contract(contract).limit(limit).execute();
List position close history
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract, return related data only if specified
Integer limit = 100; // Integer | Maximum number of records returned in one list
try {
List<PositionClose> result = apiInstance.listPositionClose(settle)
.contract(contract)
.limit(limit)
.execute();
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 FuturesApi#listPositionClose");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract, return related data only if specified | [optional] |
| limit | Integer | Maximum number of records returned in one list | [optional] [default to 100] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
List<FuturesLiquidate> listLiquidates(settle).contract(contract).limit(limit).at(at).execute();
List liquidation history
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract, return related data only if specified
Integer limit = 100; // Integer | Maximum number of records returned in one list
Integer at = 0; // Integer | Specify a liquidation timestamp
try {
List<FuturesLiquidate> result = apiInstance.listLiquidates(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
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 FuturesApi#listLiquidates");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract, return related data only if specified | [optional] |
| limit | Integer | Maximum number of records returned in one list | [optional] [default to 100] |
| at | Integer | Specify a liquidation timestamp | [optional] [default to 0] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
List<FuturesPriceTriggeredOrder> listPriceTriggeredOrders(settle, status).contract(contract).limit(limit).offset(offset).execute();
List all auto orders
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String status = "status_example"; // String | List orders based on status
String contract = "BTC_USD"; // String | Futures contract, return related data only if specified
Integer limit = 100; // Integer | Maximum number of records returned in one list
Integer offset = 0; // Integer | List offset, starting from 0
try {
List<FuturesPriceTriggeredOrder> result = apiInstance.listPriceTriggeredOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
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 FuturesApi#listPriceTriggeredOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| status | String | List orders based on status | [enum: open, finished] |
| contract | String | Futures contract, return related data only if specified | [optional] |
| limit | Integer | Maximum number of records returned in one list | [optional] [default to 100] |
| offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
List<FuturesPriceTriggeredOrder>
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
TriggerOrderResponse createPriceTriggeredOrder(settle, futuresPriceTriggeredOrder)
Create a price-triggered order
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
FuturesPriceTriggeredOrder futuresPriceTriggeredOrder = new FuturesPriceTriggeredOrder(); // FuturesPriceTriggeredOrder |
try {
TriggerOrderResponse result = apiInstance.createPriceTriggeredOrder(settle, futuresPriceTriggeredOrder);
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 FuturesApi#createPriceTriggeredOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| futuresPriceTriggeredOrder | FuturesPriceTriggeredOrder |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 201 | Order created | - |
List<FuturesPriceTriggeredOrder> cancelPriceTriggeredOrderList(settle, contract)
Cancel all open orders
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String contract = "BTC_USD"; // String | Futures contract
try {
List<FuturesPriceTriggeredOrder> result = apiInstance.cancelPriceTriggeredOrderList(settle, contract);
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 FuturesApi#cancelPriceTriggeredOrderList");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| contract | String | Futures contract |
List<FuturesPriceTriggeredOrder>
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Batch cancellation request accepted. Query order status by listing orders | - |
FuturesPriceTriggeredOrder getPriceTriggeredOrder(settle, orderId)
Get a single order
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String orderId = "orderId_example"; // String | ID returned on order successfully being created
try {
FuturesPriceTriggeredOrder result = apiInstance.getPriceTriggeredOrder(settle, orderId);
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 FuturesApi#getPriceTriggeredOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| orderId | String | ID returned on order successfully being created |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Auto order detail | - |
FuturesPriceTriggeredOrder cancelPriceTriggeredOrder(settle, orderId)
Cancel a single order
// 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.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.FuturesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
FuturesApi apiInstance = new FuturesApi(defaultClient);
String settle = "btc"; // String | Settle currency
String orderId = "orderId_example"; // String | ID returned on order successfully being created
try {
FuturesPriceTriggeredOrder result = apiInstance.cancelPriceTriggeredOrder(settle, orderId);
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 FuturesApi#cancelPriceTriggeredOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| settle | String | Settle currency | [default to btc] [enum: btc, usdt] |
| orderId | String | ID returned on order successfully being created |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Auto order detail | - |