market:options:trades [ENT]

Subscribes/Unsubscribes to market options Trades data.

Make sure you're connected to this subscription: wss://ws.web3api.io. Either the instrument or exchange have to be specified - one needs to be specified, but both cannot be empty.

Request

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

Response

"result": {
  "exchange": "deribit",
  "instrument": "ETH-30SEP22-9000-P",
  "timestamp": 1638116613092,
  "exchangeTimestamp": 1638116613052,
  "exchangeTimestampNanoseconds": 12000,
  "isBuySide": true,
  "quoteSize": null,
  "price": 0.043500000000000004,
  "size": 0.30000000000000004,
  "tradeId": "192148151",
}
FieldTypeDescription
exchangestringThe exchange.
timestampnumberThe time at which the trade took place.
timestampnumberTimestamp when Amberdata received trade.
exchangeTimestampnumberTimestamp that the exchange returned.
exchangeTimestampNanosecondsnumberNanoseconds part of exchangeTimestamp.
isBuySideboolean | nulltrue if the trade is a buy, false otherwise.
quoteSizenumber | null
pricenumber | nullThe price at which the asset was traded.
sizenumber | nullThe total amount of that asset that was traded.
tradeIdnumberThe exchange provided id of the trade.

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:options:trades', {'instrument': 'ETH-30SEP22-9000-P', 'exchange': 'deribit'}],
      id: 1,
    }));
});

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