Liquidations

Request

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

Response

"result": {
  "exchange": "deribit",
  "instrument": "ETH-30SEP22-9000-P",
  "timestamp": 1637916913907,
  "originalQuantity": 2.0,
  "price": 0.001,
  "side": "BUY",
  "status": null,
  "type": null,
  "timeInForce": null,
  "action": null,
  "orderId": "ETH-104154743"
}
FieldTypeDescription
exchangestringThe exchange.
timestampnumberThe time at which the liquidation took place.
originalQuantitynumberThe original quantity before the liquidation occurred.
pricenumberThe price of the instrument at the time of the liquidation.
sidestringThe direction of the trade.
statusstringThe status of the liquidation.
typestringThe type of liquidation.
timeInForcestringHow long the order is to remain active before it is executed or expires, for example: IOC: immediate-or-cancel, FOK: fill-or-kill, GTC: good-‘till-canceled, etc
actionstringThe type of action taken during the liquidation process (for example: delete, insert, update, etc).
orderIdstringThe order identifier.

Example

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

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

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

OHLCV

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:options:ohlcv", { "instrument": "BTC-10DEC21-100000-C", "exchange": "deribit"} ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "203e79ed-3985-4fb8-a8d6-bef7cebc2fda",
        "result": {
            "exchange": "deribit",
            "instrument": "BTC-12APR24-71000-C",
            "timestamp": 1711571340000,
            "open": 0.049,
            "high": 0.049,
            "low": 0.049,
            "close": 0.049,
            "volume": 0
        }
    }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
timestampnumberThe time at which the event took place.
opennumberThe price at which the first trade occurred during the specified period.
highnumberThe highest price at which a trade took place during the period.
lownumberThe lowest price at which a trade occurred during the period.
closenumberThe price at which the last trade occurred during the specified period.
volumenumberThe total quantity traded during the period.

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:options:ohlcv', {'instrument': 'BTC-10DEC21-100000-C', 'exchange': 'deribit'}],
      id: 1,
    }));
});

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

Open Interest

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:options:open_interests", { "instrument": "ETH-17DEC21-4100-C", "exchange": "deribit" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument. (OPTIONAL)
exchangestringThe exchange for which to retrieve asset instruments. (OPTIONAL)

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "4ce0d4c7-905a-44c0-ba96-121992670f13",
        "result": {
            "instrument": "BTC-12APR24-71000-C",
            "exchange": "deribit",
            "timestamp": 1711571535660,
            "value": 293.2
        }
    }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
timestampnumberThe timestamp associated with this record in UTC.
valuenumberThe total open interest for the specified instrument.

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:options:open_interests'],
      id: 1,
    }));
});

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

Order Book Events

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

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "74212dc1-f25e-41b5-a3ae-f239d5155b6b",
        "result": {
            "exchange": "deribit",
            "instrument": "BTC-12APR24-71000-C",
            "timestamp": 1711571405282,
            "exchangeTimestamp": 1711571404974,
            "exchangeTimestampNanoseconds": 0,
            "receivedTimestamp": 1711571405282,
            "receivedTimestampNanoseconds": 184986,
            "isBid": false,
            "sequence": 68116490254,
            "data": [
                [
                    0.0485,
                    0.3,
                    null
                ],
                [
                    0.049,
                    62.2,
                    null
                ],
                [
                    0.0495,
                    9.6,
                    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.
sequencenumber | nullA unique identifier for the order book event.
data[0]numberThe price level of the order(s).
data[1]numberThe quantity of the contract(s) at that price level.
data[2]number | nullThe number of individual orders at the specified price level.

Example

const WebSocket = require('ws');
const ws = new WebSocket('wss://ws.amberdata.com/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));
});

Order Book Snapshots

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:options:order:snapshots", { "instrument": "BTC-24JUN22-15000-P", "exchange": "deribit" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument. (REQUIRED)
exchangestringThe exchange for which to retrieve asset instruments. (OPTIONAL)

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "cd09d018-fa34-408d-aef7-8a5ef2c641b3",
        "result": {
            "exchange": "deribit",
            "instrument": "BTC-12APR24-71000-C",
            "timestamp": 1711571460000,
            "exchangeTimestamp": 1711571461951,
            "exchangeTimestampNanoseconds": 0,
            "underlyingPrice": 69599.7133,
            "underlyingIndex": "SYN.BTC-12APR24",
            "stats": {
                "volume_usd": 376871.48,
                "volume": 88.7,
                "price_change": -16.9492,
                "low": 0.049,
                "high": 0.0669
            },
            "state": "open",
            "openInterest": 293.2,
            "minPrice": 0.017,
            "maxPrice": 0.1,
            "markPrice": 0.0477,
            "markIv": 69.04,
            "lastPrice": 0.049,
            "interestRate": 0,
            "indexPrice": 68922.78,
            "greeks": {
                "rho": 12.53638,
                "theta": -127.22042,
                "vega": 57.04281,
                "gamma": 0.00004,
                "delta": 0.47249
            },
            "estimatedDeliveryPrice": 68922.78,
            "bids": [
                [
                    0.0475,
                    4.7
                ],
                [
                    0.047,
                    53.7
                ],
                [
                    0.0465,
                    13.4
                ]
            ],
            "bidIv": 68.75,
            "bestBidPrice": 0.0475,
            "bestBidAmount": 4.7,
            "bestAskPrice": 0.0485,
            "bestAskAmount": 26.4,
            "asks": [
                [
                    0.0485,
                    26.4
                ],
                [
                    0.049,
                    38.8
                ],
                [
                    0.0495,
                    8
                ]
            ],
            "askIv": 69.97,
            "sequence": 68116518368,
            "metadata": {
                "settlementPrice": 0.05367167
            }
        }
    }
}
FieldTypeDescription
exchangestringThe exchange.
instrumentstringThe instrument.
timestampnumberThe time at which the order book snapshot took place.
exchangeTimestampnumber | nullTimestamp that the exchange returned.
exchangeTimestampNanosecondsnumber | nullNanoseconds part of exchangeTimestamp.
underlyingPricenumber | nullUnderlying price for implied volatility calculations.
underlyingIndexstring | nullName of the underlying future, or indexPrice.
statsobject | null
stats.highnumber | nullHighest price during 24h.
stats.lownumber | nullLowest price during 24h.
stats.price_changenumber | null24-hour price change expressed as a percentage, null if there weren’t any trades.
stats.volumenumber | nullVolume during last 24h in base currency.
stats.volume_usdnumber | null
statestring | nullThe state of the order book. Possible values are open and closed.
openInterestnumber | nullThe amount of corresponding cryptocurrency contracts, e.g., BTC or ETH.
minPricenumber | nullThe minimum price for the future. Any sell orders you submit lower than this price will be clamped to this minimum.
maxPricenumber | nullThe maximum price for the future. Any buy orders you submit higher than this price, will be clamped to this maximum.
markPricenumber | nullThe mark price for the instrument.
markIvnumber | nullImplied volatility for mark price.
lastPricenumber | nullThe price for the last trade.
interestRatenumber | nullInterest rate used in implied volatility calculations.
indexPricenumber | nullCurrent index price
greeksobject | null
greeks.deltanumber | nullThe delta value for the option.
greeks.gammanumber | nullThe gamma value for the option.
greeks.rhonumber | nullThe rho value for the option.
greeks.thetanumber | nullThe theta value for the option.
greeks.veganumber | nullThe vega value for the option.
estimatedDeliveryPricenumber | nullThe settlement price for the instrument. Only when state = open.
bidsarray of [price, amount]List of bids.
bidIvnumber | nullImplied volatility for best bid.
bestBidPricenumber | nullThe current best bid price, null if there aren’t any bids.
bestBidAmountnumber | nullIt represents the requested order size of all best bids.
bestAskPricenumber | nullThe current best ask price, null if there aren’t any asks.
bestAskAmountnumber | nullIt represents the requested order size of all best asks.
asksarray of [price, amount]List of asks.
askIvnumber | nullImplied volatility for best ask.
sequencenumber | null
metadataobject | null

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:options:order:snapshots'],
      id: 1,
    }));
});

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

Tickers

Request

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

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "cd9738ab-54e9-4bcf-a3f8-be3c7976e694",
        "result": {
            "exchange": "deribit",
            "instrument": "BTC-12APR24-71000-C",
            "timestamp": 1711571450748,
            "exchangeTimestamp": 1711571450748,
            "exchangeTimestampNanoseconds": 0,
            "bid": 0.0475,
            "ask": 0.0485,
            "mid": 0.048,
            "last": 0.049,
            "baseVolume": null,
            "quoteVolume": null,
            "bidVolume": 4.7,
            "askVolume": 26.4,
            "sequence": null,
            "metadata": null,
            "underlyingPrice": 69593.63,
            "underlyingIndex": "SYN.BTC-12APR24",
            "stats": {
                "volume_usd": 376871.48,
                "volume": 88.7,
                "price_change": -16.9492,
                "low": 0.049,
                "high": 0.0669
            },
            "state": "open",
            "settlementPrice": 0.05367167,
            "openInterest": 293.2,
            "minPrice": 0.017,
            "maxPrice": 0.1,
            "markPrice": 0.0477,
            "markIv": 69.03,
            "interestRate": 0,
            "indexPrice": 68916.13,
            "greeks": {
                "rho": 12.52907,
                "theta": -127.19004,
                "vega": 57.0353,
                "gamma": 0.00004,
                "delta": 0.47224
            },
            "estimatedDeliveryPrice": 68916.13,
            "bidIv": 68.79,
            "askIv": 70.01
        }
    }
}
FieldTypeDescription
exchangestringThe exchange.
instrumentstringThe instrument.
exchangeTimestampnumber | nullTimestamp that the exchange returned.
exchangeTimestampNanosecondsnumber | nullNanoseconds part of exchangeTimestamp.
timestampnumber | nullThe time at which the ticker took place.
bidnumber | nullThe bid of the market pair.
asknumber | nullThe ask of the market pair.
midnumber | nullThe mid of the market pair.
lastnumber | nullThe last of the market pair.
baseVolumenumber | null
quoteVolumenumber | null
bidVolumenumber | nullIt represents the requested order size of all best bids.
askVolumenumber | nullIt represents the requested order size of all best asks.
sequencenumber | null
metadatanumber | null
underlyingPricestring | nullUnderlying price for implied volatility calculations.
underlyingIndexstring | nullName of the underlying future, or indexPrice.
statsobject | null
stats.highnumber | nullHighest price during 24h.
stats.lownumber | nullLowest price during 24h.
stats.volumenumber | nullVolume during last 24h in base currency.
stats.price_changenumber | null24-hour price change expressed as a percentage, null if there weren’t any trades.
statestring | nullThe state of the order book. Possible values are open and closed.
settlementPricenumber | nullThe settlement price for the instrument. Only when state = open.
openInterestnumber | nullThe total amount of outstanding contracts in the corresponding amount units. For perpetual and futures the amount is in USD units, for options it is amount of corresponding cryptocurrency contracts, e.g., BTC or ETH.
minPricenumber | nullThe minimum price for the future. Any sell orders you submit lower than this price will be clamped to this minimum.
maxPricenumber | nullThe maximum price for the future. Any buy orders you submit higher than this price, will be clamped to this maximum.
markPricenumber | nullThe mark price for the instrument.
markIvnumber | nullImplied volatility for mark price.
interestRatenumber | nullInterest rate used in implied volatility calculations.
indexPricenumber | nullCurrent index price.
greeksobject | null
greeks.deltanumber | nullThe delta value for the option.
greeks.gammanumber | nullThe gamma value for the option.
greeks.rhonumber | nullThe rho value for the option.
greeks.thetanumber | nullThe theta value for the option.
greeks.veganumber | nullThe vega value for the option.
estimatedDeliveryPricenumber | nullEstimated delivery price for the market.
bidIvnumber | nullImplied volatility for best bid.
askIvnumber | nullImplied volatility for best ask.

Example

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

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

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

Trades

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": {
        "subscription": "c148c36c-ba18-4364-abd6-528b61b4e068",
        "result": {
            "instrument": "ETH-29MAR24-3650-C",
            "exchange": "deribit",
            "exchangeTimestamp": 1711571475505,
            "exchangeTimestampNanoseconds": 0,
            "isBuySide": true,
            "price": 0.005,
            "size": 1,
            "tradeId": "ETH-201932780",
            "tradeSequence": "1535",
            "tickDirection": 1,
            "markPrice": 0.00497,
            "iv": 71.45,
            "indexPrice": 3503.08
        }
    }
}
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.amberdata.com/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));
});