Options Book Risk (Greeks + SPAN)
options_riskPortfolio greeks (delta/gamma/vega/theta/vanna/volga) + SPAN-style scenario margin for an options book on Black-76. Given a list of legs {type, strike, expiryDays, iv, quantity(signed)} and a forward, returns aggregate greeks, first-order P&L per underlying move, and the worst-case loss over a price×vol grid. Self-checked: analytic greeks are verified against finite-difference derivatives of the repriced book. Call to size an options book's true net risk and margin — not the sum of per-leg notionals.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| r | No | discount rate, default 0 | |
| forward | No | shared forward price (or set per position) | |
| positions | Yes | option legs of the book | |
| scanRangePct | No | SPAN price scan range, default 0.15 | |
| volShiftVolPts | No | SPAN vol shift in vol-points, default 10 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | false when the engine rejected the input | |
| model | No | Black-76 assumptions used | |
| proof | No | Verifiability envelope: echoed inputs, engine codeHash, contentHash of this exact result, self-checks, EIP-712 signature (EAS-ready). Re-run the open engine on `inputs` to reproduce the result byte-for-byte. | |
| checks | No | Ground-truth self-checks; the result is untrustworthy if any fails. | |
| greeks | No | aggregate delta/gamma/vega/theta/vanna/volga — each verified vs finite differences | |
| positions | No | per-leg pricing breakdown | |
| spanMargin | No | worst-case loss over the price×vol scenario grid (SPAN-style margin) | |
| portfolioValue | No | mark-to-model value of the book | |
| positionsCount | No | number of legs priced | |
| pnlPerUnderlyingPctMove | No | first-order P&L per % move of the underlying |