Skip to content

Formulae

Practitioner

The formulae behind funding, margin, liquidation, lending, fees, outcome payoffs and HyperEVM costs, written plainly, each with a line of explanation.

Rates are fractions unless marked: 0.0005 is 0.05%. Prices are in the quote asset.

premium = impact_price_difference / oracle_price
impact_price_difference = max(impact_bid_px - oracle_px, 0) - max(oracle_px - impact_ask_px, 0)
F (8-hour rate) = average_premium + clamp(interest_rate - average_premium, -0.0005, 0.0005)
hourly rate = F / 8
payment = position_size * oracle_price * hourly_rate
  • Premium sampled every 5 seconds, averaged over the hour; interest fixed at 0.0001 per 8 hours; funding capped at 4% per hour.
  • Notional uses the oracle price, not mark. Positive funding: longs pay.
  • Impact prices are average fills for the impact notional: 20,000 USDC for BTC and ETH, 6,000 USDC otherwise. See Funding.
HIP-3 premium = 0.5 * (impact_bid_px + impact_ask_px) / oracle_px - 1

HIP-3’s more responsive premium. The deployer also sets a funding multiplier (0 to 10), an 8-hour interest rate (-0.01 to 0.01) and a clamp (0 to 0.01, default 0.0003). See Operating a perp dex.

hyperp oracle(t) = min( sum_{i=0}^{1439} [ m(t - i min) * exp(-i/480) ] * (1 - exp(-1/480)) / (1 - exp(-3)),
4 * initial_mark_price )
where m(x) = initial_mark_price if x is before listing, else mark_price(x)

A hyperp’s oracle is an 8-hour exponentially weighted average of the last day’s minutely marks; its funding premium samples are 1% of the usual. See Hyperps.

APR (simple) = hourly_rate * 24 * 365

ctx.funding is already the hourly fraction. predictedFundings reports fundingIntervalHours per venue (some fund every 8 hours): normalise before comparing. The fixed 0.01% per 8 hours is 0.00125% per hour, 10.95% a year simple; the docs’ 11.6% is 1,095 compounded periods (1.0001^1095 - 1, about 11.57%). See Carry.

initial_margin = position_size * mark_price / leverage
maintenance_margin_rate = (initial margin rate at max leverage) / 2
transfer_margin_required = max(initial_margin_required, 0.1 * total_position_value)

Leverage is an integer from 1 to the asset’s maximum, checked only on open; at 20x maximum the maintenance rate is 2.5%. Withdrawals and transfers out must leave transfer_margin_required. See Margin.

maintenance_margin = notional * maintenance_margin_rate(tier) - maintenance_deduction(tier)
maintenance_deduction(0) = 0
maintenance_deduction(n) = maintenance_deduction(n - 1)
+ lower_bound(n) * (maintenance_margin_rate(n) - maintenance_margin_rate(n - 1))

The deduction keeps maintenance margin continuous across tiers. Margin table ids below 50 are one tier with maximum leverage equal to the id.

In Standard mode each perp dex, HIP-3 included, has its own balance and cross margin; unified and portfolio margin accounts share margin across dexes with the same collateral. See Account modes.

liq_price = price - side * margin_available / position_size / (1 - l * side)
side = 1 long, -1 short
l = 1 / maintenance_leverage (the tier at the liquidation price)
margin_available (cross) = account_value - maintenance_margin_required
margin_available (isolated) = isolated_margin - maintenance_margin_required

Liquidation starts below maintenance margin; below two thirds of it, the backstop liquidator takes over and the maintenance margin is not returned. See Liquidation.

ADL rank = (mark_price / entry_price) * (notional_position / account_value)

When an account goes negative, profitable opposite positions are closed in this order at the previous mark price. See Auto-deleveraging.

mark = median( oracle + EMA_150s(hl_mid - oracle),
median(best_bid, best_ask, last_trade),
weighted median of external perp mids )
EMA: numerator <- numerator * exp(-t / 2.5 min) + sample * t
denominator <- denominator * exp(-t / 2.5 min) + t
ema = numerator / denominator

With only two of the three inputs, a 30-second EMA of the local median is added. See Oracles.

borrow capacity = token_balance * borrow_oracle_price * ltv
liquidation_threshold = 0.5 + 0.5 * LTV (HYPE 0.825, BTC 0.75)
portfolio_margin_ratio = max over borrowable tokens of
portfolio_maintenance_requirement / portfolio_liquidation_value
portfolio_maintenance_requirement(token) = min_borrow_offset
+ sum over dexes of cross_maintenance_margin
+ borrowed_size_for_maintenance(token) * borrow_oracle_price(token)
portfolio_liquidation_value(token) = portfolio_balance(token)
+ min(borrow_cap(token), min(portfolio_balance(token), supply_cap(token))
* borrow_oracle_price(token) * liquidation_threshold(token))
borrow_oracle_price = median(HL spot USDC price, HL perp mark * USDT_USDC, HL perp oracle * USDT_USDC)
USDT_USDC = 1 / HL spot oracle price of USDC
min_borrow_offset = 20 USDC

Liquidatable when portfolio_margin_ratio > 0.95. LTVs: HYPE 0.65, BTC 0.5. See Portfolio margin.

takeover slippage threshold = size_liquidated * oracle_price * ((LTV + 2) / 3) * width
width = 3,000,000 USDC for HYPE, 300,000 USDC for BTC

The docs print this with unbalanced parentheses; this is the natural reading. Takeover goes in 20% steps between the partial and full thresholds, converting collateral on a TWAP with a 10-minute half-life.

health_factor = (supplied collateral value weighted by LTV) / borrowed value * 100%
liquidation price = borrowed_value / (supplied_amount * liquidation_threshold) (one collateral asset)

Manual borrows, Standard and Unified modes. At or below 100%, new borrowing is blocked but nothing is liquidated. See Borrowing and lending.

utilisation = total_borrowed_value / total_supplied_value
borrow APY = 0.05 + 4.75 * max(0, utilisation - 0.8)
supply APY = borrow APY * utilisation * 0.9

For stablecoins, accrued continuously, indexed hourly. The 0.9 is the 10% of borrow interest the protocol keeps as a liquidation buffer; the supply identity reproduced the API to 9 decimal places (measured). At 80% utilisation borrowing costs 5%; at 100%, 5% + 4.75 * 0.2 = 100%.

14-day weighted volume = 14-day perp volume + 2 * 14-day spot volume
builder fee = notional * f / 100000 (f in tenths of a basis point)

f = 10 is 1 bp; the cap is f = 100 (0.1%) on perps and f = 1000 (1%) on spot. See Fees, Builder codes.

HIP-3 perps, positive fee x, aligned-adjusted fee y, deployer scale s:
s < 1: protocol = y, deployer = s * x
s > 1: protocol = y * s, deployer = x * s
rebates (x < 0):
s < 1: protocol = y / (1 + s), deployer = y * s / (1 + s)
s > 1: protocol = y / 2, deployer = y / 2
user fee multiple (x = y) = s + max(s, 1)
growth mode: the all-in user fee, rebates and volume contribution * 0.1

s is 0 to 3, or 0 up to 10 in growth mode. See Deployer economics and risk.

HIP-4 outcome, deployer fee scale s in [0, 10]:
trader pays = base_rate * (s + max(s, 1))
deployer gets = base_rate * s
protocol gets = base_rate * max(s, 1)
base_rate = the trader's spot rate (maker or taker), after referral discount
charged on = the closing side only; opening is free; no maker rebates

Measured on mainnet on 2026-09-12 over 7,256 fills: every buy billed 0, every sell charged. See HIP-4.

Outcome volume credited to both users of a fill:
mint, nobody pays 0
trade, one side pays fee_paying_px * sz
trade, nobody pays 0
burn, both pay (maker_px + taker_px) * sz = sz
burn, only the taker pays taker_px * sz
settlement settle_fraction * sz

Only fee-paying volume counts toward fee tiers. See Measuring Hyperliquid.

Yes (side 0) pays settle_fraction
No (side 1) pays 1 - settle_fraction
Yes + No = 1 quote token, always

A question settles exactly one outcome to 1; only standalone outcomes settle between 0 and 1. See Settlement.

scalarPrice: Long = clamp((price - low) / (high - low), 0, 1)
Short = 1 - Long
price = the {seconds}-second TWAP of the named perp ending at {time}

See Market shapes.

recurring priceBinary settles Yes iff
markPrice0 + (settlementTime - t0) / (t1 - t0) * (markPrice1 - markPrice0) >= targetPrice

t0 and t1 are the mark updates either side of settlement. priceBucket uses the same price against thresholds P1 < P2 < …: N thresholds make N + 1 half-open buckets, lower bound inclusive, plus the fallback.

split: X quote -> X Yes + X No
merge: X Yes + X No -> X quote
merge question: X Yes of each outcome in a question -> X quote (limited by the smallest holding)
negate: X No of one outcome -> X Yes of every other outcome, fallback included

Merge question pays whenever a question’s Yes prices sum below 1. See Split, merge, negate.

crossing fee (HyperCore to HyperEVM) = 200,000 gas * base fee of the next HyperEVM block

Paid from the HyperCore balance, in HYPE if enough is held, else in the token sent at its USD value. Testnet: 99 of 100 USDC cost 0.000588 USDC; all 100 was refused. See Moving assets.

precompile gas = 2000 + 65 * (input_len + output_len) (bytes)

An invalid input consumes all gas forwarded. See Precompiles.

perp price = raw / 10^(6 - szDecimals)
spot price = raw / 10^(8 - base szDecimals)
EVM decimals = weiDecimals + evmExtraWeiDecimals
HyperCore to HyperEVM amount must satisfy wei % 10^abs(evmExtraWeiDecimals) == 0 when evmExtraWeiDecimals < 0

See Asset encoding cheat sheet.

exchange request weight = 1 + floor(batch_length / 40)
address action allowance = 10000 + cumulative USDC traded (1 request per 1 USDC)
cancel allowance = min(limit + 100000, limit * 2)
open order limit = min(1000 + floor(volume / 5,000,000 USDC), 5000)
priority fee = notional * p / 100,000,000 ({"p": p}; 80,000 = 8 bps)

See Rate limits and Priority fees.

Hyperliquidity price ladder: px_0 = startPx, px_i = round(px_{i-1} * 1.003)
HIP-3 reserve deployments = 7 + 0.2 * n_auction_deployments
anchor genesis share basis = balance - 1e-6 * anchorTokenMaxSupply (negative gets nothing)
staking reward rate proportional to 1 / sqrt(total HYPE staked) (about 2.37% a year at 400M staked)

See HIP-2, perp dex, spot token, staking.

For the parameters these formulae take, see Numbers and limits; for the margin ratio in context, Portfolio margin.