Skip to content
TradePerpetuals9 pages
What a perpetual future isFoundationA perpetual future is a contract on an asset's price that never expires, kept close to that price by an hourly payment between longs and shorts.Contract specificationsPractitionerEvery Hyperliquid perp is a linear contract on 1 unit of its asset, defined by size decimals, maximum leverage, a margin table and a margin mode.FundingPractitionerFunding is an hourly payment between longs and shorts, set by how far the perp trades from the oracle price, that ties a contract with no expiry to its index.Margin: cross, isolated and margin tiersPractitionerMargin is the collateral behind a perp: initial margin to open, maintenance margin to stay open, shared in cross mode or ring-fenced in isolated mode.Leverage and liquidationPractitionerBelow maintenance margin, positions go to the order book as market orders; below two thirds of it, the liquidator vault takes them over.Auto-deleveragingExpertWhen an account goes below zero, auto-deleveraging closes the most profitable, most leveraged opposing positions at the previous mark price, leaving no bad debt.Hyperps and index perpetualsPractitionerHyperps fund against a moving average of their own mark price until spot trading exists; index perps track a formula the validators publish.AMM-priced perpetualsExpertSome perps price off a Uniswap V2 or V3 pool instead of exchange spot prices, and are isolated only, with margin locked in until the position closes.DelistingPractitionerWhen validators vote to delist a perp, positions settle at the 1-hour time-weighted oracle price before the vote and no new orders are accepted.

Entry price and PnL

Foundation

Entry price and PnL are display conventions computed from your fills; HyperCore itself margins cash and signed position size.

Your entry price is the one reference that says whether a position built from several fills is up or down. HyperCore doesn’t need it. The official docs call entry price, unrealised PnL and closed PnL conveniences over the real accounting, margin (balance, for spot) and trades. Their example: account value = cash + position value at mark = 13,009.454678 + 100.02765 = 13,109.482328 USDC.

A fill is opening if it increases the position’s absolute size (buying when long, selling when short), closing if it reduces it. PnL uses the mark price.

side = 1 for a long, -1 for a short
opening fill: entry = (entry * old_size + px * fill_size) / (old_size + fill_size)
closing fill: entry unchanged
unrealised PnL = side * (mark_price - entry_price) * position_size
closed PnL = fee + side * (mark_price - entry_price) * position_size (closing fill, as documented)

Say you buy twice, then sell half, with the mark at 120 throughout:

Step Fill Position Entry price Unrealised PnL Closed PnL, before fees
1 Buy 1 at 100 1 long 100 20 0
2 Buy 1 at 110 2 long 105 30 0
3 Sell 1 at 120 1 long 105 15 15

Selling half left the entry price at 105.

The documented position checks out: a 0.0335 ETH long at entry 2,986.3, position value 100.02765, implies mark 2,985.9, and (2985.9 - 2986.3) * 0.0335 = -0.0134 is its unrealizedPnl. Its returnOnEquity of -0.0026789 is -0.0134 / (2986.3 * 0.0335 / 20): unrealised PnL over entry notional divided by leverage.

Buys open, sells close, and transfers in and out count as buys and sells at the mark price. Genesis tokens get an entry price equal to a 10,000 USDC market cap; zero would be correct, the docs note, but makes return on equity undefined.

  • Funding is not in unrealised PnL: it is paid hourly against your balance and reported as cumulative funding (funding).
  • In cross, unrealised profit backs new positions, but withdrawing it is limited by the transfer requirement (margin).
  • Portfolio graphs sample every 15 minutes and on deposits and withdrawals, interpolating between; the docs say not for precise accounting. Max drawdown is display-only too, dividing each window’s PnL by the account value at that window’s start.
Where Fields
clearinghouseState position entryPx, szi (signed size), positionValue, unrealizedPnl, returnOnEquity, marginUsed, leverage (with rawUsd for isolated), cumFunding.allTime, sinceOpen, sinceChange
clearinghouseState summary marginSummary.accountValue, totalRawUsd, totalNtlPos, withdrawable
spotClearinghouseState balance total, hold, entryNtl (entry notional)
Fill px, sz, startPosition, dir, closedPnl, fee, feeToken

Rebuild PnL by replaying fills in time order from startPosition, deduplicating on tid, in decimal arithmetic (values are decimal strings), never binary floats.

Fees in closed PnL, flips and genesis tokens

Section titled “Fees in closed PnL, flips and genesis tokens”
  • A single fill taking a long through zero into a short is not documented; read dir, startPosition and closedPnl from the fill.
  • Spot balances held before entry tracking began took the price of their first trade or transfer after it.
  • Selling genesis tokens shows almost the whole sale as closed PnL, from the 10,000 USDC convention.

For what HyperCore actually keeps, see The clearinghouse. For where unrealised PnL counts as margin, see Margin.