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 |
| 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 |
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsUnderlyings()
List all underlying assets
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
api.listOptionsUnderlyings()
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));This endpoint does not need any parameter.
Promise<{ response: AxiosResponse; body: Array; }> OptionsUnderlying
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsExpirations(underlying)
List all expiration dates
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const underlying = "BTC_USDT"; // string | Underlying (Obtained by listing underlying endpoint)
api.listOptionsExpirations(underlying)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying (Obtained by listing underlying endpoint) | [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> number
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsContracts(underlying, opts)
List all contracts for specified underlying and expiration date
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const underlying = "BTC_USDT"; // string | Underlying (Obtained by listing underlying endpoint)
const opts = {
'expiration': 1636588800 // number | Unix timestamp of expiration date
};
api.listOptionsContracts(underlying, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying (Obtained by listing underlying endpoint) | [default to undefined] |
| expiration | number | Unix timestamp of expiration date | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsContract
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: OptionsContract; }> getOptionsContract(contract)
Query specified contract details
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const contract = "BTC_USDT-20211130-65000-C"; // string |
api.getOptionsContract(contract)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| contract | string | [default to undefined] |
Promise<{ response: AxiosResponse; body: OptionsContract; }> OptionsContract
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsSettlements(underlying, opts)
List settlement history
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const underlying = "BTC_USDT"; // string | Underlying (Obtained by listing underlying endpoint)
const opts = {
'limit': 100, // number | Maximum number of records returned in a single list
'offset': 0, // number | List offset, starting from 0
'from': 1547706332, // number | 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)
'to': 1547706332 // number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp
};
api.listOptionsSettlements(underlying, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying (Obtained by listing underlying endpoint) | [default to undefined] |
| limit | number | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | number | List offset, starting from 0 | [optional] [default to 0] |
| from | number | 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] [default to undefined] |
| to | number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsSettlement
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: OptionsSettlement; }> getOptionsSettlement(contract, underlying, at)
Get specified contract settlement information
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const contract = "BTC_USDT-20211130-65000-C"; // string |
const underlying = "BTC_USDT"; // string | Underlying (Obtained by listing underlying endpoint)
const at = 56; // number |
api.getOptionsSettlement(contract, underlying, at)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| contract | string | [default to undefined] | |
| underlying | string | Underlying (Obtained by listing underlying endpoint) | [default to undefined] |
| at | number | [default to undefined] |
Promise<{ response: AxiosResponse; body: OptionsSettlement; }> OptionsSettlement
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listMyOptionsSettlements(underlying, opts)
Query personal settlement records
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const underlying = "BTC_USDT"; // string | Underlying (Obtained by listing underlying endpoint)
const opts = {
'contract': "BTC_USDT-20210916-5000-C", // string | Options contract name
'limit': 100, // number | Maximum number of records returned in a single list
'offset': 0, // number | List offset, starting from 0
'from': 1547706332, // number | 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)
'to': 1547706332 // number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp
};
api.listMyOptionsSettlements(underlying, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying (Obtained by listing underlying endpoint) | [default to undefined] |
| contract | string | Options contract name | [optional] [default to undefined] |
| limit | number | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | number | List offset, starting from 0 | [optional] [default to 0] |
| from | number | 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] [default to undefined] |
| to | number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsMySettlements
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: FuturesOrderBook; }> listOptionsOrderBook(contract, opts)
Query options contract order book
Bids will be sorted by price from high to low, while asks sorted reversely
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const contract = "BTC_USDT-20210916-5000-C"; // string | Options contract name
const opts = {
'interval': '0', // '0' | '0.1' | '0.01' | Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified
'limit': 10, // number | Number of depth levels
'withId': false // boolean | Whether to return depth update ID. This ID increments by 1 each time depth changes
};
api.listOptionsOrderBook(contract, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| contract | string | Options contract name | [default to undefined] |
| interval | Interval | Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified | [optional] [default to '0'] |
| limit | number | Number of depth levels | [optional] [default to 10] |
| withId | boolean | Whether to return depth update ID. This ID increments by 1 each time depth changes | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: FuturesOrderBook; }> FuturesOrderBook
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsTickers(underlying)
Query options market ticker information
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const underlying = "BTC_USDT"; // string | Underlying (Obtained by listing underlying endpoint)
api.listOptionsTickers(underlying)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying (Obtained by listing underlying endpoint) | [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsTicker
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: OptionsUnderlyingTicker; }> listOptionsUnderlyingTickers(underlying)
Query underlying ticker information
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const underlying = "BTC_USDT"; // string | Underlying
api.listOptionsUnderlyingTickers(underlying)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying | [default to undefined] |
Promise<{ response: AxiosResponse; body: OptionsUnderlyingTicker; }> OptionsUnderlyingTicker
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsCandlesticks(contract, opts)
Options contract market candlestick chart
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const contract = "BTC_USDT-20210916-5000-C"; // string | Options contract name
const opts = {
'limit': 100, // number | Maximum number of records returned in a single list
'from': 1547706332, // number | 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)
'to': 1547706332, // number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp
'interval': '5m' // '1m' | '5m' | '15m' | '30m' | '1h' | Time interval between data points
};
api.listOptionsCandlesticks(contract, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| contract | string | Options contract name | [default to undefined] |
| limit | number | Maximum number of records returned in a single list | [optional] [default to 100] |
| from | number | 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] [default to undefined] |
| to | number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] [default to undefined] |
| interval | Interval | Time interval between data points | [optional] [default to '5m'] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsCandlestick
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsUnderlyingCandlesticks(underlying, opts)
Underlying index price candlestick chart
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const underlying = "BTC_USDT"; // string | Underlying (Obtained by listing underlying endpoint)
const opts = {
'limit': 100, // number | Maximum number of records returned in a single list
'from': 1547706332, // number | 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)
'to': 1547706332, // number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp
'interval': '5m' // '1m' | '5m' | '15m' | '30m' | '1h' | Time interval between data points
};
api.listOptionsUnderlyingCandlesticks(underlying, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying (Obtained by listing underlying endpoint) | [default to undefined] |
| limit | number | Maximum number of records returned in a single list | [optional] [default to 100] |
| from | number | 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] [default to undefined] |
| to | number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] [default to undefined] |
| interval | Interval | Time interval between data points | [optional] [default to '5m'] |
Promise<{ response: AxiosResponse; body: Array; }> FuturesCandlestick
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsTrades(opts)
Market trade records
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
const api = new GateApi.OptionsApi(client);
const opts = {
'contract': "BTC_USDT-20210916-5000-C", // string | Options contract name
'type': "1546935600", // string | `C` for call, `P` for put
'limit': 100, // number | Maximum number of records returned in a single list
'offset': 0, // number | List offset, starting from 0
'from': 1547706332, // number | 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)
'to': 1547706332 // number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp
};
api.listOptionsTrades(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| contract | string | Options contract name | [optional] [default to undefined] |
| type | string | `C` for call, `P` for put | [optional] [default to undefined] |
| limit | number | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | number | List offset, starting from 0 | [optional] [default to 0] |
| from | number | 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] [default to undefined] |
| to | number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> FuturesTrade
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: OptionsAccount; }> listOptionsAccount()
Query account information
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
api.listOptionsAccount()
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));This endpoint does not need any parameter.
Promise<{ response: AxiosResponse; body: OptionsAccount; }> OptionsAccount
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsAccountBook(opts)
Query account change history
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const opts = {
'limit': 100, // number | Maximum number of records returned in a single list
'offset': 0, // number | List offset, starting from 0
'from': 1547706332, // number | 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)
'to': 1547706332, // number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp
'type': "dnw" // 'dnw' | 'prem' | 'fee' | 'refr' | 'set' | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L
};
api.listOptionsAccountBook(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| limit | number | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | number | List offset, starting from 0 | [optional] [default to 0] |
| from | number | 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] [default to undefined] |
| to | number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] [default to undefined] |
| type | Type | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsAccountBook
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsPositions(opts)
List user's positions of specified underlying
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const opts = {
'underlying': "BTC_USDT" // string | Underlying
};
api.listOptionsPositions(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsPosition
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: OptionsPosition; }> getOptionsPosition(contract)
Get specified contract position
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const contract = "BTC_USDT-20211130-65000-C"; // string |
api.getOptionsPosition(contract)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| contract | string | [default to undefined] |
Promise<{ response: AxiosResponse; body: OptionsPosition; }> OptionsPosition
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsPositionClose(underlying, opts)
List user's liquidation history of specified underlying
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const underlying = "BTC_USDT"; // string | Underlying (Obtained by listing underlying endpoint)
const opts = {
'contract': "BTC_USDT-20210916-5000-C" // string | Options contract name
};
api.listOptionsPositionClose(underlying, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying (Obtained by listing underlying endpoint) | [default to undefined] |
| contract | string | Options contract name | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsPositionClose
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsOrders(status, opts)
List options orders
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const status = "open"; // 'open' | 'finished' | Query order list based on status
const opts = {
'contract': "BTC_USDT-20210916-5000-C", // string | Options contract name
'underlying': "BTC_USDT", // string | Underlying
'limit': 100, // number | Maximum number of records returned in a single list
'offset': 0, // number | List offset, starting from 0
'from': 1547706332, // number | 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)
'to': 1547706332 // number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp
};
api.listOptionsOrders(status, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| status | Status | Query order list based on status | [default to undefined] |
| contract | string | Options contract name | [optional] [default to undefined] |
| underlying | string | Underlying | [optional] [default to undefined] |
| limit | number | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | number | List offset, starting from 0 | [optional] [default to 0] |
| from | number | 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] [default to undefined] |
| to | number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsOrder
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: OptionsOrder; }> createOptionsOrder(optionsOrder)
Create an options order
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const optionsOrder = new OptionsOrder(); // OptionsOrder |
api.createOptionsOrder(optionsOrder)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| optionsOrder | OptionsOrder |
Promise<{ response: AxiosResponse; body: OptionsOrder; }> OptionsOrder
- Content-Type: application/json
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> cancelOptionsOrders(opts)
Cancel all orders with 'open' status
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const opts = {
'contract': "BTC_USDT-20210916-5000-C", // string | Options contract name
'underlying': "BTC_USDT", // string | Underlying
'side': "ask" // 'ask' | 'bid' | Specify all bids or all asks, both included if not specified
};
api.cancelOptionsOrders(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| contract | string | Options contract name | [optional] [default to undefined] |
| underlying | string | Underlying | [optional] [default to undefined] |
| side | Side | Specify all bids or all asks, both included if not specified | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsOrder
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: OptionsOrder; }> getOptionsOrder(orderId)
Query single order details
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const orderId = 12345; // number | Order ID returned when order is successfully created
api.getOptionsOrder(orderId)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | number | Order ID returned when order is successfully created | [default to undefined] |
Promise<{ response: AxiosResponse; body: OptionsOrder; }> OptionsOrder
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: OptionsOrder; }> cancelOptionsOrder(orderId)
Cancel single order
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const orderId = 12345; // number | Order ID returned when order is successfully created
api.cancelOptionsOrder(orderId)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | number | Order ID returned when order is successfully created | [default to undefined] |
Promise<{ response: AxiosResponse; body: OptionsOrder; }> OptionsOrder
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: 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.
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const countdownCancelAllOptionsTask = new CountdownCancelAllOptionsTask(); // CountdownCancelAllOptionsTask |
api.countdownCancelAllOptions(countdownCancelAllOptionsTask)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| countdownCancelAllOptionsTask | CountdownCancelAllOptionsTask |
Promise<{ response: AxiosResponse; body: TriggerTime; }> TriggerTime
- Content-Type: application/json
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listMyOptionsTrades(underlying, opts)
Query personal trading records
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const underlying = "BTC_USDT"; // string | Underlying (Obtained by listing underlying endpoint)
const opts = {
'contract': "BTC_USDT-20210916-5000-C", // string | Options contract name
'limit': 100, // number | Maximum number of records returned in a single list
'offset': 0, // number | List offset, starting from 0
'from': 1547706332, // number | 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)
'to': 1547706332 // number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp
};
api.listMyOptionsTrades(underlying, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying (Obtained by listing underlying endpoint) | [default to undefined] |
| contract | string | Options contract name | [optional] [default to undefined] |
| limit | number | Maximum number of records returned in a single list | [optional] [default to 100] |
| offset | number | List offset, starting from 0 | [optional] [default to 0] |
| from | number | 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] [default to undefined] |
| to | number | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsMyTrade
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> getOptionsMMP(opts)
MMP Query.
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const opts = {
'underlying': "BTC_USDT" // string | Underlying
};
api.getOptionsMMP(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Underlying | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> OptionsMMP
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: OptionsMMP; }> setOptionsMMP(optionsMMP)
MMP Settings
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const optionsMMP = new OptionsMMP(); // OptionsMMP |
api.setOptionsMMP(optionsMMP)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| optionsMMP | OptionsMMP |
Promise<{ response: AxiosResponse; body: OptionsMMP; }> OptionsMMP
- Content-Type: application/json
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: OptionsMMP; }> resetOptionsMMP(optionsMMPReset)
MMP Reset
const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.OptionsApi(client);
const optionsMMPReset = new OptionsMMPReset(); // OptionsMMPReset |
api.resetOptionsMMP(optionsMMPReset)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| optionsMMPReset | OptionsMMPReset |
Promise<{ response: AxiosResponse; body: OptionsMMP; }> OptionsMMP
- Content-Type: application/json
- Accept: application/json