market:options:trades [ENT]

Subscribes/Unsubscribes to market options Trades 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.

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:options:trades", { "instrument": "ETH-30SEP22-9000-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": "ETH-30SEP22-9000-P",
  "timestamp": 1638116613092,
  "exchangeTimestamp": 1638116613052,
  "exchangeTimestampNanoseconds": 12000,
  "isBuySide": true,
  "quoteSize": null,
  "price": 0.043500000000000004,
  "size": 0.30000000000000004,
  "tradeId": "192148151",
}

Field

Type

Description

exchange

string

The exchange.

timestamp

number

The time at which the trade took place.

timestamp

number

Timestamp when Amberdata received trade.

exchangeTimestamp

number

Timestamp that the exchange returned.

exchangeTimestampNanoseconds

number

Nanoseconds part of exchangeTimestamp.

isBuySide

boolean | null

true if the trade is a buy, false otherwise.

quoteSize

number | null

price

number | null

The price at which the asset was traded.

size

number | null

The total amount of that asset that was traded.

tradeId

number

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