Skip to content

Latest commit

 

History

History
1331 lines (908 loc) · 48.2 KB

File metadata and controls

1331 lines (908 loc) · 48.2 KB

OptionsApi

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

listOptionsUnderlyings

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsUnderlyings()

List all underlying assets

Example

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));

Parameters

This endpoint does not need any parameter.

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsUnderlying

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsExpirations

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsExpirations(underlying)

List all expiration dates

Example

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));

Parameters

Name Type Description Notes
underlying string Underlying (Obtained by listing underlying endpoint) [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> number

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsContracts

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsContracts(underlying, opts)

List all contracts for specified underlying and expiration date

Example

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));

Parameters

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]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsContract

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getOptionsContract

Promise<{ response: http.IncomingMessage; body: OptionsContract; }> getOptionsContract(contract)

Query specified contract details

Example

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));

Parameters

Name Type Description Notes
contract string [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: OptionsContract; }> OptionsContract

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsSettlements

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsSettlements(underlying, opts)

List settlement history

Example

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));

Parameters

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]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsSettlement

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getOptionsSettlement

Promise<{ response: http.IncomingMessage; body: OptionsSettlement; }> getOptionsSettlement(contract, underlying, at)

Get specified contract settlement information

Example

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));

Parameters

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]

Return type

Promise<{ response: AxiosResponse; body: OptionsSettlement; }> OptionsSettlement

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listMyOptionsSettlements

Promise<{ response: http.IncomingMessage; body: Array; }> listMyOptionsSettlements(underlying, opts)

Query personal settlement records

Example

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));

Parameters

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]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsMySettlements

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsOrderBook

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

Example

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));

Parameters

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]

Return type

Promise<{ response: AxiosResponse; body: FuturesOrderBook; }> FuturesOrderBook

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsTickers

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsTickers(underlying)

Query options market ticker information

Example

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));

Parameters

Name Type Description Notes
underlying string Underlying (Obtained by listing underlying endpoint) [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsTicker

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsUnderlyingTickers

Promise<{ response: http.IncomingMessage; body: OptionsUnderlyingTicker; }> listOptionsUnderlyingTickers(underlying)

Query underlying ticker information

Example

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));

Parameters

Name Type Description Notes
underlying string Underlying [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: OptionsUnderlyingTicker; }> OptionsUnderlyingTicker

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsCandlesticks

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsCandlesticks(contract, opts)

Options contract market candlestick chart

Example

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));

Parameters

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']

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsCandlestick

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsUnderlyingCandlesticks

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsUnderlyingCandlesticks(underlying, opts)

Underlying index price candlestick chart

Example

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));

Parameters

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']

Return type

Promise<{ response: AxiosResponse; body: Array; }> FuturesCandlestick

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsTrades

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsTrades(opts)

Market trade records

Example

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));

Parameters

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]

Return type

Promise<{ response: AxiosResponse; body: Array; }> FuturesTrade

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsAccount

Promise<{ response: http.IncomingMessage; body: OptionsAccount; }> listOptionsAccount()

Query account information

Example

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));

Parameters

This endpoint does not need any parameter.

Return type

Promise<{ response: AxiosResponse; body: OptionsAccount; }> OptionsAccount

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsAccountBook

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsAccountBook(opts)

Query account change history

Example

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));

Parameters

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]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsAccountBook

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsPositions

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsPositions(opts)

List user&#39;s positions of specified underlying

Example

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));

Parameters

Name Type Description Notes
underlying string Underlying [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsPosition

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getOptionsPosition

Promise<{ response: http.IncomingMessage; body: OptionsPosition; }> getOptionsPosition(contract)

Get specified contract position

Example

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));

Parameters

Name Type Description Notes
contract string [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: OptionsPosition; }> OptionsPosition

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsPositionClose

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsPositionClose(underlying, opts)

List user&#39;s liquidation history of specified underlying

Example

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));

Parameters

Name Type Description Notes
underlying string Underlying (Obtained by listing underlying endpoint) [default to undefined]
contract string Options contract name [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsPositionClose

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listOptionsOrders

Promise<{ response: http.IncomingMessage; body: Array; }> listOptionsOrders(status, opts)

List options orders

Example

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));

Parameters

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]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

createOptionsOrder

Promise<{ response: http.IncomingMessage; body: OptionsOrder; }> createOptionsOrder(optionsOrder)

Create an options order

Example

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));

Parameters

Name Type Description Notes
optionsOrder OptionsOrder

Return type

Promise<{ response: AxiosResponse; body: OptionsOrder; }> OptionsOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

cancelOptionsOrders

Promise<{ response: http.IncomingMessage; body: Array; }> cancelOptionsOrders(opts)

Cancel all orders with &#39;open&#39; status

Example

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));

Parameters

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]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getOptionsOrder

Promise<{ response: http.IncomingMessage; body: OptionsOrder; }> getOptionsOrder(orderId)

Query single order details

Example

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));

Parameters

Name Type Description Notes
orderId number Order ID returned when order is successfully created [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: OptionsOrder; }> OptionsOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

cancelOptionsOrder

Promise<{ response: http.IncomingMessage; body: OptionsOrder; }> cancelOptionsOrder(orderId)

Cancel single order

Example

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));

Parameters

Name Type Description Notes
orderId number Order ID returned when order is successfully created [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: OptionsOrder; }> OptionsOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

countdownCancelAllOptions

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.

Example

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));

Parameters

Name Type Description Notes
countdownCancelAllOptionsTask CountdownCancelAllOptionsTask

Return type

Promise<{ response: AxiosResponse; body: TriggerTime; }> TriggerTime

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

listMyOptionsTrades

Promise<{ response: http.IncomingMessage; body: Array; }> listMyOptionsTrades(underlying, opts)

Query personal trading records

Example

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));

Parameters

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]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsMyTrade

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getOptionsMMP

Promise<{ response: http.IncomingMessage; body: Array; }> getOptionsMMP(opts)

MMP Query.

Example

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));

Parameters

Name Type Description Notes
underlying string Underlying [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> OptionsMMP

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

setOptionsMMP

Promise<{ response: http.IncomingMessage; body: OptionsMMP; }> setOptionsMMP(optionsMMP)

MMP Settings

Example

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));

Parameters

Name Type Description Notes
optionsMMP OptionsMMP

Return type

Promise<{ response: AxiosResponse; body: OptionsMMP; }> OptionsMMP

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

resetOptionsMMP

Promise<{ response: http.IncomingMessage; body: OptionsMMP; }> resetOptionsMMP(optionsMMPReset)

MMP Reset

Example

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));

Parameters

Name Type Description Notes
optionsMMPReset OptionsMMPReset

Return type

Promise<{ response: AxiosResponse; body: OptionsMMP; }> OptionsMMP

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json