market:options:order:events [ENT]

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" } ]
}

Param

Type

Description

instrument

string

The asset instrument.

exchange

string

The 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
  ]
}

Field

Type

Description

exchange

string

The exchange.

instrument

string

The instrument.

timestamp

number

The time at which the order book event took place.

exchangeTimestamp

number

Timestamp that the exchange returned.

exchangeTimestampNanoseconds

number

Nanoseconds part of exchangeTimestamp.

receivedTimestamp

number

Timestamp when Amberdata received order book event.

receivedTimestampNanoseconds

number

Nanoseconds part of receivedTimestamp.

isBid

boolean

true if the order is a bid, false otherwise.

data

array

sequence

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