The finance developer workbenchSearch the reference Development · 0.1.4 · unpublished

structure / wire operation

Dealer exposure & levels from an option chain

totalfinance.structure.exposures

Compute dealer-positioning exposure (net GEX/DEX at spot) and key levels — call/put walls, zero-gamma flip, max pain, pin risk, and 0DTE/weekly/monthly OPEX walls — from an option chain. Each row needs `strike`, `expiry`, `type`, `openInterest`, and either `impliedVolatility` or `price` (IV is implied from price when omitted). Inferred from open interest and a sign convention (echoed in `assumptions.convention`, with its caveats as `model.limitation` warnings in `diagnostics.warnings`) — it does not know true dealer books.

Pack / profilesstructure / default, full
Default discoveryIncluded
Required capabilitiesNone
Effects / authorizationnone / none
Cost / cancellationsmall / Do not assume inline interruption
Handle-eligible inputsNone
Idempotencynot-applicable
Input schema
{
  "type": "object",
  "properties": {
    "chain": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "strike": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "expiry": {
            "type": "string",
            "description": "ISO date YYYY-MM-DD"
          },
          "type": {
            "type": "string",
            "enum": [
              "call",
              "put"
            ]
          },
          "openInterest": {
            "type": "number",
            "description": "Open interest (contracts)"
          },
          "impliedVolatility": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "Implied volatility (decimal); when omitted, implied from `price`"
          },
          "price": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "Option mid price; used to imply IV when `impliedVolatility` is omitted"
          },
          "multiplier": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "Contract multiplier (default 100)"
          }
        },
        "additionalProperties": false,
        "required": [
          "strike",
          "expiry",
          "type",
          "openInterest"
        ]
      },
      "description": "The option chain: one row per contract"
    },
    "spot": {
      "type": "number",
      "exclusiveMinimum": 0
    },
    "riskFreeRate": {
      "type": "number",
      "description": "Continuously-compounded risk-free rate (decimal)"
    },
    "asOf": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "string"
        }
      ],
      "description": "Valuation instant — epoch ms or a zoned ISO datetime such as \"2026-07-20T10:30:00-04:00\". A bare YYYY-MM-DD is refused: a same-day option's value depends on the time of day. For an end-of-day mark use the 16:00 ET close (13:00 ET on early-close days)."
    },
    "dividendYield": {
      "type": "number"
    },
    "convention": {
      "type": "string",
      "enum": [
        "callsPositivePutsNegative",
        "dealerShortGamma"
      ],
      "description": "Dealer sign convention — REQUIRED, it decides the sign of every exposure number; echoed back with its limitations"
    },
    "style": {
      "type": "string",
      "enum": [
        "american",
        "european"
      ],
      "description": "Exercise style of every contract in the chain — REQUIRED (listed US equity options are 'american'); the library never defaults it"
    },
    "gammaUnit": {
      "type": "string",
      "enum": [
        "per1PercentMove",
        "perPoint"
      ],
      "description": "GEX units: per1PercentMove (default, the specification formula) or perPoint"
    },
    "underlying": {
      "type": "string",
      "description": "Ticker symbol of the chain — REQUIRED, it names every contract"
    },
    "topStrikes": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "description": "How many top-|GEX| strikes to return (default 10)"
    }
  },
  "additionalProperties": false,
  "required": [
    "chain",
    "spot",
    "riskFreeRate",
    "asOf",
    "convention",
    "style",
    "underlying"
  ]
}
Output schema
{
  "type": "object",
  "properties": {
    "spot": {
      "type": "number"
    },
    "atSpot": {
      "type": "object",
      "description": "Net dealer exposure at spot",
      "properties": {
        "gex": {
          "type": "number"
        },
        "dex": {
          "type": "number"
        }
      },
      "required": [
        "gex",
        "dex"
      ]
    },
    "levels": {
      "type": "object",
      "description": "Walls, zero-gamma, max pain, pin risk, and OPEX walls"
    },
    "netDrift": {
      "type": "object",
      "description": "Gamma regime + pin/trend bias + charm/vanna flow"
    },
    "topStrikes": {
      "type": "array",
      "description": "Highest-|GEX| strikes, most concentrated first",
      "items": {
        "type": "object"
      }
    },
    "assumptions": {
      "type": "object",
      "description": "Every applied convention: the sign `convention`, gammaUnit, priceSource, minTimeToExpiry, defaultMultiplier, …"
    },
    "diagnostics": {
      "type": "object",
      "description": "Warnings, including the model limitations as `model.limitation` entries (positioning is estimated from OI + a sign convention, not true dealer books)"
    }
  },
  "required": [
    "spot",
    "atSpot",
    "levels",
    "netDrift",
    "topStrikes",
    "assumptions",
    "diagnostics"
  ]
}

All operations · Setup, handles, jobs & permissions