01Inputs#
| Symbol | Meaning | Source |
|---|---|---|
P_mark | Mark price | Hyperliquid metaAndAssetCtxs |
P_liq | Liquidation price of the position | Hyperliquid clearinghouseState → liquidationPx |
M | Margin of the position, USD | Hyperliquid clearinghouseState → marginUsed |
σ_r | Realized vol, annualized, 168 hourly closes | Hyperliquid candleSnapshot (1h) |
k | Tier payout share | 25% / 50% / 75% |
T | Window in years | 24/8760 · 72/8760 · 168/8760 |
02Log distance#
Prices move multiplicatively, so distance is measured in log terms. For a long, liquidation sits below mark; for a short, above. The absolute value makes the formula side-agnostic.
d = | ln( P_liq / P_mark ) |always ≥ 0A 10% drop is d = 0.1054; a 10% rise is d = 0.0953. Short liquidations are slightly further away in log terms for the same percent distance.
03Realized volatility#
Phoenix uses the last 168 hourly closes from Hyperliquid. Log returns, unbiased standard deviation (n − 1), annualized with √8760. No implied vol, no external feed.
r_i = ln( C_i / C_{i−1} )hourly log returnsσ_r = stdev(r) · √(8760)annualizedσ = σ_r · 1.25tail-adjustedShort-horizon returns have fat tails and gap risk that a Brownian model underprices. Multiplying σ by 1.25 raises the price of far-from-liquidation covers proportionally more than near ones, which is where the Brownian model is weakest.
04First-passage probability#
A liquidation happens the first time mark touches the liquidation price, not where it closes. Model log price as a driftless Brownian motion with volatility σ. By the reflection principle, the probability that it reaches distance d at any time before T is twice the probability that it ends beyond d:
pLiq = P( min_{t≤T} X_t ≤ −d ) = 2 · Φ( −d / (σ·√T) )survival = 1 − pLiqWhy not use the closing distribution? Because a position that dips through its liquidation price and recovers is still liquidated. Using the end-of-window distribution would roughly halve the true risk.
05Payout, fair price, loading, floor#
payout = min( k · M , $ 5,000 , 2% · Nest )fair = payout · pLiqexpected losspremium = max( fair · (1 + 0.3) , payout · 0.0025 )premium_pass = premium · (1 − 0.1)≥ 1,000,000 $PHNXpayout_HYPE = payout / HYPE_USDquoter, at purchaseThe floor binds whenever pLiq < 0.25% ÷ 1.30 = 0.192%. For most well-margined positions on a 24-hour window, you pay the floor.
The quoter converts payout and premium to HYPE at its HYPE/USD price and rounds the premium up, so the HYPE premium never lands under the on-chain floor. The contract re-checks the bounds: payout ≤ tier × covered margin and ≤ the caps, premium between the floor and the refusal threshold.
06Refusals#
| Reason | Rule | Why |
|---|---|---|
no-liq-price | Hyperliquid reports no liquidation price | Nothing to insure; the position can't be liquidated at current equity. |
too-close | distance < 2% | Mark noise alone can liquidate it; a fair price doesn't exist. |
too-risky | premium > 60% of payout | You would pay most of the payout up front. Reduce leverage instead. |
bad-input | missing mark, margin or vol | Fails closed when data is unavailable. |
07Worked example#
Example inputs: a 10x isolated long, mark $100.00, margin $1,000, realized vol 60%, Flame tier, 24 hours window. Liquidation price from approxLiqPx on a 40x-max coin (maintenance margin = half of the initial margin at the coin's maximum leverage): $91.25.
d = |ln(91.25 / 100.00)| = 0.09157σ = 0.6 × 1.25 = 0.7500σ·√T = 0.7500 × √(24/8760) = 0.03926z = d / (σ·√T) = 2.3325pLiq = 2 · Φ(−2.3325) = 2 × 0.00984 = 1.967%payout = 50% × $1,000 = $500fair = $500 × 1.967% = $9.84premium = max($12.79, $1.25) = $12.792.56% of payoutLoading live markets…
08Calculator#
Every input is editable. Volatility comes live from /api/markets when you pick a coin; type your own σ to override it.
- d0.20764
- σ = σ_r × 1.2575.0%
- σ·√T0.03926
- z = d / σ√T5.2893
- pLiq = 2Φ(−z)0.000%
- payout$500.00
- fair = payout × pLiq$0.00
09Model limits#
import { quote } from "@/lib/model";
const q = quote({
markPx: 100, liqPx: 91.25, marginUsd: 1000,
annualVol: 0.6, // from /api/markets → vol (not tail-adjusted)
tier: "flame", window: "24h",
});
// q.ok → true, q.pLiq → 0.019673, q.premiumUsd → 12.7877