Stress Input Lab

How the stress numbers behind a collateral weight are measured from price history. Change an input and each formula, chart and weight below recomputes from the stored candle statistics.

Debt
What the four numbers mean

Picture a borrower who has borrowed the maximum against one collateral asset, and then the collateral price falls. Three price levels matter, and the two weights set where they sit.

Init weight winit
The share of collateral value that counts when someone borrows. It sets the max-borrow point: the price at which a new loan is at its limit. A lower value means a smaller loan for the same collateral.
Maint weight wmaint
The share of collateral value that counts when the protocol decides whether to liquidate. It sets the trigger: once the price falls to this level the position can be liquidated. It is always above winit, and it is also the weight you are most afraid of setting too high.
Room R = 1 − winit / wmaint
The cushion before liquidation: how far the price can fall from the max-borrow point to the trigger. It protects the borrower from being liquidated by ordinary noise right after borrowing. It has to cover R* = c · σday + tw_lag, a normal day's move plus the time-weighted lag.
Buffer B = 1 − wmaint / (wL · k)
The cushion after the trigger: how far the price can keep falling while a liquidation can still repay the whole debt. Past the clear line, even seizing all the collateral, after the liquidator's and the insurance fees, no longer covers the debt, so the loss falls on the protocol. The buffer protects the protocol, and it has to cover G, the fall that can happen while nobody is able to liquidate (stale oracle, bot down, congestion).

Debt asset. With a stablecoin debt (aUSD) the debt price is flat, so only the collateral's price moves. With aBTC debt both legs move: a fall in the collateral ÷ debt price ratio is the collateral dropping or BTC rising. Every number on this page (σday, G, tw_lag) is then measured on that ratio, so a collateral that moves with BTC needs less buffer than the same collateral against aUSD.

Short version: room is for the borrower, buffer is for the protocol. Room is spent before the trigger, buffer after it. Raising the maint weight shrinks the buffer; raising init relative to maint shrinks the room. The clear line is a modelling threshold, not a protocol state: the program's own bankruptcy check only fires when what is left is close to zero.

Step 1

Daily volatility, σday

Every one-minute close gives a log return. The standard deviation of those returns, scaled by the square root of the 1,440 minutes in a day, is the daily volatility. It sets the size of a normal day and the cushion a borrower needs.

daily closehistory not used
Step 2

Empirical stress gap, Gemp

Assume nobody can liquidate for a window W: the oracle is stale or the bot is down. For every minute i, measure how far the price falls from that close to the lowest low inside the window. Gemp is a high quantile of those falls. Choosing max uses the single worst fall in the whole history, the most conservative setting, which moves with every new crash.

worst fall starting each daydays above Gemphistory not used

closelowworst fall in this excerpt

Step 3

Normal tail versus real tail

If returns were normal, the gap at quantile q would be zq · σday · √(W/1440). The gap is measured to the lowest low in the window, so the relevant z is the two-sided one, zq = Φ−1((1+q)/2): a falling price reaches a given depth at some point in the window about twice as often as it ends the window there. Real prices fall further than that in the tail. The extra is the jump. The solver uses G = normal + jump, which is the larger of the two.

measured gapnormal modeljump
Step 4

Time-weighted lag, tw_lag

Initial health reads a smoothed price, maintenance health reads the live one. When the live price drops under the smoothed one, a position that looked fine at borrow time is already closer to liquidation. tw_lag is a quantile of that shortfall.

closeEMAclose below EMA

Step 5

From stress to weights

The buffer B is the price fall between the liquidation trigger and the line where a full liquidation stops clearing the debt. It has to cover G. The room R is the fall between the max-borrow price and the trigger. It has to cover R*.

room, max borrow to triggerbuffer, trigger to clear linepast the clear linestress gap G

Same ladder in money. Take a borrower at the max-borrow point with 100 of debt. The collateral is then worth 100 · wL / winit. As the collateral price falls, its value falls with it while the debt stays at 100 (debt price held flat, interest ignored). A liquidation only gets the collateral after the liquidator and insurance fees, so what it can actually repay is k times the collateral value. Three markers: the trigger is where the position becomes liquidatable; the clear line is where k × collateral drops below the debt, so a full liquidation no longer repays it; collateral = debt is where the collateral is worth less than the debt even with no fees at all.

collateral valueafter liquidation fees (× k)debt = 100fees leave the debt uncovered

Weights are the largest values on a 0.01 grid that meet both conditions. This page uses the same arithmetic as scripts/weight_calibration.py, applied to statistics computed once from the cached candles. Defaults for the fees are placeholders. Use the real bank values.

The 60-minute EMA span is a guess at the oracle's horizon, so check it against the feed. Candles come from one exchange and may differ from the oracle's own price. HYPE, MORPHO and ONDO use Bybit perpetuals, which track spot closely but are not spot; the others use Binance spot. Statistics for shorter histories are computed over that slice only.