market:futures:order:snapshots

Subscribes/Unsubscribes to market futures Order Book Snapshots data.

Once you're connected to this subscription: wss://ws.amberdata.com/futures, every subscription message must include an explicit instrument. This is mandatory across all market types.

  • You must always specify the instrument.
  • For Futures and Options, you must also include the exchange field.

See here for more details and examples.

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:futures:order:snapshots", { "instrument": "XRPUSDT", "exchange": "binance" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument. (REQUIRED)
exchangestringThe exchange for which to retrieve asset instruments. (OPTIONAL)

Response

{
  "jsonrpc": "2.0",
  "method": "subscription",
  "params": {
      "subscription": "8e1f5873-5023-4989-8573-2e91a6e4112c",
      "result": [
          {
              "exchange": "binance",
              "instrument": "BTCUSDT",
              "timestamp": 0,
              "exchangeTimestamp": 1711570980336,
              "isBid": false,
              "data": [
                  [
                      69135.8,
                      0.07,
                      null
                  ],
                  [
                      69136.4,
                      0.029,
                      null
                  ]
              ],
              "sequence": 4292893574687,
              "currentFunding": null
          }
      ]
  }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
timestampnumberThe time at which the order book snapshot took place.
exchangeTimestampnumberThe timestamp at which the event was recorded by the exchange.
isBidbooleanA boolean indicator of whether the orders in the snapshot are buy (bid) orders.
data[0]numberThe price level of the order.
data[1]numberThe quantity of the asset available at the specified price level.
data[2]numberThe number of individual orders that are aggregated at the specified price level.
sequencenumberA unique identifier for the order book state.
currentFundingnumberThe current funding rate for perpetual futures contracts.

Example

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

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

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