Structures Greeks API - Aggregate Position Greeks - FlashAlpha Lab API
Lab API Structures Greeks

Structures Greeks API

Aggregate Black-Scholes Greeks across a multi-leg position, with per-leg expiry and implied vol so calendars and diagonals aggregate correctly.

Endpoint

POST /v1/structures/greeks
Auth required (X-Api-Key) Rate Limited: Yes Basic+

Request Body Fields

Name In Required Default Description
legsbodyyes - One or more legs. Must be non-empty.
legs[].actionbodyyesbuybuy (alias long) or sell (alias short).
legs[].typebodyyescallcall (alias c) or put (alias p).
legs[].strikebodyyes - Strike price. Must be > 0.
legs[].expirybodyyes - Leg expiry, YYYY-MM-DD.
legs[].impliedVolbodyyes - Implied volatility as a decimal (e.g. 0.28). Must be > 0.
legs[].quantitybodyno1Number of contracts. Must be > 0.
spotbodyyes - Underlying spot price priced against. Must be > 0.
todaybodynotoday (UTC)Valuation date, YYYY-MM-DD.
ratebodyno0.045Risk-free rate (decimal).
dividendYieldbodyno0.013Continuous dividend yield (decimal).

Request Body

{
  "legs": [
    { "action": "buy",  "type": "call", "strike": 100, "expiry": "2026-07-17", "impliedVol": 0.28, "quantity": 1 },
    { "action": "sell", "type": "call", "strike": 110, "expiry": "2026-07-17", "impliedVol": 0.25, "quantity": 1 }
  ],
  "spot": 102.5,
  "today": "2026-06-05",
  "rate": 0.045,
  "dividendYield": 0.013
}
curl -X POST "https://lab.flashalpha.com/v1/structures/greeks" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "legs": [
          { "action": "buy",  "type": "call", "strike": 100, "expiry": "2026-07-17", "impliedVol": 0.28, "quantity": 1 },
          { "action": "sell", "type": "call", "strike": 110, "expiry": "2026-07-17", "impliedVol": 0.25, "quantity": 1 }
        ],
        "spot": 102.5,
        "today": "2026-06-05",
        "rate": 0.045,
        "dividendYield": 0.013
      }'
import requests

resp = requests.post(
    "https://lab.flashalpha.com/v1/structures/greeks",
    headers={"X-Api-Key": "YOUR_API_KEY"},
    json={
        "legs": [
            {"action": "buy",  "type": "call", "strike": 100, "expiry": "2026-07-17", "impliedVol": 0.28, "quantity": 1},
            {"action": "sell", "type": "call", "strike": 110, "expiry": "2026-07-17", "impliedVol": 0.25, "quantity": 1},
        ],
        "spot": 102.5,
        "today": "2026-06-05",
        "rate": 0.045,
        "dividendYield": 0.013,
    },
)
data = resp.json()
print(f"Position delta: {data['position_greeks']['delta']}")
const resp = await fetch(
  "https://lab.flashalpha.com/v1/structures/greeks",
  {
    method: "POST",
    headers: {
      "X-Api-Key": "YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      legs: [
        { action: "buy",  type: "call", strike: 100, expiry: "2026-07-17", impliedVol: 0.28, quantity: 1 },
        { action: "sell", type: "call", strike: 110, expiry: "2026-07-17", impliedVol: 0.25, quantity: 1 }
      ],
      spot: 102.5,
      today: "2026-06-05",
      rate: 0.045,
      dividendYield: 0.013
    })
  }
);
const data = await resp.json();
console.log("Position delta:", data.position_greeks.delta);

This is a pure-math POST endpoint: each Greek is computed analytically from the legs and spot/IV you supply, with no market-data lookup, symbol resolution, or live IV. There is no live Try-It widget for it - run the cURL example above to try it.

Response

{
  "spot": 102.5,
  "as_of": "2026-06-05T14:32:10.123Z",
  "valuation_date": "2026-06-05",
  "rate": 0.045,
  "dividend_yield": 0.013,
  "legs": [
    { "action": "buy",  "type": "call", "strike": 100, "expiry": "2026-07-17", "impliedVol": 0.28, "quantity": 1 },
    { "action": "sell", "type": "call", "strike": 110, "expiry": "2026-07-17", "impliedVol": 0.25, "quantity": 1 }
  ],
  "position_greeks": {
    "delta": 0.3142,
    "gamma": 0.0184,
    "theta": -0.0421,
    "vega": 0.1163,
    "rho": 0.0457,
    "vanna": -0.0039,
    "charm": 0.0008
  }
}

Key Response Fields

Field Type Description
spotnumberUnderlying spot price priced against
as_ofstringServer timestamp of the computation
valuation_datestringThe resolved today
ratenumberRisk-free rate used (decimal)
dividend_yieldnumberContinuous dividend yield used (decimal)
legsarrayEchoes the request body (camelCase field names)
position_greeksobjectAggregated delta, gamma, theta, vega, rho, vanna, and charm

Errors

Status Error When
400empty_legslegs is missing or empty.
400invalid_spotspot <= 0.
400invalid_actionleg[i].action is not buy/sell (or long/short).
400invalid_typeleg[i].type is not call/put (or c/p).
400invalid_strikeleg[i].strike <= 0.
400invalid_ivleg[i].impliedVol <= 0.
400invalid_expiryleg[i].expiry is not a valid YYYY-MM-DD date.
400invalid_quantityleg[i].quantity <= 0.
403tier_restrictedFree plan. Requires Basic or higher.

About

This endpoint is part of the Structures family of pure-math multi-leg utilities. Every result is a deterministic function of the legs you supply: there is no market-data lookup, no symbol resolution, and no live IV. You pass the legs and the spot/IV you want priced against, and the response is computed analytically.

Each Greek is signed for direction (long +, short ) and scaled by quantity, then summed across legs. Because every leg carries its own expiry and implied vol, calendars and diagonals aggregate correctly. Legs that have already expired relative to today contribute zero.

Common Use Cases

  • Read net position_greeks.delta to see directional exposure and hedge a multi-leg trade to the share count you want
  • Watch position_greeks.gamma to size how fast that delta shifts as spot moves, so you know how often to rebalance
  • Track position_greeks.theta for daily time-decay carry and confirm a short-premium structure is collecting as intended
  • Use position_greeks.vega to quantify IV exposure and gate the trade on your volatility view
  • Aggregate Greeks correctly across calendars and diagonals because each leg carries its own expiry and impliedVol
  • Stress the position by re-POSTing with alternative spot or impliedVol to map the Greeks across scenarios
  • Surface higher-order vanna and charm in a risk panel to anticipate delta drift from vol and time

Related reading

Complementary endpoints

  • Structure P&L - pair these Greeks with the at-expiry payoff for the same legs
  • Option Quote - source live spot and per-leg IV to feed this call
  • Exposure Sheet - see how the same Greeks roll up across a whole book

Ready to build?

Get your free API key and start pulling live options data in 30 seconds.