market:options:order:events

Subscribes/Unsubscribes to market options Order Book Events 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/options.

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:options:order:events", { "instrument": "BTC-30SEP22-50000-P", "exchange": "deribit" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

"result": {
  "exchange": "deribit",
  "instrument": "BTC-30SEP22-50000-P",
  "timestamp": 1637922914102,
  "exchangeTimestamp": 1637922913659,
  "exchangeTimestampNanoseconds": 0,
  "receivedTimestamp": 1637922914102,
  "receivedTimestampNanoseconds": 192383,
  "isBid": true,
  "data": [
    [
      0.00002808,
      0.0
    ],
    "sequence": null
  ]
}
FieldTypeDescription
exchangestringThe exchange.
instrumentstringThe instrument.
timestampnumberThe time at which the order book event took place.
exchangeTimestampnumberTimestamp that the exchange returned.
exchangeTimestampNanosecondsnumberNanoseconds part of exchangeTimestamp.
receivedTimestampnumberTimestamp when Amberdata received order book event.
receivedTimestampNanosecondsnumberNanoseconds part of receivedTimestamp.
isBidbooleantrue if the order is a bid, false otherwise.
dataarray
sequencenumber | null

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:options:order:events', {'instrument': 'BTC-30SEP22-50000-P', 'exchange': 'deribit'}],
      id: 1,
    }));
});

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