Agent Reliability LabRequest a scope
Automation

Multi-dimensional portfolio stress-testing against liquidity shocks

VaR is calm-weather maths. A 12-by-6 shock matrix and a 60 percent margin ceiling show where a book dies in a liquidity event.

A book can spend months looking orderly and still die in a day of margin compression. This note is a control instrument: how to see hidden fragility before a broker’s margin call. It is not investment advice, not a product that produces yield, and not a claim that any book “survived” a period.

Most desks still read risk through calm-weather lenses: a VaR at 95 or 99 percent under a normal return assumption, an index beta, a static margin-utilisation print. In a break, correlations go to one, implied vol jumps, and clearing houses (CME, OCC) raise initial margin to protect themselves. The client’s positions are the shock absorber.

Why a 40 percent cushion is not a cushion

Take a schematic account: NAV 250,000, current margin 100,000. Utilisation U = Margin / NAV prints 40 percent. The desk reads “60 percent headroom.”

On an 8–10 percent index drop, three things move together:

  1. Negative gamma. Short-option delta grows as the underlier falls. Each further hundred points costs more than the last. NAV is no longer 250,000.
  2. Vega. A VIX jump from the teens to the thirties reprices short vol against the book.
  3. The margin model. SPAN / portfolio-margin engines re-run their worst cases and lift the requirement.

The same schematic can print utilisation in the mid-eighties without a new “view” on the market. Another couple of percent and the broker disables the terminal and liquidates into the hole. Linear VaR did not have a cell for that joint move.

Four layers, not one overnight job

A control loop that depends on a person noticing is already late. The build is a stack:

  • L0 — smart snapshot, intraday. A full reprice every few seconds wastes broker gateways. Recalc every 30 minutes, or immediately on a move_watch if named underliers (SPY, QQQ, or a high-risk sleeve) move more than a set threshold from the open. Hard lines: utilisation, cumulative gamma, extreme one-day vol. A breach is a push to Telegram or WhatsApp in seconds, not a morning email.
  • L1 — pre-open score. Before the cash session, a deterministic pass over the open book: net and beta-weighted delta, portfolio gamma, aggregate vega, daily theta, HHI concentration, share of margin in the top five names. Status is HEALTHY, WARN, or CRITICAL BREACH, with a de-risking queue — names, not a essay.
  • L2 — material deltas only. Versus yesterday: margin up more than a set percent, quiet delta drift from expiry or from going in-the-money, vol quotes outside a historical IQR. The desk is not asked to re-read a sheet that did not change.
  • L3 — weekly (and on a macro shift) what-if. The same shock grid the rest of this note describes, plus a multi-agent reading of the tails. The ensemble does not pick trades. It is asked where the matrix is lying.

A 12-by-6 map, Taylor not a full re-sim

The question is not “where does the market go.” It is: what does this book do at every pair of price shock and vol shock.

For a fast P&L without a full Black–Scholes re-run on every leg, a quadratic Taylor read is enough for a screen:

ΔP&L ≈ (Σ beta-delta) · ΔS + ½ (Σ gamma) · (ΔS)² + (Σ vega) · Δσ + (Σ theta) · Δt

ΔS is the index price shock, Δσ a parallel shift of implied vol, Δt a one-to-five session lag.

A typical grid — figures are illustrative of the shape, not a live book:

Price \ vol Quiet (−2 IV) Unchanged +5 IV Panic (+12) Crash (+25)
Rally +10% modest gain smaller gain smaller still near flat loss
+5% gain gain smaller small loss loss
Flat small theta theta loss larger loss large loss
−5% loss larger larger large severe
−10% large larger severe severe very severe
−20% severe severe severe extreme extreme

If an extreme cell (say −10% / +12 IV) consumes more liquidity than the remaining headroom, the rule is mechanical: no new risk, long or short, until a tail hedge is on. That is a governor, not a view.

Margin capacity: a 60 percent ceiling in calm weather

Headroom is NAV × U_max − Margin_now. The build treats 60 percent utilisation in normal conditions as a hard ceiling, leaving the rest as a shock buffer. The number is a policy, not a law of nature. A desk that lives at 85 percent in the quiet has already spent the buffer the broker will demand in the noise.

Broker APIs drop, lag, and lie. A mathematical structural bound sits on top: for each sleeve, a theoretical maximum margin in a worst case. If the gateway returns a figure above that bound — or a suspiciously low one — the snapshot is invalid, the incident is logged, and automatic orders are blocked. Trusting a naked API print is how a silent no-op looks in a risk stack.

Schema drift: a green report on a missing test

The dangerous cousin of a bad number is a missing number that still grades as pass.

In one audit, a developer removed a stale stress block, intending to replace it, and left schema_version at 1.0. Downstream scorers still called the check. A missing JSON key defaulted to empty, which the consumer read as PASS, pnl = +0, hedge dominates. For weeks the dashboard was perfect. The job was not running.

The fix is a contract, not a better prompt:

  1. Explicit schema_version. Any JSON shape change bumps the version.
  2. Fail loud. A missing required field stops status generation. It does not emit a zero.
  3. Deprecation log. A removed field names its replacement in metadata.

What this is for

The instrument exists so a joint price-and-vol shock is visible while there is still headroom, and so a missing field cannot impersonate a pass. It does not claim a count of margin calls, a yield, or a track record. Those sentences belong in a pitch. They do not belong here.

If the failure mode you care about is “the monitor was green and the work did not happen,” that is the same class as a silent no-op in any other pipeline. Request a scope when the book, the broker gateway, and the failure you will not tolerate can be named in writing.

What to check in your system
  • Is there a hard ceiling on margin use in calm weather (well below the broker's last-minute call)?
  • Is P&L read on a joint shock: a price gap and a volatility jump, not one axis at a time?
  • If a broker snapshot is missing a required field, does the monitor fail loud, or pass with a zero?
  • Does a material change versus yesterday surface on its own, or is the desk expected to re-read the whole pack?
Agent Reliability Lab
● Online