All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| listOptionsUnderlyings | GET /options/underlyings | List all underlying assets |
| listOptionsExpirations | GET /options/expirations | List all expiration dates |
| listOptionsContracts | GET /options/contracts | List all contracts for specified underlying and expiration date |
| getOptionsContract | GET /options/contracts/{contract} | Query specified contract details |
| listOptionsSettlements | GET /options/settlements | List settlement history |
| getOptionsSettlement | GET /options/settlements/{contract} | Get specified contract settlement information |
| listMyOptionsSettlements | GET /options/my_settlements | Query personal settlement records |
| listOptionsOrderBook | GET /options/order_book | Query options contract order book |
| listOptionsTickers | GET /options/tickers | Query options market ticker information |
| listOptionsUnderlyingTickers | GET /options/underlying/tickers/{underlying} | Query underlying ticker information |
| listOptionsCandlesticks | GET /options/candlesticks | Options contract market candlestick chart |
| listOptionsUnderlyingCandlesticks | GET /options/underlying/candlesticks | Underlying index price candlestick chart |
| listOptionsTrades | GET /options/trades | Market trade records |
| listOptionsAccount | GET /options/accounts | Query account information |
| listOptionsAccountBook | GET /options/account_book | Query account change history |
| listOptionsPositions | GET /options/positions | List user's positions of specified underlying |
| getOptionsPosition | GET /options/positions/{contract} | Get specified contract position |
| listOptionsPositionClose | GET /options/position_close | List user's liquidation history of specified underlying |
| listOptionsOrders | GET /options/orders | List options orders |
| createOptionsOrder | POST /options/orders | Create an options order |
| cancelOptionsOrders | DELETE /options/orders | Cancel all orders with 'open' status |
| getOptionsOrder | GET /options/orders/{order_id} | Query single order details |
| amendOptionsOrder | PUT /options/orders/{order_id} | Option Order Modification |
| cancelOptionsOrder | DELETE /options/orders/{order_id} | Cancel single order |
| countdownCancelAllOptions | POST /options/countdown_cancel_all | Countdown cancel orders |
| listMyOptionsTrades | GET /options/my_trades | Query personal trading records |
| getOptionsMMP | GET /options/mmp | MMP Query. |
| setOptionsMMP | POST /options/mmp | MMP Settings |
| resetOptionsMMP | POST /options/mmp/reset | MMP Reset |
List<OptionsUnderlying> listOptionsUnderlyings()
List all underlying assets
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
try {
List<OptionsUnderlying> result = apiInstance.listOptionsUnderlyings();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsUnderlyings");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}This endpoint does not need any parameter.
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
List<Long> listOptionsExpirations(underlying)
List all expiration dates
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)try {
List<Long> result = apiInstance.listOptionsExpirations(underlying);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsExpirations");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying (Obtained by listing underlying endpoint) |
List<Long>
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List expiration dates for specified underlying | - |
List<OptionsContract> listOptionsContracts(underlying).expiration(expiration).execute();
List all contracts for specified underlying and expiration date
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)Longexpiration = 1636588800L; // Long | Unix timestamp of expiration datetry {
List<OptionsContract> result = apiInstance.listOptionsContracts(underlying)
.expiration(expiration)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying (Obtained by listing underlying endpoint) | |
| expiration | Long | Unix timestamp of expiration date | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
OptionsContract getOptionsContract(contract)
Query specified contract details
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringcontract = "BTC_USDT-20211130-65000-C"; // String | try {
OptionsContractresult = apiInstance.getOptionsContract(contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#getOptionsContract");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| contract | String |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Query successful | - |
List<OptionsSettlement> listOptionsSettlements(underlying).limit(limit).offset(offset).from(from).to(to).execute();
List settlement history
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)Integerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0Longfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamptry {
List<OptionsSettlement> result = apiInstance.listOptionsSettlements(underlying)
.limit(limit)
.offset(offset)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsSettlements");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying (Obtained by listing underlying endpoint) | |
| limit | Integer | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
| from | Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) | [optional] |
| to | Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
OptionsSettlement getOptionsSettlement(contract, underlying, at)
Get specified contract settlement information
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringcontract = "BTC_USDT-20211130-65000-C"; // String | Stringunderlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)Longat = 56L; // Long | try {
OptionsSettlementresult = apiInstance.getOptionsSettlement(contract, underlying, at);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#getOptionsSettlement");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| contract | String | ||
| underlying | String | Underlying (Obtained by listing underlying endpoint) | |
| at | Long |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Query successful | - |
List<OptionsMySettlements> listMyOptionsSettlements(underlying).contract(contract).limit(limit).offset(offset).from(from).to(to).execute();
Query personal settlement records
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)Stringcontract = "BTC_USDT-20210916-5000-C"; // String | Options contract nameIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0Longfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamptry {
List<OptionsMySettlements> result = apiInstance.listMyOptionsSettlements(underlying)
.contract(contract)
.limit(limit)
.offset(offset)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listMyOptionsSettlements");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying (Obtained by listing underlying endpoint) | |
| contract | String | Options contract name | [optional] |
| limit | Integer | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
| from | Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) | [optional] |
| to | Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
OptionsOrderBook listOptionsOrderBook(contract).interval(interval).limit(limit).withId(withId).execute();
Query options contract order book
Bids will be sorted by price from high to low, while asks sorted reversely
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringcontract = "BTC_USDT-20210916-5000-C"; // String | Options contract nameStringinterval = "0"; // String | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0Integerlimit = 10; // Integer | Number of depth levelsBooleanwithId = false; // Boolean | Whether to return depth update ID. This ID increments by 1 each time the depth changestry {
OptionsOrderBookresult = apiInstance.listOptionsOrderBook(contract)
.interval(interval)
.limit(limit)
.withId(withId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsOrderBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| contract | String | Options contract name | |
| interval | String | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 | [optional] [default to 0] [enum: 0, 0.1, 0.01] |
| limit | Integer | Number of depth levels | [optional] [default to 10] |
| withId | Boolean | Whether to return depth update ID. This ID increments by 1 each time the depth changes | [optional] [default to false] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Depth query successful | - |
List<OptionsTicker> listOptionsTickers(underlying)
Query options market ticker information
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)try {
List<OptionsTicker> result = apiInstance.listOptionsTickers(underlying);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying (Obtained by listing underlying endpoint) |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Query successful | - |
OptionsUnderlyingTicker listOptionsUnderlyingTickers(underlying)
Query underlying ticker information
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlyingtry {
OptionsUnderlyingTickerresult = apiInstance.listOptionsUnderlyingTickers(underlying);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsUnderlyingTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Query successful | - |
List<OptionsCandlestick> listOptionsCandlesticks(contract).limit(limit).from(from).to(to).interval(interval).execute();
Options contract market candlestick chart
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringcontract = "BTC_USDT-20210916-5000-C"; // String | Options contract nameIntegerlimit = 100; // Integer | Maximum number of records returned in a single listLongfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringinterval = "5m"; // String | Time interval between data pointstry {
List<OptionsCandlestick> result = apiInstance.listOptionsCandlesticks(contract)
.limit(limit)
.from(from)
.to(to)
.interval(interval)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| contract | String | Options contract name | |
| limit | Integer | Maximum number of records returned in a single list | [optional] [default to 100] |
| from | Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) | [optional] |
| to | Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] |
| interval | String | Time interval between data points | [optional] [default to 5m] [enum: 1m, 5m, 15m, 30m, 1h] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Query successful | - |
List<OptionsCandlestick> listOptionsUnderlyingCandlesticks(underlying).limit(limit).from(from).to(to).interval(interval).execute();
Underlying index price candlestick chart
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)Integerlimit = 100; // Integer | Maximum number of records returned in a single listLongfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringinterval = "5m"; // String | Time interval between data pointstry {
List<OptionsCandlestick> result = apiInstance.listOptionsUnderlyingCandlesticks(underlying)
.limit(limit)
.from(from)
.to(to)
.interval(interval)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsUnderlyingCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying (Obtained by listing underlying endpoint) | |
| limit | Integer | Maximum number of records returned in a single list | [optional] [default to 100] |
| from | Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) | [optional] |
| to | Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] |
| interval | String | Time interval between data points | [optional] [default to 5m] [enum: 1m, 5m, 15m, 30m, 1h] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Query successful | - |
List<OptionsTrade> listOptionsTrades().contract(contract).type(type).limit(limit).offset(offset).from(from).to(to).execute();
Market trade records
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringcontract = "BTC_USDT-20210916-5000-C"; // String | Options contract nameStringtype = "1546935600"; // String | `C` for call, `P` for putIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0Longfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamptry {
List<OptionsTrade> result = apiInstance.listOptionsTrades()
.contract(contract)
.type(type)
.limit(limit)
.offset(offset)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| contract | String | Options contract name | [optional] |
| type | String | `C` for call, `P` for put | [optional] |
| limit | Integer | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
| from | Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) | [optional] |
| to | Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
OptionsAccount listOptionsAccount()
Query account information
Query account information for classic option account and unified account
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
try {
OptionsAccountresult = apiInstance.listOptionsAccount();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsAccount");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Query successful | - |
List<OptionsAccountBook> listOptionsAccountBook().limit(limit).offset(offset).from(from).to(to).type(type).execute();
Query account change history
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Integerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0Longfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringtype = "dnw"; // String | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&Ltry {
List<OptionsAccountBook> result = apiInstance.listOptionsAccountBook()
.limit(limit)
.offset(offset)
.from(from)
.to(to)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| limit | Integer | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
| from | Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) | [optional] |
| to | Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] |
| type | String | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L | [optional] [enum: dnw, prem, fee, refr, set] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
List<OptionsPosition> listOptionsPositions().underlying(underlying).execute();
List user's positions of specified underlying
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlyingtry {
List<OptionsPosition> result = apiInstance.listOptionsPositions()
.underlying(underlying)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsPositions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
OptionsPosition getOptionsPosition(contract)
Get specified contract position
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringcontract = "BTC_USDT-20211130-65000-C"; // String | try {
OptionsPositionresult = apiInstance.getOptionsPosition(contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#getOptionsPosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| contract | String |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Query successful | - |
List<OptionsPositionClose> listOptionsPositionClose(underlying).contract(contract).execute();
List user's liquidation history of specified underlying
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)Stringcontract = "BTC_USDT-20210916-5000-C"; // String | Options contract nametry {
List<OptionsPositionClose> result = apiInstance.listOptionsPositionClose(underlying)
.contract(contract)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsPositionClose");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying (Obtained by listing underlying endpoint) | |
| contract | String | Options contract name | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
List<OptionsOrder> listOptionsOrders(status).contract(contract).underlying(underlying).limit(limit).offset(offset).from(from).to(to).execute();
List options orders
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringstatus = "open"; // String | Query order list based on statusStringcontract = "BTC_USDT-20210916-5000-C"; // String | Options contract nameStringunderlying = "BTC_USDT"; // String | UnderlyingIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0Longfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamptry {
List<OptionsOrder> result = apiInstance.listOptionsOrders(status)
.contract(contract)
.underlying(underlying)
.limit(limit)
.offset(offset)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listOptionsOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| status | String | Query order list based on status | [enum: open, finished] |
| contract | String | Options contract name | [optional] |
| underlying | String | Underlying | [optional] |
| limit | Integer | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
| from | Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) | [optional] |
| to | Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
OptionsOrder createOptionsOrder(optionsOrder)
Create an options order
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
OptionsOrderoptionsOrder = newOptionsOrder(); // OptionsOrder | try {
OptionsOrderresult = apiInstance.createOptionsOrder(optionsOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#createOptionsOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| optionsOrder | OptionsOrder |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 201 | Order detail | - |
List<OptionsOrder> cancelOptionsOrders(contract, underlying, side)
Cancel all orders with 'open' status
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringcontract = "BTC_USDT-20210916-5000-C"; // String | Options contract nameStringunderlying = "BTC_USDT"; // String | UnderlyingStringside = "ask"; // String | Specify all bids or all asks, both included if not specifiedtry {
List<OptionsOrder> result = apiInstance.cancelOptionsOrders(contract, underlying, side);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#cancelOptionsOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| contract | String | Options contract name | [optional] |
| underlying | String | Underlying | [optional] |
| side | String | Specify all bids or all asks, both included if not specified | [optional] [enum: ask, bid] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Batch cancellation successful | - |
OptionsOrder getOptionsOrder(orderId)
Query single order details
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
LongorderId = 12345L; // Long | Order ID returned when order is successfully createdtry {
OptionsOrderresult = apiInstance.getOptionsOrder(orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#getOptionsOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | Long | Order ID returned when order is successfully created |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order detail | - |
OptionsOrder amendOptionsOrder(orderId, amendOptionsOrderRequest)
Option Order Modification
Modify the order price and/or quantity of a specified order; only orders with status 'open' are supported
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
LongorderId = 12345L; // Long | Order ID returned when order is successfully createdAmendOptionsOrderRequestamendOptionsOrderRequest = newAmendOptionsOrderRequest(); // AmendOptionsOrderRequest | try {
OptionsOrderresult = apiInstance.amendOptionsOrder(orderId, amendOptionsOrderRequest);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#amendOptionsOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | Long | Order ID returned when order is successfully created | |
| amendOptionsOrderRequest | AmendOptionsOrderRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order detail | - |
OptionsOrder cancelOptionsOrder(orderId)
Cancel single order
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
LongorderId = 12345L; // Long | Order ID returned when order is successfully createdtry {
OptionsOrderresult = apiInstance.cancelOptionsOrder(orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#cancelOptionsOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | Long | Order ID returned when order is successfully created |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order detail | - |
TriggerTime countdownCancelAllOptions(countdownCancelAllOptionsTask)
Countdown cancel orders
Option order heartbeat detection, when the `timeout` time set by the user is reached, if the existing countdown is not canceled or a new countdown is set, the related `option pending order` will be automatically canceled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at intervals of 30 seconds, with each countdown `timeout` set to 30 (seconds). If this interface is not called again within 30 seconds, all pending orders on the `underlying` `contract` you specified will be automatically cancelled. If `underlying` `contract` is not specified, user will be automatically cancelled If `timeout` is set to 0 within 30 seconds, the countdown timer will expire and the automatic order cancellation function will be cancelled.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
CountdownCancelAllOptionsTaskcountdownCancelAllOptionsTask = newCountdownCancelAllOptionsTask(); // CountdownCancelAllOptionsTask | try {
TriggerTimeresult = apiInstance.countdownCancelAllOptions(countdownCancelAllOptionsTask);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#countdownCancelAllOptions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| countdownCancelAllOptionsTask | CountdownCancelAllOptionsTask |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Countdown set successfully | - |
List<OptionsMyTrade> listMyOptionsTrades(underlying).contract(contract).limit(limit).offset(offset).from(from).to(to).execute();
Query personal trading records
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)Stringcontract = "BTC_USDT-20210916-5000-C"; // String | Options contract nameIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0Longfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamptry {
List<OptionsMyTrade> result = apiInstance.listMyOptionsTrades(underlying)
.contract(contract)
.limit(limit)
.offset(offset)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#listMyOptionsTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying (Obtained by listing underlying endpoint) | |
| contract | String | Options contract name | [optional] |
| limit | Integer | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | Integer | List offset, starting from 0 | [optional] [default to 0] |
| from | Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) | [optional] |
| to | Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
List<OptionsMMP> getOptionsMMP().underlying(underlying).execute();
MMP Query.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
Stringunderlying = "BTC_USDT"; // String | Underlyingtry {
List<OptionsMMP> result = apiInstance.getOptionsMMP()
.underlying(underlying)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#getOptionsMMP");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | String | Underlying | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Query successful | - |
OptionsMMP setOptionsMMP(optionsMMP)
MMP Settings
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
OptionsMMPoptionsMMP = newOptionsMMP(); // OptionsMMP | try {
OptionsMMPresult = apiInstance.setOptionsMMP(optionsMMP);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#setOptionsMMP");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| optionsMMP | OptionsMMP |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | MMP Information | - |
OptionsMMP resetOptionsMMP(optionsMMPReset)
MMP Reset
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.OptionsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
OptionsApiapiInstance = newOptionsApi(defaultClient);
OptionsMMPResetoptionsMMPReset = newOptionsMMPReset(); // OptionsMMPReset | try {
OptionsMMPresult = apiInstance.resetOptionsMMP(optionsMMPReset);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling OptionsApi#resetOptionsMMP");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| optionsMMPReset | OptionsMMPReset |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | MMP Information | - |