Funding Rates

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:futures:funding_rates", { "instrument": "ICXUSDT", "exchange": "binance" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "8d5b4e5a-435d-40d4-9701-b3d8c2d15148",
        "result": {
            "exchange": "binance",
            "instrument": "GASUSDT",
            "timestamp": 1711571101000,
            "insertionTimestamp": 1711571101000,
            "fundingInterval": null,
            "fundingRate": 0.00019676,
            "nextFundingRate": null,
            "nextFundingTime": 1711584000000,
            "isActualFundingRate": false
        }
    }
}
FieldTypeDescription
exchangestringThe exchange.
instrumentstringThe asset pair
timestampnumberThe time at which the funding rate took place.
insertionTimestampnumberThe time at which the funding rate insert to database
fundingIntervalnumber | nullThe interval funding
fundingRatenumberThe funding rate value
nextFundingRatenumberThe next funding rate for which data is available.
nextFundingTimenumber | nullThe next funding time for which data is available.
isActualFundingRatebooleanIf true, then it’s the actual funding rate that has been realized and applied. If false, then it’s a projected/estimated funding rate for an upcoming funding interval.

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures:funding_rates', {'instrument': 'BTCUSD_PERP', 'exchange': 'binance'}],
      id: 1,
    }));
});

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

Insurance Funds

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:futures:insurance_funds", { "instrument": "EOS", "exchange": "huobi" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

"result": {
  "exchange": "huobi",
  "instrument": "EOS",
  "timestamp": 1613289600,
  "fund": 1056094
}
FieldTypeDescription
exchangestringThe exchange.
instrumentstringThe asset pair
timestampnumberThe time at which the insurance fund took place.
fundnumberThe insurance fund value

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures:insurance_funds', {'instrument': 'EOS', 'exchange': 'huobi'}],
      id: 1,
    }));
});

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

Liquidations

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:futures:liquidations", { "instrument": "BTCUSDT", "exchange": "binance" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "bc79013c-6051-49ff-b4d5-754082bf8e47",
        "result": {
            "exchange": "binance",
            "instrument": "AEVOUSDT",
            "timestamp": 1711571204802,
            "price": 2.9643448,
            "side": "SELL",
            "status": "FILLED",
            "type": "LIMIT",
            "timeInForce": "IOC",
            "action": null,
            "orderId": null,
            "volume": 31
        }
    }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
timestampnumberThe time at which the liquidation took place.
pricenumberThe price at which the liquidation occurred.
sidestringIndicates whether the liquidated position was a buy or sell.
statusstringThe status of the order at the time of the message.
typestringThe type of order that was liquidated.
timeInForcestringDescribes how long an order will remain active before it is executed or expires.
actionstringThis field will show as null for all exchanges except Bitmex.
orderIdAn identifier for the specific order that was liquidated (this field will show as null for most exchanges except Deribit and Bitmex).
volumenumberThe amount of the asset that was liquidated.

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures:liquidations', {'instrument': 'XRPUSDT', 'exchange': 'binance'}],
      id: 1,
    }));
});

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

Long/Short Ratios

Request

{
  "jsonrpc" : "2.0",
  "id"      : 1,
  "method"  : "subscribe",
  "params"  : [ "market:futures:long_short_ratios", { "instrument": "XRPUSDT", "exchange": "binance", "period": "minutely" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "1a71b04a-4f9f-4638-8cb2-b0f2d9c7e51e",
        "result": {
            "exchange": "binance",
            "instrument": "BTCUSDT",
            "timestamp": 1711571100000,
            "longAccount": 0.6069,
            "ratio": 1.5439,
            "shortAccount": 0.3931,
            "period": 5
        }
    }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
timestampnumberThe time at which the long/short ratio was updated.
longAccountnumberThe proportion of accounts on the long side of the futures contract.
rationumberThe long/short ratio.
shortAccountnumberThe proportion of accounts on the short side of the futures contract.
periodnumberThe frequency of the timeInterval. When timeInterval=minutes, the period is 5, indicating 5 minutes. When timeInterval=days, the period is 1, indicating 1 day.

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures:long_short_ratios', {'instrument': 'XRPUSDT', 'exchange': 'binance', 'period': 'minutely'}],
      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:futures:ohlcv", { "instrument": "XRPUSDT", "exchange": "binance"} ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "c17c567a-6bd0-4335-85ed-61197c845f3f",
        "result": {
            "exchange": "binance",
            "instrument": "ADAUSD_PERP",
            "timestamp": 1711570860000,
            "open": 0.6478,
            "high": 0.6478,
            "low": 0.6476,
            "close": 0.6476,
            "volume": 4075.73706105
        }
    }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
timestampnumberThe timestamp associated with this record in UTC.
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/futures', {headers: {x-api-key:'<api_key>'}});

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures:ohlcv', {'instrument': 'XRPUSDT', 'exchange': 'binance'}],
      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:futures:open_interests", { "instrument": "XRPUSDT", "exchange": "binance" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "e91d68fa-84c8-445b-8da4-62c9e6036b56",
        "result": {
            "exchange": "binance",
            "instrument": "BTCUSDT",
            "timestamp": 1711582494214,
            "value": "82862.305",
            "type": null
        }
    }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
timestampnumberThe time at which the data was received.
valuestringThe total open interest for the specified instrument.
typestringThe type of futures contract.

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures:open_interests', {'instrument': 'XRPUSDT', 'exchange': 'binance'}],
      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:futures:order:events", { "instrument": "XRPUSDT", "exchange": "binance" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "daa10b81-e434-417c-a172-a0ac73a6cb25",
        "result": {
            "exchange": "binance",
            "instrument": "BTCUSDT",
            "timestamp": 1711570943299,
            "exchangeTimestamp": 1711570943297,
            "exchangeTimestampNanoseconds": 0,
            "receivedTimestamp": 1711570943299,
            "receivedTimestampNanoseconds": 658463,
            "isBid": false,
            "data": [
                [
                    69020,
                    0.353,
                    null
                ],
                [
                    69028.7,
                    0.112,
                    null
                ],
                [
                    69030.4,
                    0.009,
                    null
                ]
            ],
            "sequence": 4292890252329
        }
    }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
timestampnumberThe timestamp at which the order book event took place.
exchangeTimestampnumberThe timestamp at which the event was recorded by the exchange.
exchangeTimestampNanosecondsnumberThe nanosecond timestamp at which the event was recorded by the exchange.
receivedTimestampnumberThe timestamp for when the update was received by our system.
receivedTimestampNanosecondsnumberThe nanosecond timestamp for when the update was received by our system.
isBidbooleanA boolean value indicating whether the data pertains to bid orders (true) or ask orders (false).
data[0]numberThe price level of the order(s).
data[1]numberThe quantity of the contract(s) at that price level.
data[2]numberThe number of individual orders at the specified price level.
sequencenumberA unique identifier for the order book event.

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures:order:events', {'instrument': 'XRPUSDT', 'exchange': 'binance'}],
      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:futures:order:snapshots", { "instrument": "XRPUSDT", "exchange": "binance" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument. (REQUIRED)
exchangestringThe exchange for which to retrieve asset instruments. (OPTIONAL)

Response

{
  "jsonrpc": "2.0",
  "method": "subscription",
  "params": {
      "subscription": "8e1f5873-5023-4989-8573-2e91a6e4112c",
      "result": [
          {
              "exchange": "binance",
              "instrument": "BTCUSDT",
              "timestamp": 0,
              "exchangeTimestamp": 1711570980336,
              "isBid": false,
              "data": [
                  [
                      69135.8,
                      0.07,
                      null
                  ],
                  [
                      69136.4,
                      0.029,
                      null
                  ]
              ],
              "sequence": 4292893574687,
              "currentFunding": null
          }
      ]
  }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
timestampnumberThe time at which the order book snapshot took place.
exchangeTimestampnumberThe timestamp at which the event was recorded by the exchange.
isBidbooleanA boolean indicator of whether the orders in the snapshot are buy (bid) orders.
data[0]numberThe price level of the order.
data[1]numberThe quantity of the asset available at the specified price level.
data[2]numberThe number of individual orders that are aggregated at the specified price level.
sequencenumberA unique identifier for the order book state.
currentFundingnumberThe current funding rate for perpetual futures contracts.

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures: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:futures:tickers", { "instrument": "BTCUSDT", "exchange": "binance" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "d5475b6c-552a-4ab6-903a-ba054e468ab5",
        "result": {
            "exchange": "binance",
            "instrument": "BTCUSDT",
            "exchangeTimestamp": 1711571015981,
            "exchangeTimestampNanoseconds": 0,
            "timestamp": 1711571015981,
            "bid": 69135.9,
            "ask": 69136,
            "mid": 69135.95,
            "last": null,
            "sequence": 4292896044090,
            "markPrice": 69136.1,
            "lastVolume": null,
            "bidVolume": 9.517,
            "askVolume": 0.527
        }
    }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
exchangeTimestampnumberThe exchange provided timestamp.
exchangeTimestampNanosecondsnumberThe exchange provided nanosecond part of the exchangeTimestamp (if available from the exchange).
timestampnumberThe timestamp at which the event took place.
bidnumberThe bid of the instrument.
asknumberThe ask of the instrument.
midnumberThe mid of the instrument.
lastnumberThe last of the instrument.
sequencenumberThe sequence number (equal to null if it is not provided by the exchange).
lastVolumenumberThe last volume for the instrument.
bidVolumenumberThe order size of the best bid.
askVolumenumberThe order size of the best ask.

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures:tickers', {'instrument': 'BTCUSDT', 'exchange': 'binance'}],
      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:futures:trades", { "instrument": "XRPUSDT", "exchange": "binance" } ]
}
ParamTypeDescription
instrumentstringThe asset instrument.
exchangestringThe exchange for which to retrieve asset instruments.

Response

{
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
        "subscription": "1e235200-b099-457c-956d-e981605ab105",
        "result": {
            "exchange": "binance",
            "instrument": "XRPUSDT",
            "exchangeTimestamp": 1711571031275,
            "exchangeTimestampNanoseconds": 0,
            "isBuySide": false,
            "quoteSize": null,
            "price": 0.6159,
            "size": 211.4,
            "tradeId": "1443425767"
        }
    }
}
FieldTypeDescription
exchangestringThe exchange name.
instrumentstringThe instrument name.
exchangeTimestampnumberThe timestamp at which the event was recorded by the exchange.
exchangeTimestampNanosecondsnumberThe nanosecond timestamp at which the event was recorded by the exchange.
isBuySidebooleanA boolean value indicating the direction of the trade from the perspective of the initiator.
quoteSizenumberThe total amount of the quote asset of the instrument that was traded.
pricenumberThe price at which the futures contract was traded.
sizenumberThe quantity of the contract that was traded.
tradeIdstringA unique identifier for this specific trade.

Example

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

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['market:futures:trades', {'instrument': 'XRPUSDT', 'exchange': 'binance'}],
      id: 1,
    }));
});

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