Entry price and PnL
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.
Only opening fills move your entry price
Section titled “Only opening fills move your entry price”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 shortopening fill: entry = (entry * old_size + px * fill_size) / (old_size + fill_size)closing fill: entry unchangedunrealised PnL = side * (mark_price - entry_price) * position_sizeclosed 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.
Spot uses the same formulas
Section titled “Spot uses the same formulas”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.
What PnL leaves out
Section titled “What PnL leaves out”- 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.
Rebuilding PnL from fills
Section titled “Rebuilding PnL from fills”| 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,startPositionandclosedPnlfrom 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.