Subscribes/Unsubscribes to market options Liquidations 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:liquidations", { "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. |
period | string | '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"
}
Field | Type | Description |
---|---|---|
exchange | string | The exchange. |
timestamp | number | The time at which the liquidation took place. |
originalQuantity | number | The original quantity before the liquidation occurred. |
price | number | The price of the instrument at the time of the liquidation. |
side | string | The direction of the trade. |
status | string | The status of the liquidation. |
type | string | The type of liquidation. |
timeInForce | string | How 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 |
action | string | The type of action taken during the liquidation process (for example: delete, insert, update, etc). |
orderId | string | The 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));
});