All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
listOptionsUnderlyings | GET /options/underlyings | List all underlyings |
listOptionsExpirations | GET /options/expirations | List all expiration times |
listOptionsContracts | GET /options/contracts | List all the contracts with specified underlying and expiration time |
getOptionsContract | GET /options/contracts/{contract} | Query specified contract detail |
listOptionsSettlements | GET /options/settlements | List settlement history |
getOptionsSettlement | GET /options/settlements/{contract} | Get specified contract's settlement |
listMyOptionsSettlements | GET /options/my_settlements | List my options settlements |
listOptionsOrderBook | GET /options/order_book | Options order book |
listOptionsTickers | GET /options/tickers | List tickers of options contracts |
listOptionsUnderlyingTickers | GET /options/underlying/tickers/{underlying} | Get underlying ticker |
listOptionsCandlesticks | GET /options/candlesticks | Get options candlesticks |
listOptionsUnderlyingCandlesticks | GET /options/underlying/candlesticks | Mark price candlesticks of an underlying |
listOptionsTrades | GET /options/trades | Options trade history |
listOptionsAccount | GET /options/accounts | List options account |
listOptionsAccountBook | GET /options/account_book | List account changing 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 `open` orders matched |
getOptionsOrder | GET /options/orders/{order_id} | Get a single order |
cancelOptionsOrder | DELETE /options/orders/{order_id} | Cancel a single order |
listMyOptionsTrades | GET /options/my_trades | List personal trading history |
List<OptionsUnderlying> listOptionsUnderlyings()
List all underlyings
// 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
try {
List<OptionsUnderlying> result = apiInstance.listOptionsUnderlyings();
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 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 | - |
List<Long> listOptionsExpirations(underlying)
List all expiration times
// 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String underlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)
try {
List<Long> result = apiInstance.listOptionsExpirations(underlying);
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 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 times of specified underlying | - |
List<OptionsContract> listOptionsContracts(underlying).expiration(expiration).execute();
List all the contracts with specified underlying and expiration time
// 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String underlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)
Long expiration = 1636588800L; // Long | Unix timestamp of the expiration time
try {
List<OptionsContract> result = apiInstance.listOptionsContracts(underlying)
.expiration(expiration)
.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 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 the expiration time | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
OptionsContract getOptionsContract(contract)
Query specified contract 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String contract = "BTC_USDT-20211130-65000-C"; // String |
try {
OptionsContract result = apiInstance.getOptionsContract(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 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 | Successfully retrieved | - |
List<OptionsSettlement> listOptionsSettlements(underlying).limit(limit).offset(offset).from(from).to(to).execute();
List settlement 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String underlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)
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
try {
List<OptionsSettlement> result = apiInstance.listOptionsSettlements(underlying)
.limit(limit)
.offset(offset)
.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 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 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] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
OptionsSettlement getOptionsSettlement(contract, underlying, at)
Get specified contract's settlement
// 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String contract = "BTC_USDT-20211130-65000-C"; // String |
String underlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)
Long at = 56L; // Long |
try {
OptionsSettlement result = apiInstance.getOptionsSettlement(contract, underlying, at);
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 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 | Successfully retrieved | - |
List<OptionsMySettlements> listMyOptionsSettlements(underlying).contract(contract).limit(limit).offset(offset).from(from).to(to).execute();
List my options settlements
// 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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String underlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)
String contract = "BTC_USDT-20210916-5000-C"; // String | Options contract name
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
try {
List<OptionsMySettlements> result = apiInstance.listMyOptionsSettlements(underlying)
.contract(contract)
.limit(limit)
.offset(offset)
.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 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 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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
FuturesOrderBook listOptionsOrderBook(contract).interval(interval).limit(limit).withId(withId).execute();
Options 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String contract = "BTC_USDT-20210916-5000-C"; // String | Options contract name
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.listOptionsOrderBook(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 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 | 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<OptionsTicker> listOptionsTickers(underlying)
List tickers of options 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String underlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)
try {
List<OptionsTicker> result = apiInstance.listOptionsTickers(underlying);
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 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 | Successfully retrieved | - |
OptionsUnderlyingTicker listOptionsUnderlyingTickers(underlying)
Get underlying ticker
// 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String underlying = "BTC_USDT"; // String | Underlying
try {
OptionsUnderlyingTicker result = apiInstance.listOptionsUnderlyingTickers(underlying);
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 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 | Successfully retrieved | - |
List<OptionsCandlestick> listOptionsCandlesticks(contract).limit(limit).from(from).to(to).interval(interval).execute();
Get options candlesticks
// 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String contract = "BTC_USDT-20210916-5000-C"; // String | Options contract name
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 interval = "5m"; // String | Interval time between data points
try {
List<OptionsCandlestick> result = apiInstance.listOptionsCandlesticks(contract)
.limit(limit)
.from(from)
.to(to)
.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 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 to be returned in a single list | [optional] [default to 100] |
from | Long | Start timestamp | [optional] |
to | Long | End timestamp | [optional] |
interval | String | Interval time 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 | Successfully retrieved | - |
List<FuturesCandlestick> listOptionsUnderlyingCandlesticks(underlying).limit(limit).from(from).to(to).interval(interval).execute();
Mark price candlesticks of an underlying
// 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String underlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)
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 interval = "5m"; // String | Interval time between data points
try {
List<FuturesCandlestick> result = apiInstance.listOptionsUnderlyingCandlesticks(underlying)
.limit(limit)
.from(from)
.to(to)
.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 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 to be returned in a single list | [optional] [default to 100] |
from | Long | Start timestamp | [optional] |
to | Long | End timestamp | [optional] |
interval | String | Interval time 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 | Successfully retrieved | - |
List<FuturesTrade> listOptionsTrades().contract(contract).type(type).limit(limit).offset(offset).from(from).to(to).execute();
Options trade 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.OptionsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String contract = "BTC_USDT-20210916-5000-C"; // String | Options contract name
String type = "1546935600"; // String | `C` is call, while `P` is put
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
try {
List<FuturesTrade> result = apiInstance.listOptionsTrades()
.contract(contract)
.type(type)
.limit(limit)
.offset(offset)
.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 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` is call, while `P` is put | [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] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
OptionsAccount listOptionsAccount()
List options 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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
try {
OptionsAccount result = apiInstance.listOptionsAccount();
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 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 | Successfully retrieved | - |
List<OptionsAccountBook> listOptionsAccountBook().limit(limit).offset(offset).from(from).to(to).type(type).execute();
List account changing 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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
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 type = "dnw"; // String | Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL
try {
List<OptionsAccountBook> result = apiInstance.listOptionsAccountBook()
.limit(limit)
.offset(offset)
.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 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 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] |
type | String | Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL | [optional] [enum: dnw, prem, fee, refr, set] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
List<OptionsPosition> listOptionsPositions().underlying(underlying).execute();
List user's positions of specified underlying
// 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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String underlying = "BTC_USDT"; // String | Underlying
try {
List<OptionsPosition> result = apiInstance.listOptionsPositions()
.underlying(underlying)
.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 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 | - |
OptionsPosition getOptionsPosition(contract)
Get specified contract 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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String contract = "BTC_USDT-20211130-65000-C"; // String |
try {
OptionsPosition result = apiInstance.getOptionsPosition(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 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 | Successfully retrieved | - |
List<OptionsPositionClose> listOptionsPositionClose(underlying).contract(contract).execute();
List user's liquidation history of specified underlying
// 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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String underlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)
String contract = "BTC_USDT-20210916-5000-C"; // String | Options contract name
try {
List<OptionsPositionClose> result = apiInstance.listOptionsPositionClose(underlying)
.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 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 | - |
List<OptionsOrder> listOptionsOrders(status).contract(contract).underlying(underlying).limit(limit).offset(offset).from(from).to(to).execute();
List options 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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String status = "open"; // String | Only list the orders with this status
String contract = "BTC_USDT-20210916-5000-C"; // String | Options contract name
String underlying = "BTC_USDT"; // String | Underlying
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
try {
List<OptionsOrder> result = apiInstance.listOptionsOrders(status)
.contract(contract)
.underlying(underlying)
.limit(limit)
.offset(offset)
.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 OptionsApi#listOptionsOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
status | String | Only list the orders with this status | [enum: open, finished] |
contract | String | Options contract name | [optional] |
underlying | String | Underlying | [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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
OptionsOrder createOptionsOrder(optionsOrder)
Create an options 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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
OptionsOrder optionsOrder = new OptionsOrder(); // OptionsOrder |
try {
OptionsOrder result = apiInstance.createOptionsOrder(optionsOrder);
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 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 `open` orders matched
// 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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String contract = "BTC_USDT-20210916-5000-C"; // String | Options contract name
String underlying = "BTC_USDT"; // String | Underlying
String side = "ask"; // String | All bids or asks. Both included if not specified
try {
List<OptionsOrder> result = apiInstance.cancelOptionsOrders(contract, underlying, 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 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 | 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 | - |
OptionsOrder getOptionsOrder(orderId)
Get a single order
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
Long orderId = 12345L; // Long | Order ID returned on successful order creation
try {
OptionsOrder result = apiInstance.getOptionsOrder(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 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 on successful order creation |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Order detail | - |
OptionsOrder cancelOptionsOrder(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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
Long orderId = 12345L; // Long | Order ID returned on successful order creation
try {
OptionsOrder result = apiInstance.cancelOptionsOrder(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 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 on successful order creation |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Order detail | - |
List<OptionsMyTrade> listMyOptionsTrades(underlying).contract(contract).limit(limit).offset(offset).from(from).to(to).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.OptionsApi;
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");
OptionsApi apiInstance = new OptionsApi(defaultClient);
String underlying = "BTC_USDT"; // String | Underlying (Obtained by listing underlying endpoint)
String contract = "BTC_USDT-20210916-5000-C"; // String | Options contract name
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
try {
List<OptionsMyTrade> result = apiInstance.listMyOptionsTrades(underlying)
.contract(contract)
.limit(limit)
.offset(offset)
.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 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 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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |