WebSockets · Futures
Futures depth stream
/v1/ws/futures/depthwsFuturesDepthThe top ten price levels on each side whenever they change. Every event replaces the previous one, so the first event after subscribing is the initial snapshot. At most 10 symbols per connection.
Connect and subscribe
Open wss://api.ordermap.si/v1/ws/futures/depth?symbols=ES with your key in the Authorization header, then send a subscribe message. Up to 10 symbols per connection. One connection per account per stream; streams need API Pro. The protocol, limits and close codes are in WebSockets.
Node.js
import WebSocket from "ws";
const ws = new WebSocket("wss://api.ordermap.si/v1/ws/futures/depth?symbols=ES", {
headers: { Authorization: `Bearer ${process.env.ORDERMAP_API_KEY}` },
});
ws.on("open", () => ws.send(JSON.stringify({ action: "subscribe", symbols: ["ES"] })));
ws.on("message", (raw) => {
const message = JSON.parse(raw.toString());
if (message.type === "event") console.log(message.seq, message.data);
if (message.type === "gap") console.warn("continuity lost: refetch the range over REST", message);
});
ws.on("close", (code, reason) => console.log("closed", code, reason.toString()));Subscribe message
{"action":"subscribe","symbols":["ES"]}Subscription parameters
1 parameter, none required. Send them in the query string of the upgrade request, or as the filters of a subscribe message.
| Parameter | Type and limits | Description |
|---|---|---|
symbolsqueryoptional | array<string>comma-separated in one parameter1 to 10 itemseach at most 128 characterspattern ^[A-Za-z][A-Za-z0-9.]{0,9}$ | Symbols to subscribe to (up to 10). |
Event
Each event is one message: {"type":"event","event_type":"futures.depth","seq":N,"data":{...}}.
data of futures.depth
asksarray<object>requiredUp to ten ask levels, best first.3 fields insidepricenumberrequiredPrice.price_ticksstringrequiredPrice in ticks, as an integer string.sizeintegerrequiredResting contracts at the price.
bidsarray<object>requiredUp to ten bid levels, best first.3 fields insidepricenumberrequiredPrice.price_ticksstringrequiredPrice in ticks, as an integer string.sizeintegerrequiredResting contracts at the price.
contractstringrequiredDated contract.sequencestringrequiredSequence of the book this event reflects; empty on a repeated snapshot.symbolstringrequiredThe symbol subscribed to.tick_sizenumberrequiredMinimum price increment.timestampintegerunix-msrequiredTime of the book. Unix epoch milliseconds (UTC).validbooleanrequiredFalse while the book is not synchronized; the levels are then empty.
Example event
{
"type": "event",
"event_type": "futures.depth",
"seq": 1,
"data": {
"asks": [
{
"price": 5801.25,
"price_ticks": "23205",
"size": 41
},
{
"price": 5801.5,
"price_ticks": "23206",
"size": 63
}
],
"bids": [
{
"price": 5801,
"price_ticks": "23204",
"size": 52
},
{
"price": 5800.75,
"price_ticks": "23203",
"size": 87
}
],
"contract": "ESZ6",
"sequence": "1042",
"symbol": "ES",
"tick_size": 0.25,
"timestamp": 1792161000123,
"valid": true
}
}Before the upgrade
Errors before the upgrade are ordinary JSON errors; after it, problems arrive as messages and close codes (see WebSockets).
| Status | Meaning | Body |
|---|---|---|
101 | Switching protocols: WebSocket protocol ordermap.v1. | Switching protocols |
400 | Invalid handshake parameters. | Error object |
401 | Missing or invalid API key (Authorization, X-API-Key or, from a browser, the ordermap.key. subprotocol). | Error object |
403 | The plan has no streaming (streaming_not_in_plan), the dataset is not released, or the account is suspended. | Error object |
409 | stream_connection_limit: one live connection per account per event type.Retry-After | Error object |
426 | The request is not a WebSocket upgrade. | Error object |
429 | Rate limit or WebSocket cooldown.Retry-After | Error object |
503 | stream_unavailable: the stream is not enabled or its source is down; retry after Retry-After seconds.Retry-After | Error object |
Authenticated responses carry the X-RateLimit-* headers (see rate limits); 429 and 503 add Retry-After.