market:options:trades [ENT]

Subscribes/Unsubscribes to market options Trades data.

Make sure you're connected to this subscription: wss://ws.web3api.io/options. 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": "BTC-16JUN23-26000-P",
			"exchange": "deribit"
		}
	]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
	"jsonrpc": "2.0",
	"method": "subscription",
	"params": {
		"result": {
			"exchange": "deribit",
			"instrument": "BTC-16JUN23-26000-P",
			"exchangeTimestamp": 1686602949127,
			"exchangeTimestampNanoseconds": 0,
			"isBuySide": false,
			"quoteSize": null,
			"price": 0.022,
			"size": 0.4,
			"tradeId": "257857355",
			"tradeSequence": 993,
			"tickDirection": 1,
			"markPrice": 0.02177816,
			"iv": 51.3,
			"indexPrice": 25857.92
		},
		"subscription": "0194dd438a74a7ee9ed3f6df6987318ee122895077f9a1fbb269aed46fed70bb"
	}
}
FieldTypeDescription
exchangestringThe exchange.
instrumentstring
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 instrument was traded.
sizenumber | nullThe total amount of the instrument that was traded.
tradeIdstring | nullThe exchange provided id of the trade.
tradeSequencenumber
tickDirectionnumber
markPricenumber
ivnumberThe implied volatility of the instrument.
indexPricenumberThe price of the underlying asset.

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:trades', {'instrument': 'BTC-16JUN23-26000-P', 'exchange': 'deribit'}],
      id: 1,
    }));
});

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