[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
363 lines (253 loc) · 11.6 KB

DeliveryApi.md

File metadata and controls

363 lines (253 loc) · 11.6 KB

GateApi.DeliveryApi

All URIs are relative to https://api.gateio.ws/api/v4

Method HTTP request Description
listDeliveryContracts GET /delivery/{settle}/contracts List all futures contracts
getDeliveryContract GET /delivery/{settle}/contracts/{contract} Get a single contract
listDeliveryOrderBook GET /delivery/{settle}/order_book Futures order book
listDeliveryTrades GET /delivery/{settle}/trades Futures trading history
listDeliveryCandlesticks GET /delivery/{settle}/candlesticks Get futures candlesticks
listDeliveryTickers GET /delivery/{settle}/tickers List futures tickers
listDeliveryInsuranceLedger GET /delivery/{settle}/insurance Futures insurance balance history

listDeliveryContracts

[DeliveryContract] listDeliveryContracts(settle)

List all futures contracts

Example

var GateApi = require('gate-api');

var apiInstance = new GateApi.DeliveryApi();
var settle = "usdt"; // String | Settle currency
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.listDeliveryContracts(settle, callback);

Parameters

Name Type Description Notes
settle String Settle currency

Return type

[DeliveryContract]

Authorization

No authorization required

HTTP request headers

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

getDeliveryContract

DeliveryContract getDeliveryContract(settle, contract)

Get a single contract

Example

var GateApi = require('gate-api');

var apiInstance = new GateApi.DeliveryApi();
var settle = "usdt"; // String | Settle currency
var contract = "BTC_USDT_20200814"; // String | Futures contract
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getDeliveryContract(settle, contract, callback);

Parameters

Name Type Description Notes
settle String Settle currency
contract String Futures contract

Return type

DeliveryContract

Authorization

No authorization required

HTTP request headers

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

listDeliveryOrderBook

FuturesOrderBook listDeliveryOrderBook(settle, contract, opts)

Futures order book

Bids will be sorted by price from high to low, while asks sorted reversely

Example

var GateApi = require('gate-api');

var apiInstance = new GateApi.DeliveryApi();
var settle = "usdt"; // String | Settle currency
var contract = "BTC_USDT_20200814"; // String | Futures contract
var opts = {
  'interval': '0', // String | Order depth. 0 means no aggregation is applied. default to 0
  'limit': 10, // Number | Maximum number of order depth data in asks or bids
  'withId': false // Boolean | Whether the order book update ID will be returned. This ID increases by 1 on every order book update
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.listDeliveryOrderBook(settle, contract, opts, callback);

Parameters

Name Type Description Notes
settle String Settle currency
contract String Futures contract
interval String Order depth. 0 means no aggregation is applied. default to 0 [optional] [default to '0']
limit Number 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]

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

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

listDeliveryTrades

[FuturesTrade] listDeliveryTrades(settle, contract, opts)

Futures trading history

Example

var GateApi = require('gate-api');

var apiInstance = new GateApi.DeliveryApi();
var settle = "usdt"; // String | Settle currency
var contract = "BTC_USDT_20200814"; // String | Futures contract
var opts = {
  'limit': 100, // Number | Maximum number of records to be returned in a single list
  'lastId': "12345", // String | Specify the starting point for this list based on a previously retrieved id  This parameter is deprecated. Use `from` and `to` instead to limit time range
  'from': 1546905600, // Number | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. 
  'to': 1546935600 // Number | Specify end time in Unix seconds, default to current time
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.listDeliveryTrades(settle, contract, opts, callback);

Parameters

Name Type Description Notes
settle String Settle currency
contract String Futures contract
limit Number Maximum number of records to be returned in a single list [optional] [default to 100]
lastId String Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range [optional]
from Number Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. [optional]
to Number Specify end time in Unix seconds, default to current time [optional]

Return type

[FuturesTrade]

Authorization

No authorization required

HTTP request headers

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

listDeliveryCandlesticks

[FuturesCandlestick] listDeliveryCandlesticks(settle, contract, opts)

Get futures candlesticks

Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval`

Example

var GateApi = require('gate-api');

var apiInstance = new GateApi.DeliveryApi();
var settle = "usdt"; // String | Settle currency
var contract = "BTC_USDT_20200814"; // String | Futures contract
var opts = {
  'from': 1546905600, // Number | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified
  'to': 1546935600, // Number | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time
  'limit': 100, // Number | Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected.
  'interval': '5m' // String | Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.listDeliveryCandlesticks(settle, contract, opts, callback);

Parameters

Name Type Description Notes
settle String Settle currency
contract String Futures contract
from Number Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified [optional]
to Number End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time [optional]
limit Number Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. [optional] [default to 100]
interval String Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 [optional] [default to '5m']

Return type

[FuturesCandlestick]

Authorization

No authorization required

HTTP request headers

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

listDeliveryTickers

[FuturesTicker] listDeliveryTickers(settle, opts)

List futures tickers

Example

var GateApi = require('gate-api');

var apiInstance = new GateApi.DeliveryApi();
var settle = "usdt"; // String | Settle currency
var opts = {
  'contract': "BTC_USDT_20200814" // String | Futures contract
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.listDeliveryTickers(settle, opts, callback);

Parameters

Name Type Description Notes
settle String Settle currency
contract String Futures contract [optional]

Return type

[FuturesTicker]

Authorization

No authorization required

HTTP request headers

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

listDeliveryInsuranceLedger

[InsuranceRecord] listDeliveryInsuranceLedger(settle, opts)

Futures insurance balance history

Example

var GateApi = require('gate-api');

var apiInstance = new GateApi.DeliveryApi();
var settle = "usdt"; // String | Settle currency
var opts = {
  'limit': 100 // Number | Maximum number of records to be returned in a single list
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.listDeliveryInsuranceLedger(settle, opts, callback);

Parameters

Name Type Description Notes
settle String Settle currency
limit Number Maximum number of records to be returned in a single list [optional] [default to 100]

Return type

[InsuranceRecord]

Authorization

No authorization required

HTTP request headers

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