Skip to content

WebSockets · Options

Options greek_flow stream

Customer Greek flow of the forming minute.
WS/v1/ws/options/greek_flowwsOptionsGreekFlow
On this page

The net and the cumulative customer Greek flow (delta, gamma, vega, theta, vanna and charm of the contracts customers bought minus those they sold) of the forming one-minute bucket. The flow is read every 2 seconds and the forming minute is sent when it changed, so at most once every 2 seconds, and once more with closed true when the minute is over: about 2 seconds after it ends, so the prints of its last moments are counted, or as soon as the next minute has a print. A minute whose prints cannot be valued has null values. cumulative runs from the start of the session and is the authoritative total: a minute whose prints could not be valued is skipped in it, partial is true from then on and missing_prints counts the directional prints without Greeks through this minute. A late print for a minute that was already closed is not sent again; it is in the cumulative of the later events. units names the unit of each Greek, as GET /v1/options/flow/greek-flow does. Subscribe by option root or family. At most 25 distinct option roots are served at once across all connections (an operator setting); a subscription to one more is answered with a status event, state unavailable and reason capacity, until a slot frees.

Connect and subscribe

Open wss://api.ordermap.si/v1/ws/options/greek_flow?symbols=SPXW with your key in the Authorization header and your saved installation ID in X-OrderMap-Device-ID, then send a subscribe message. Up to 25 symbols per connection. Streams need API Pro. All keys and projects share one active device per account and one connection per event type. Reuse the same installation ID for every stream and reconnect. Browser subprotocols, limits and close codes are in WebSockets.

Node.js

import WebSocket from "ws";

// Create a UUID once per installation, save it, and reuse it for every stream.
const deviceId = process.env.ORDERMAP_DEVICE_ID;
if (!deviceId) throw new Error("Set ORDERMAP_DEVICE_ID to this installation's saved UUID.");

const ws = new WebSocket("wss://api.ordermap.si/v1/ws/options/greek_flow?symbols=SPXW", {
  headers: {
    Authorization: `Bearer ${process.env.ORDERMAP_API_KEY}`,
    "X-OrderMap-Device-ID": deviceId,
  },
});

ws.on("open", () => ws.send(JSON.stringify({ action: "subscribe", symbols: ["SPXW"] })));
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":["SPXW"]}

Upgrade headers

A persistent installation ID is required. Supply the header below, or offer it as an ordermap.device.<id> browser subprotocol with ordermap.v1. Reuse the same saved ID for every event type, key, project and reconnect. Headers are not subscription filters.

ParameterType and limitsDescription
X-OrderMap-Device-IDheaderoptionalstringat least 16 charactersat most 128 characterspattern ^[A-Za-z0-9_-]{16,128}$Required unless supplied as an ordermap.device.<id> subprotocol together with ordermap.v1. Generate one random identifier per client installation and persist it across event types, keys, projects and reconnects. Never send it in the URL.

Subscription parameters

1 parameter, none required. Send them in the query string of the upgrade request, or as the filters of a subscribe message.

ParameterType and limitsDescription
symbolsqueryoptionalarray<string>comma-separated in one parameter1 to 25 itemseach at most 128 characterspattern ^[A-Za-z][A-Za-z0-9.]{0,9}$Symbols to subscribe to (up to 25).

Event

Each event is one message: {"type":"event","event_type":"options.greek_flow","seq":N,"data":{...}}.

data of options.greek_flow

  • bucket_timeintegerunix-msrequiredStart of the minute. Unix epoch milliseconds (UTC).
  • closedbooleanrequiredFalse while the minute forms; true once, when it has ended.
  • greeksobjectrequiredThe six Greek flows.18 fields inside
    • charmobjectrequiredThe charm flow.2 fields inside
      • cumulativenumber | nullrequiredThe running total from the start of the session, including this minute.
      • netnumber | nullrequiredCustomer charm bought minus sold in the minute; null when its prints cannot be valued.
    • deltaobjectrequiredThe delta flow.2 fields inside
      • cumulativenumber | nullrequiredThe running total from the start of the session, including this minute.
      • netnumber | nullrequiredCustomer delta bought minus sold in the minute; null when its prints cannot be valued.
    • gammaobjectrequiredThe gamma flow.2 fields inside
      • cumulativenumber | nullrequiredThe running total from the start of the session, including this minute.
      • netnumber | nullrequiredCustomer gamma bought minus sold in the minute; null when its prints cannot be valued.
    • thetaobjectrequiredThe theta flow.2 fields inside
      • cumulativenumber | nullrequiredThe running total from the start of the session, including this minute.
      • netnumber | nullrequiredCustomer theta bought minus sold in the minute; null when its prints cannot be valued.
    • vannaobjectrequiredThe vanna flow.2 fields inside
      • cumulativenumber | nullrequiredThe running total from the start of the session, including this minute.
      • netnumber | nullrequiredCustomer vanna bought minus sold in the minute; null when its prints cannot be valued.
    • vegaobjectrequiredThe vega flow.2 fields inside
      • cumulativenumber | nullrequiredThe running total from the start of the session, including this minute.
      • netnumber | nullrequiredCustomer vega bought minus sold in the minute; null when its prints cannot be valued.
  • missing_printsintegerrequiredThe directional prints from the start of the session through this minute that carry no Greeks and are therefore not in net or cumulative.
  • partialbooleanrequiredTrue when a minute from the start of the session through this one was skipped in cumulative because its prints could not be valued, so cumulative leaves that flow out.
  • symbolstringrequiredThe root or family subscribed to.
  • unitsobjectrequiredThe unit of each Greek flow.6 fields inside
    • charmstringrequiredUnit of the charm flow.
    • deltastringrequiredUnit of the delta flow.
    • gammastringrequiredUnit of the gamma flow.
    • thetastringrequiredUnit of the theta flow.
    • vannastringrequiredUnit of the vanna flow.
    • vegastringrequiredUnit of the vega flow.

Example event

{
  "type": "event",
  "event_type": "options.greek_flow",
  "seq": 1,
  "data": {
    "bucket_time": 1792161000000,
    "closed": false,
    "greeks": {
      "charm": {
        "cumulative": -3000000,
        "net": -70000
      },
      "delta": {
        "cumulative": 1100000000,
        "net": -42000000
      },
      "gamma": {
        "cumulative": -80000000,
        "net": 3100000
      },
      "theta": {
        "cumulative": -2200000,
        "net": -90000
      },
      "vanna": {
        "cumulative": 15000000,
        "net": 200000
      },
      "vega": {
        "cumulative": 4000000,
        "net": 120000
      }
    },
    "missing_prints": 0,
    "partial": false,
    "symbol": "SPX",
    "units": {
      "charm": "usd_per_day",
      "delta": "usd",
      "gamma": "usd_per_pct",
      "theta": "usd_per_day",
      "vanna": "usd_per_volpt",
      "vega": "usd_per_volpt"
    }
  }
}

Before the upgrade

Errors before the upgrade are ordinary JSON errors; after it, problems arrive as messages and close codes (see WebSockets).

StatusMeaningBody
101Switching protocols: WebSocket protocol ordermap.v1.Switching protocols
400Invalid handshake parameters or missing, malformed or conflicting persistent device identifier.Error object
401Missing or invalid API key (Authorization, X-API-Key or, from a browser, the ordermap.key. subprotocol).Error object
403The plan has no streaming (streaming_not_in_plan), the dataset is not released, or the account is suspended.Error object
409stream_connection_limit: the account is already connected on another device, or already has this event type open on the active device. The existing connection is preserved.Retry-AfterError object
426The request is not a WebSocket upgrade.Error object
429Rate limit or WebSocket cooldown.Retry-AfterError object
503stream_unavailable: the stream is not enabled or its source is down; retry after Retry-After seconds.Retry-AfterError object

Authenticated responses carry the X-RateLimit-* headers (see rate limits); 429 and 503 add Retry-After.