Subscribes/Unsubscribes to market options Tickers data.
Important Update: WebSocket Endpoint Migration
We are excited to announce an upgrade to our WebSocket service! To ensure that our users enjoy enhanced reliability and performance, we have migrated our WebSocket endpoint. Please update your applications to connect to the new endpoint as described here:
- ❌ Old Endpoint:
wss://ws.web3api.io/
- ✅ New Endpoint:
wss://ws.amberdata.com/options
Action Required
Users are required to update the endpoint URL in their applications. The good news is that the response JSON schemas remain unchanged, so you can expect a seamless transition with minimal adjustments needed on your end.
Support
We understand that changes like these can raise questions. Our support team is here to assist with any issues or concerns you may have during this migration process. Please don’t hesitate to contact us for support at: [email protected].
We appreciate your prompt action to migrate to the new WebSocket endpoint.
Once you're connected to this subscription: wss://ws.amberdata.com/options, you must provide either the instrument or exchange - one needs to be specified, both cannot be empty.
Request
{
"jsonrpc" : "2.0",
"id" : 1,
"method" : "subscribe",
"params" : [ "market:options:tickers", { "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
{
"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
}
}
}
Field | Type | Description |
---|---|---|
exchange | string | The exchange. |
instrument | string | The instrument. |
exchangeTimestamp | number | null | Timestamp that the exchange returned. |
exchangeTimestampNanoseconds | number | null | Nanoseconds part of exchangeTimestamp . |
timestamp | number | null | The time at which the ticker took place. |
bid | number | null | The bid of the market pair. |
ask | number | null | The ask of the market pair. |
mid | number | null | The mid of the market pair. |
last | number | null | The last of the market pair. |
baseVolume | number | null | |
quoteVolume | number | null | |
bidVolume | number | null | It represents the requested order size of all best bids. |
askVolume | number | null | It represents the requested order size of all best asks. |
sequence | number | null | |
metadata | number | null | |
underlyingPrice | string | null | Underlying price for implied volatility calculations. |
underlyingIndex | string | null | Name of the underlying future, or indexPrice . |
stats | object | null | |
stats.high | number | null | Highest price during 24h. |
stats.low | number | null | Lowest price during 24h. |
stats.volume | number | null | Volume during last 24h in base currency. |
stats.price_change | number | null | 24-hour price change expressed as a percentage, null if there weren't any trades. |
state | string | null | The state of the order book. Possible values are open and closed . |
settlementPrice | number | null | The settlement price for the instrument. Only when state = open . |
openInterest | number | null | The 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. |
minPrice | number | null | The minimum price for the future. Any sell orders you submit lower than this price will be clamped to this minimum. |
maxPrice | number | null | The maximum price for the future. Any buy orders you submit higher than this price, will be clamped to this maximum. |
markPrice | number | null | The mark price for the instrument. |
markIv | number | null | Implied volatility for mark price. |
interestRate | number | null | Interest rate used in implied volatility calculations. |
indexPrice | number | null | Current index price. |
greeks | object | null | |
greeks.delta | number | null | The delta value for the option. |
greeks.gamma | number | null | The gamma value for the option. |
greeks.rho | number | null | The rho value for the option. |
greeks.theta | number | null | The theta value for the option. |
greeks.vega | number | null | The vega value for the option. |
estimatedDeliveryPrice | number | null | Estimated delivery price for the market. |
bidIv | number | null | Implied volatility for best bid. |
askIv | number | null | Implied 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));
});