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 |
listFuturesPremiumIndex | GET /futures/{settle}/premium_index | Premium Index K-Line |
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 |
listContractStats | GET /futures/{settle}/contract_stats | Futures stats |
getIndexConstituents | GET /futures/{settle}/index_constituents/{index} | Get index constituents |
listLiquidatedOrders | GET /futures/{settle}/liq_orders | Retrieve liquidation 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 |
setDualMode | POST /futures/{settle}/dual_mode | Enable or disable dual mode |
getDualModePosition | GET /futures/{settle}/dual_comp/positions/{contract} | Retrieve position detail in dual mode |
updateDualModePositionMargin | POST /futures/{settle}/dual_comp/positions/{contract}/margin | Update position margin in dual mode |
updateDualModePositionLeverage | POST /futures/{settle}/dual_comp/positions/{contract}/leverage | Update position leverage in dual mode |
updateDualModePositionRiskLimit | POST /futures/{settle}/dual_comp/positions/{contract}/risk_limit | Update position risk limit in dual mode |
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 |
getOrdersWithTimeRange | GET /futures/{settle}/orders_timerange | List Futures Orders By Time Range |
createBatchFuturesOrder | POST /futures/{settle}/batch_orders | Create a batch of futures orders |
getFuturesOrder | GET /futures/{settle}/orders/{order_id} | Get a single order |
amendFuturesOrder | PUT /futures/{settle}/orders/{order_id} | Amend an order |
cancelFuturesOrder | DELETE /futures/{settle}/orders/{order_id} | Cancel a single order |
getMyTrades | GET /futures/{settle}/my_trades | List personal trading history |
getMyTradesWithTimeRange | GET /futures/{settle}/my_trades_timerange | List personal trading history by time range |
listPositionClose | GET /futures/{settle}/position_close | List position close history |
listLiquidates | GET /futures/{settle}/liquidates | List liquidation history |
listAutoDeleverages | GET /futures/{settle}/auto_deleverages | List Auto-Deleveraging History |
countdownCancelAllFutures | POST /futures/{settle}/countdown_cancel_all | Countdown cancel orders |
getFuturesFee | GET /futures/{settle}/fee | Query user trading fee rates |
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 price-triggered order |
cancelPriceTriggeredOrder | DELETE /futures/{settle}/price_orders/{order_id} | cancel a price-triggered 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 = "usdt"; // 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 | [enum: btc, usdt, usd] |
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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // 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 | [enum: btc, usdt, usd] |
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).withId(withId).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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // 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
Boolean withId = false; // Boolean | Whether the order book update ID will be returned. This ID increases by 1 on every order book update
try {
FuturesOrderBook result = apiInstance.listFuturesOrderBook(settle, contract)
.interval(interval)
.limit(limit)
.withId(withId)
.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 | [enum: btc, usdt, usd] |
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] |
withId | Boolean | Whether the order book update ID will be returned. This ID increases by 1 on every order book update | [optional] [default to false] |
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).offset(offset).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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
Integer offset = 0; // Integer | List offset, starting from 0
String lastId = "12345"; // String | Specify the starting point for this list based on a previously retrieved id 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)
.offset(offset)
.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 | [enum: btc, usdt, usd] |
contract | String | Futures contract | |
limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
lastId | String | Specify the starting point for this list based on a previously retrieved id 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // 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 to return. `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. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0. Note that 30d means 1 natual month, not 30 days
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 | [enum: btc, usdt, usd] |
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 to return. `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. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0. Note that 30d means 1 natual month, not 30 days | [optional] [default to 5m] [enum: 10s, 30s, 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 7d, 1w, 30d] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
List<FuturesPremiumIndex> listFuturesPremiumIndex(settle, contract).from(from).to(to).limit(limit).interval(interval).execute();
Premium Index K-Line
Maximum of 1000 points can be returned in a 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // 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 to return. `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<FuturesPremiumIndex> result = apiInstance.listFuturesPremiumIndex(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#listFuturesPremiumIndex");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
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 to return. `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: 1m, 5m, 15m, 30m, 1h, 4h, 6h, 8h, 1d, 7d, 30d] |
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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // 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 | [enum: btc, usdt, usd] |
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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract
Integer limit = 100; // Integer | Maximum number of records to be returned in a single 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 | [enum: btc, usdt, usd] |
contract | String | Futures contract | |
limit | Integer | Maximum number of records to be returned in a single 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 = "usdt"; // String | Settle currency
Integer limit = 100; // Integer | Maximum number of records to be returned in a single 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 | [enum: btc, usdt, usd] |
limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
List<ContractStat> listContractStats(settle, contract).from(from).interval(interval).limit(limit).execute();
Futures stats
// 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract
Long from = 1604561000L; // Long | Start timestamp
String interval = "5m"; // String |
Integer limit = 30; // Integer |
try {
List<ContractStat> result = apiInstance.listContractStats(settle, contract)
.from(from)
.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#listContractStats");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
contract | String | Futures contract | |
from | Long | Start timestamp | [optional] |
interval | String | [optional] [default to 5m] [enum: 5m, 15m, 30m, 1h, 4h, 1d] | |
limit | Integer | [optional] [default to 30] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
FuturesIndexConstituents getIndexConstituents(settle, index)
Get index constituents
// 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 = "usdt"; // String | Settle currency
String index = "BTC_USDT"; // String | Index name
try {
FuturesIndexConstituents result = apiInstance.getIndexConstituents(settle, index);
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#getIndexConstituents");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
index | String | Index name |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
List<FuturesLiqOrder> listLiquidatedOrders(settle).contract(contract).from(from).to(to).limit(limit).execute();
Retrieve liquidation history
Interval between `from` and `to` cannot exceeds 3600. Some private fields will not be returned in public endpoints. Refer to field description for detail.
// 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract, return related data only if specified
Long from = 1547706332L; // Long | Start timestamp
Long to = 1547706332L; // Long | End timestamp
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
try {
List<FuturesLiqOrder> result = apiInstance.listLiquidatedOrders(settle)
.contract(contract)
.from(from)
.to(to)
.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#listLiquidatedOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
contract | String | Futures contract, return related data only if specified | [optional] |
from | Long | Start timestamp | [optional] |
to | Long | End timestamp | [optional] |
limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List 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 = "usdt"; // 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 | [enum: btc, usdt, usd] |
- 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 = "usdt"; // String | Settle currency
Integer limit = 100; // Integer | Maximum number of records to be returned in a single 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 | [enum: btc, usdt, usd] |
limit | Integer | Maximum number of records to be returned in a single 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).holding(holding).execute();
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 = "usdt"; // String | Settle currency
Boolean holding = true; // Boolean | Return only real positions - true, return all - false.
try {
List<Position> result = apiInstance.listPositions(settle)
.holding(holding)
.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#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 | [enum: btc, usdt, usd] |
holding | Boolean | Return only real positions - true, return all - false. | [optional] |
- 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // 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 | [enum: btc, usdt, usd] |
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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // 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 | [enum: btc, usdt, usd] |
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, crossLeverageLimit)
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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract
String leverage = "10"; // String | New position leverage
String crossLeverageLimit = "10"; // String | Cross margin leverage(valid only when `leverage` is 0)
try {
Position result = apiInstance.updatePositionLeverage(settle, contract, leverage, crossLeverageLimit);
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 | [enum: btc, usdt, usd] |
contract | String | Futures contract | |
leverage | String | New position leverage | |
crossLeverageLimit | String | Cross margin leverage(valid only when `leverage` is 0) | [optional] |
- 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // 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 | [enum: btc, usdt, usd] |
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 | - |
FuturesAccount setDualMode(settle, dualMode)
Enable or disable dual mode
Before setting dual mode, make sure all positions are closed and no orders are open
// 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 = "usdt"; // String | Settle currency
Boolean dualMode = true; // Boolean | Whether to enable dual mode
try {
FuturesAccount result = apiInstance.setDualMode(settle, dualMode);
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#setDualMode");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
dualMode | Boolean | Whether to enable dual mode |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Updated | - |
List<Position> getDualModePosition(settle, contract)
Retrieve position detail in dual mode
// 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract
try {
List<Position> result = apiInstance.getDualModePosition(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#getDualModePosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
contract | String | Futures contract |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
List<Position> updateDualModePositionMargin(settle, contract, change, dualSide)
Update position margin in dual mode
// 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract
String change = "0.01"; // String | Margin change. Use positive number to increase margin, negative number otherwise.
String dualSide = "dual_long"; // String | Long or short position
try {
List<Position> result = apiInstance.updateDualModePositionMargin(settle, contract, change, dualSide);
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#updateDualModePositionMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
contract | String | Futures contract | |
change | String | Margin change. Use positive number to increase margin, negative number otherwise. | |
dualSide | String | Long or short position | [enum: dual_long, dual_short] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
List<Position> updateDualModePositionLeverage(settle, contract, leverage, crossLeverageLimit)
Update position leverage in dual mode
// 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract
String leverage = "10"; // String | New position leverage
String crossLeverageLimit = "10"; // String | Cross margin leverage(valid only when `leverage` is 0)
try {
List<Position> result = apiInstance.updateDualModePositionLeverage(settle, contract, leverage, crossLeverageLimit);
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#updateDualModePositionLeverage");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
contract | String | Futures contract | |
leverage | String | New position leverage | |
crossLeverageLimit | String | Cross margin leverage(valid only when `leverage` is 0) | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
List<Position> updateDualModePositionRiskLimit(settle, contract, riskLimit)
Update position risk limit in dual mode
// 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract
String riskLimit = "10"; // String | New position risk limit
try {
List<Position> result = apiInstance.updateDualModePositionRiskLimit(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#updateDualModePositionRiskLimit");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
contract | String | Futures contract | |
riskLimit | String | New position risk limit |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
List<FuturesOrder> listFuturesOrders(settle, status).contract(contract).limit(limit).offset(offset).lastId(lastId).execute();
List futures orders
Zero-filled order cannot be retrieved 10 minutes after order 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 = "usdt"; // String | Settle currency
String status = "open"; // String | Only list the orders with this status
String contract = "BTC_USDT"; // String | Futures contract, return related data only if specified
Integer limit = 100; // Integer | Maximum number of records to be returned in a single 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
try {
List<FuturesOrder> result = apiInstance.listFuturesOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.lastId(lastId)
.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 | [enum: btc, usdt, usd] |
status | String | Only list the orders with this status | [enum: open, finished] |
contract | String | Futures contract, return related data only if specified | [optional] |
limit | Integer | Maximum number of records to be returned in a single 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] |
- 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 |
FuturesOrder createFuturesOrder(settle, futuresOrder)
Create a futures order
- Creating futures orders requires `size`, which is number of contracts instead of currency amount. You can use `quanto_multiplier` in contract detail response to know how much currency 1 size contract represents - Zero-filled order cannot be retrieved 10 minutes after order cancellation. You will get a 404 not found for such orders - Set `reduce_only` to `true` can keep the position from changing side when reducing position size - In single position mode, to close a position, you need to set `size` to 0 and `close` to `true` - In dual position mode, to close one side position, you need to set `auto_size` side, `reduce_only` to true and `size` to 0 - Set `stp_act` to decide the strategy of self-trade prevention. For detailed usage, refer to the `stp_act` parameter in request body
// 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 = "usdt"; // 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 | [enum: btc, usdt, usd] |
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-filled order cannot be retrieved 10 minutes after order 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract
String side = "ask"; // String | All bids or asks. Both included if 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 | [enum: btc, usdt, usd] |
contract | String | Futures contract | |
side | String | All bids or asks. Both included if not specified | [optional] [enum: ask, bid] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | All orders matched cancelled | - |
List<FuturesOrder> getOrdersWithTimeRange(settle).contract(contract).from(from).to(to).limit(limit).offset(offset).execute();
List Futures Orders By Time Range
// 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract, return related data only if specified
Long from = 1547706332L; // Long | Start timestamp
Long to = 1547706332L; // Long | End timestamp
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
Integer offset = 0; // Integer | List offset, starting from 0
try {
List<FuturesOrder> result = apiInstance.getOrdersWithTimeRange(settle)
.contract(contract)
.from(from)
.to(to)
.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#getOrdersWithTimeRange");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
contract | String | Futures contract, return related data only if specified | [optional] |
from | Long | Start timestamp | [optional] |
to | Long | End timestamp | [optional] |
limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
- 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 |
List<BatchFuturesOrder> createBatchFuturesOrder(settle, futuresOrder)
Create a batch of futures orders
- Up to 10 orders per request - If any of the order's parameters are missing or in the wrong format, all of them will not be executed, and a http status 400 error will be returned directly - If the parameters are checked and passed, all are executed. Even if there is a business logic error in the middle (such as insufficient funds), it will not affect other execution orders - The returned result is in array format, and the order corresponds to the orders in the request body - In the returned result, the `succeeded` field of type bool indicates whether the execution was successful or not - If the execution is successful, the normal order content is included; if the execution fails, the `label` field is included to indicate the cause of the error - In the rate limiting, each order is counted individually
// 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 = "usdt"; // String | Settle currency
List<FuturesOrder> futuresOrder = Arrays.asList(); // List<FuturesOrder> |
try {
List<BatchFuturesOrder> result = apiInstance.createBatchFuturesOrder(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#createBatchFuturesOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
futuresOrder | List<FuturesOrder> |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Request is completed | - |
FuturesOrder getFuturesOrder(settle, orderId)
Get a single order
Zero-filled order cannot be retrieved 10 minutes after order 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 = "usdt"; // String | Settle currency
String orderId = "12345"; // String | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted.
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 | [enum: btc, usdt, usd] |
orderId | String | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Order details | - |
FuturesOrder amendFuturesOrder(settle, orderId, futuresOrderAmendment)
Amend an 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 = "usdt"; // String | Settle currency
String orderId = "12345"; // String | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted.
FuturesOrderAmendment futuresOrderAmendment = new FuturesOrderAmendment(); // FuturesOrderAmendment |
try {
FuturesOrder result = apiInstance.amendFuturesOrder(settle, orderId, futuresOrderAmendment);
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#amendFuturesOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
orderId | String | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. | |
futuresOrderAmendment | FuturesOrderAmendment |
- Content-Type: application/json
- 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 = "usdt"; // String | Settle currency
String orderId = "12345"; // String | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted.
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 | [enum: btc, usdt, usd] |
orderId | String | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. |
- 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).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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // 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 to be returned in a single list
Integer offset = 0; // Integer | List offset, starting from 0
String lastId = "12345"; // String | Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. If you need to iterate through and retrieve more records, we recommend using 'GET /futures/{settle}/my_trades_timerange'.
try {
List<MyFuturesTrade> result = apiInstance.getMyTrades(settle)
.contract(contract)
.order(order)
.limit(limit)
.offset(offset)
.lastId(lastId)
.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 | [enum: btc, usdt, usd] |
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 to be returned in a single list | [optional] [default to 100] |
offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
lastId | String | Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. If you need to iterate through and retrieve more records, we recommend using 'GET /futures/{settle}/my_trades_timerange'. | [optional] |
- 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 |
List<MyFuturesTradeTimeRange> getMyTradesWithTimeRange(settle).contract(contract).from(from).to(to).limit(limit).offset(offset).role(role).execute();
List personal trading history by time range
// 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract, return related data only if specified
Long from = 1547706332L; // Long | Start timestamp
Long to = 1547706332L; // Long | End timestamp
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
Integer offset = 0; // Integer | List offset, starting from 0
String role = "maker"; // String | Query role, maker or taker.
try {
List<MyFuturesTradeTimeRange> result = apiInstance.getMyTradesWithTimeRange(settle)
.contract(contract)
.from(from)
.to(to)
.limit(limit)
.offset(offset)
.role(role)
.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#getMyTradesWithTimeRange");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
contract | String | Futures contract, return related data only if specified | [optional] |
from | Long | Start timestamp | [optional] |
to | Long | End timestamp | [optional] |
limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
role | String | Query role, maker or taker. | [optional] |
- 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 |
List<PositionClose> listPositionClose(settle).contract(contract).limit(limit).offset(offset).from(from).to(to).side(side).pnl(pnl).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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract, return related data only if specified
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
Integer offset = 0; // Integer | List offset, starting from 0
Long from = 1547706332L; // Long | Start timestamp
Long to = 1547706332L; // Long | End timestamp
String side = "short"; // String | Query side. long or shot
String pnl = "profit"; // String | Query profit or loss
try {
List<PositionClose> result = apiInstance.listPositionClose(settle)
.contract(contract)
.limit(limit)
.offset(offset)
.from(from)
.to(to)
.side(side)
.pnl(pnl)
.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 | [enum: btc, usdt, usd] |
contract | String | Futures contract, return related data only if specified | [optional] |
limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
from | Long | Start timestamp | [optional] |
to | Long | End timestamp | [optional] |
side | String | Query side. long or shot | [optional] |
pnl | String | Query profit or loss | [optional] |
- 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract, return related data only if specified
Integer limit = 100; // Integer | Maximum number of records to be returned in a single 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 | [enum: btc, usdt, usd] |
contract | String | Futures contract, return related data only if specified | [optional] |
limit | Integer | Maximum number of records to be returned in a single 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<FuturesAutoDeleverage> listAutoDeleverages(settle).contract(contract).limit(limit).at(at).execute();
List Auto-Deleveraging 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract, return related data only if specified
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
Integer at = 0; // Integer | Specify an auto-deleveraging timestamp
try {
List<FuturesAutoDeleverage> result = apiInstance.listAutoDeleverages(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#listAutoDeleverages");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
contract | String | Futures contract, return related data only if specified | [optional] |
limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
at | Integer | Specify an auto-deleveraging timestamp | [optional] [default to 0] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
TriggerTime countdownCancelAllFutures(settle, countdownCancelAllFuturesTask)
Countdown cancel orders
When the timeout set by the user is reached, if there is no cancel or set a new countdown, the related pending orders will be automatically cancelled. This endpoint can be called repeatedly to set a new countdown or cancel the countdown. For example, call this endpoint at 30s intervals, each countdown`timeout` is set to 30s. If this endpoint is not called again within 30 seconds, all pending orders on the specified `market` will be automatically cancelled, if no `market` is specified, all market pending orders will be cancelled. If the `timeout` is set to 0 within 30 seconds, the countdown timer will expire and the cacnel function will be cancelled.
// 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 = "usdt"; // String | Settle currency
CountdownCancelAllFuturesTask countdownCancelAllFuturesTask = new CountdownCancelAllFuturesTask(); // CountdownCancelAllFuturesTask |
try {
TriggerTime result = apiInstance.countdownCancelAllFutures(settle, countdownCancelAllFuturesTask);
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#countdownCancelAllFutures");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
countdownCancelAllFuturesTask | CountdownCancelAllFuturesTask |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Set countdown successfully | - |
Map<String, FuturesFee> getFuturesFee(settle).contract(contract).execute();
Query user trading fee rates
// 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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // String | Futures contract, return related data only if specified
try {
Map<String, FuturesFee> result = apiInstance.getFuturesFee(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#getFuturesFee");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | String | Settle currency | [enum: btc, usdt, usd] |
contract | String | Futures contract, return related data only if specified | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully 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 = "usdt"; // String | Settle currency
String status = "status_example"; // String | Only list the orders with this status
String contract = "BTC_USDT"; // String | Futures contract, return related data only if specified
Integer limit = 100; // Integer | Maximum number of records to be returned in a single 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 | [enum: btc, usdt, usd] |
status | String | Only list the orders with this status | [enum: open, finished] |
contract | String | Futures contract, return related data only if specified | [optional] |
limit | Integer | Maximum number of records to be returned in a single 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 = "usdt"; // 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 | [enum: btc, usdt, usd] |
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 = "usdt"; // String | Settle currency
String contract = "BTC_USDT"; // 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 | [enum: btc, usdt, usd] |
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 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 = "usdt"; // String | Settle currency
String orderId = "orderId_example"; // String | Retrieve the data of the order with the specified ID
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 | [enum: btc, usdt, usd] |
orderId | String | Retrieve the data of the order with the specified ID |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Auto order detail | - |
FuturesPriceTriggeredOrder cancelPriceTriggeredOrder(settle, orderId)
cancel 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 = "usdt"; // String | Settle currency
String orderId = "orderId_example"; // String | Retrieve the data of the order with the specified ID
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 | [enum: btc, usdt, usd] |
orderId | String | Retrieve the data of the order with the specified ID |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Auto order detail | - |