market:futures:ohlcv

Subscribes/Unsubscribes to market futures OHLCV data.

Once you're connected to this subscription: wss://ws.amberdata.com/futures, your subscription message must include either a pair/instrument or an exchange field. At least one must be specified — both cannot be empty.

🗒️

Note:

  • Instrument-level wildcards (e.g., "instrument": "ALL") are no longer supported.
  • Exchange-level wildcard subscriptions are only supported for Spot markets.
  • For Futures and Options, you must subscribe using explicit instrument-level subscriptions. See here for more details.

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));
});