market:futures:tickers

Subscribes/Unsubscribes to market futures Tickers data.

Make sure you're connected. Either the instrument or exchange have to be specified - one needs to be specified, but both cannot be empty.

Note that there is a dedicated URL for this subscription: wss://ws.web3api.io/futures.

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:futures:tickers", { "instrument": "BTCUSDT", "exchange": "binance" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "qpvaurlf4iuzhm9c5au4riwvuifjttvbkf4rge1tkj2m2cn37psxp61v0qc5qqmm",
        "result": {
            "exchange": "binance",
            "instrument": "BTCUSDT",
            "exchangeTimestamp": 1690222707039,
            "exchangeTimestampNanoseconds": 0,
            "timestamp": 1690222707039,
            "bid": 29004.6,
            "ask": 29004.7,
            "mid": 29004.65,
            "last": null,
            "sequence": 3098562097100,
            "markPrice": null,
            "lastVolume": null,
            "bidVolume": 13.159,
            "askVolume": 22.356
        }
    }
}
FieldTypeDescription
exchangestringThe exchange.
instrumentstringThe instrument.
exchangeTimestampnumberThe exchange provided timestamp.
exchangeTimestampNanosecondsnumberThe exchange provided nanosecond part of the exchangeTimestamp (if available from the exchange).
timestampnumber
bidnumberThe bid of the instrument.
asknumberThe ask of the instrument.
midnumberThe mid of the instrument.
lastnumberThe last of the instrument.
sequencenumberThe sequence number (equal to null if it is not provided by the exchange).
lastVolumenumber
bidVolumenumberBest bid volume.
askVolumenumberBest ask volume.

Example

const WebSocket = require('ws');
const ws = new WebSocket('wss://ws.web3api.io/futures', {headers: {x-api-key:'<api_key>'}});

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures:tickers', {'instrument': 'BTCUSDT', 'exchange': 'binance'}],
      id: 1,
    }));
});

ws.on('message', data => {
  console.log(JSON.stringify(JSON.parse(data), null, 2));
});