GreeksEngine and HedgeSuggester are the read-only surface that quantifies that short exposure and proposes how an MM might hedge its residual risk. Both are pure analytics — they never hold a signer, never build a tx, and every number they return is derived from the protocol’s own deployed math, not a parallel pricing model.
That last property is the whole point. Greeks computed off a reimplemented Black-Scholes would drift from what the protocol actually pays at settlement. Instead, price greeks finite-difference the deployed ILMath.computeIL (the literal settlement function), and vol greeks finite-difference the on-chain FairValueOracle.fairRate (the Φ-sum, never reimplemented off-chain). The Greeks are exact with respect to the reference math — only the grid spacing is an approximation.
These two classes are wired into the SDK as
sdk.greeks (a GreeksEngine) and sdk.hedge (a HedgeSuggester); both receive only the read client, no engineBaseUrl, no chainId, and no walletClient. They are read-only by construction — there is no code path on this surface that sends a transaction.Method reference
GreeksOptions tunes the finite-difference stencils:
number
default:"64"
Interior grid points across
[Pa, Pb] for the replication strip (DEFAULT_POINTS = 64).number
default:"0.01"
Relative price bump for the central-difference δ/γ (1% by default).
bigint
default:"0.01 WAD"
Absolute σ bump (WAD) for vega —
10_000_000_000_000_000n, i.e. one vol point.number
default:"0.01"
Relative
T bump for theta (1% of the position’s duration).Price greeks — delta & gamma from ILMath.computeIL
The realized payoff at expiry price is the capped IL:
where is exactly what ILMath.computeIL returns on-chain. priceGreeks evaluates this function by calling the deployed contract at three points around the entry price — a central stencil — and reading off the first and second differences.
sqrtPForRatio maps a ratio back to a sqrtPriceX96 via , then feeds it to computeIL. With pinned at , the relative bump is the absolute step in ratio space, so the central differences are clean:
with priceBumpRel (default ). The three reads fire concurrently.
Units. δ and γ are reported per unit price-RATIO (, dimensionless) — the natural, decimals-independent convention. The payoff values themselves are in the 6-decimal numéraire (dUSDC) because
computeIL returns raw dUSDC; see decimals & units. This means γ > 0 over the in-range region (the claim is long-gamma) and decays toward zero once the cap binds — the payoff goes flat at MaxIL, so its second difference vanishes there.Vol greeks — vega & theta from FairValueOracle.fairRate
Delta and gamma describe the payoff’s shape given a price; vega and theta describe how the fair premium moves with volatility and time. The fair premium is the protocol’s own published fair value:
where fairRate is the closed-form Φ-sum evaluated by the Stylus FairValueOracle. volGreeks finite-differences this premium directly against the live oracle — it never reconstructs the Φ-sum off-chain:
sigmaBumpWad (default WAD). The down-bump is floored at zero so a small σ never underflows.
Theta is the central difference in , computed in seconds then rescaled to per-year:
where durationBumpRel of the duration (floored at 1 second) and seconds/year. The sign convention is : positive theta means value rises with more time, exactly as a long-gamma claim does.
The Greeks struct returned:
number
∂Payout/∂P0 — per unit price ratio.
number
∂²Payout/∂P0² — per unit price ratio squared; positive in-range.
number
∂Premium/∂σ — per 1.0 of vol.
number
∂Premium/∂T — per year.
Worked example — greeks for one position, then a book
greeks for a single position
bookGreeks sums δ/γ/ν/θ across positions and degrades per-row — a single unpriceable position is skipped and counted, never thrown:
aggregate greeks across an MM's book
The three-leg hedge suggestion
suggestHedge turns the book greeks into a concrete, approximate static hedge with three legs. It accepts a single position or an array (a whole book) as HedgeInput, computes everything off the same computeIL grid, and attaches the verbatim caveat to every result.
1
Replication strip — vanilla long-gamma options (Breeden-Litzenberger)
The convex capped payoff is statically replicated by a strike ladder. By Breeden-Litzenberger, the option density needed at strike is the second derivative . The suggester discretises over a shared price-ratio grid in (summing each position’s on-chain
computeIL), reads off the second differences as per-strike option notionals, and assigns the natural option type per side: puts below (the down-move IL wing), calls above.Nodes where the density is effectively zero — the capped / OTM-flat regions — are skipped. Carr-Madan is the integral form of the same idea; Lipton-Lucic-Sepp static replication is the theory anchor only — the number comes from the deployed math.2
On-chain inverse — a long-gamma range
The underwriter is short the LP’s in-range convexity, so the offsetting on-chain position is a long-gamma range over the same — a Panoptic long strangle or a GammaSwap borrowed-LP position. The suggester returns the book-aggregate edges (
rangeLow = min a/P0, rangeHigh = max b/P0) plus a size proxy (total liquidity), against which the MM right-sizes for funding. Venue is 'panoptic' (default) or 'gammaswap'.3
Delta overlay — flatten residual delta with a perp/spot
After legs 1 and 2 there is a residual book delta. The MM is short the claim, so its book delta is ; the overlay trades of the underlying to flatten it. The side is
sign(g.delta) (positive delta ⇒ long the underlying), the size is |g.delta|, and the instrument is 'perp' (default) or 'spot'.HedgeSuggestion returned:
HedgeLeg[]
Per-strike options:
{ strike, type: 'call' | 'put', notional }. Empty when geometry is unpriceable or the payoff is flat.OnChainInverse
{ venue, direction: 'long-gamma', rangeLow, rangeHigh, sizeL, note }.DeltaOverlay
{ instrument: 'perp' | 'spot', side: 'long' | 'short', size }.string
The verbatim
HEDGE_CAVEAT — always attached. See below.Worked example — suggest and inspect a hedge
three-leg hedge for an MM's book
The load-bearing caveat — analytics, not advice
Every suggestion carriesHEDGE_CAVEAT verbatim, and executeOnPanoptic always returns executed: false. This is not boilerplate — it is the precise statement that keeps the hedge analytics from being mistaken for a solvency mechanism, the single most important framing on this surface.
executeOnPanoptic makes the read-only contract explicit: it returns a PanopticPlan describing the inverse long-gamma range the MM may choose to open, with executed: false, and the same caveat copied through. The SDK does not execute on-chain hedges — it has no signer on this surface and never builds a transaction.
This is why the no-bad-debt claim lives on the LP surface and not here: the hedge analytics are about the underwriter’s residual risk, a separate concern from the LP’s payment guarantee.
Degradation behaviour
Like the rest of the SDK, this surface never throws on a missing read (the degradation envelope):greeksreturns{ priceable: false, reason: 'oracle-degraded', detail }if any on-chain read fails — the FVO or RPC is unreachable.bookGreeksskips degraded positions, counting them inskipped, and still returns a summedGreeksfor the priceable rows.suggestHedgeCheckedreturns aPriceableenvelope; on degradation,reason: 'oracle-degraded'.suggestHedgeinstead returns a structurally-valid empty hedge (empty strip, zero overlay, caveat attached) so a caller never crashes.
ILMath and the Stylus FairValueOracle directly and need no subgraph. See what’s live and the deployed addresses.
See also
MM client
Path-B pricing, the per-market quote (load + MaxIL-ratio band + capacity), and
greeksForSwap on an active book.The Φ-sum
The closed-form fair value
fairRate finite-differences for vega/theta — read on-chain, never reimplemented.IL formula
ILMath.computeIL — the reference settlement math the price greeks differentiate.Theory anchors
Breeden-Litzenberger, Carr-Madan, and Lipton-Lucic-Sepp static replication.