GAMMA
LIVE MARKETS OPEN INTEREST RESIDUAL HAIRCUT H ORACLE PYTH · LIVE
gamma / docs

GAMMA Documentation

Everything inside a perpetual-futures DEX that is structurally incapable of insolvency — the balance sheet, the three invariants, the trading mechanics, and the honest line between what runs today and what ships after audit.

ROBINHOOD CHAINPERCOLATOR ENGINEREAL PYTH PRICESPAPER-TRADED · NO CUSTODY

#What is GAMMA

GAMMA is a perpetual-futures DEX on Robinhood Chain. Long and short tokenized stocks and Robinhood-native coins — up to 25× — on one pixel-perfect perp DEX. What makes GAMMA different is not the trading — it's the settlement layer underneath it.

Most perp exchanges are one bad wick away from a hole in the balance sheet: winners are owed money the exchange doesn't have, and the fix is an ADL queue that picks victims, an "insurance fund" black box, or a socialized-loss email. GAMMA ports the percolator risk-engine architecture (originally authored by Anatoly Yakovenko), which makes that entire failure class unrepresentable:

01
Backed exits — the haircut HDeposits stand ahead of profit in the payout order. Nobody can ever withdraw more than actually exists on the balance sheet.
02
Queue-free ADL — A/K/F indicesWhen a liquidation leaves a hole, the loss socializes pro-rata across the winning side in O(1). No victim queue, no single trader punished.
03
Bounded cranksRepricing is capped per tick, so an oracle wick can never move open interest through more loss than the exchange budgeted for.
GAMMA today runs the full engine against real, live Pyth oracle prices — but positions and USDC are paper-traded. There is no custody of real funds. The on-chain program exists; live custody is gated on audit. See Trust & status.

#Quickstart

  1. Enter the app — hit Enter App. No signup, no wallet signature, no risk.
  2. Load an account — paste any 0x… wallet address. Your paper account is seeded with 10,000 USDC.
  3. Pick a market — the 10-equity Pyth board (SPY, GLD, AAPL, NVDA, TSLA, COIN, MSTR, META, GOOGL, HOOD) plus every auto-discovered Robinhood-native coin, each marked to a real oracle price (Pyth equity feeds for the stocks, pinned DEX pairs for Robinhood-native tokens).
  4. Open a position — choose Long or Short, set size and leverage, review entry / margin / est. liquidation / fee, execute.
  5. Manage it — watch live PnL, ROE, your liquidation price, your ADL index, and your haircut-adjusted withdrawable value. Close whenever.
tip — the Solvency Engine panel at the bottom of the terminal shows the live balance
sheet: vault V, capital C, insurance I, residual, and the haircut H. Everything in the
docs below is visible there, live, while you trade.

#The engine — structural solvency

Every account and every market settles against one global balance sheet:

TermMeaning
VThe vault — every dollar that has actually entered the system (margin + fees).
C_totTotal trader capital — the sum of everyone's deposited margin. Paid out first.
IThe insurance buffer — accumulated from trading and liquidation fees.
ΣPnL⁺The sum of all unrealized winning PnL — what winners would like to withdraw. Junior.
Residual = V − (C_tot + I)the only money that can ever pay out profit — what exists beyond returning everyone's capital and the insurance buffer

The entire design follows from one rule: profit can only be paid out of the residual. Deposits always stand ahead of profit. If the residual can't cover every open winner at once, winners are paid at a discount — the haircut — rather than the exchange writing a check it can't cash.

#Invariant 1 · the haircut H

H = clamp( min(Residual, ΣPnL⁺) / ΣPnL⁺ , 0 … 1 )the fraction of open profit the balance sheet can honor right now

When the system is healthy, H = 100% and profits are fully backed — withdrawing a winner pays out in full. If a violent move creates more paper profit than residual (the exact scenario that bankrupts normal exchanges), H drops below 1 and every winner's withdrawable profit scales by H. Losers and capital are untouched.

withdrawable = C + min(0, PnL) + max(0, PnL) · Hyour capital, minus your losses in full, plus your profits at the haircut rate
The terminal shows H at all times, and your positions table has a dedicated Withdraw (H) column — you always see exactly what you could take out right now.

#Invariant 2 · queue-free ADL (A / K / F)

Every market keeps two side-states — one for longs, one for shorts. Each side carries three lazy indices, updated in O(1) per event no matter how many accounts exist:

IndexWhat it accumulates
AThe deleverage factor — starts at 1. When a liquidation shrinks a side, A shrinks proportionally (A ×= OI_after / OI_before). Your effective position is basis × A / A_entry.
KThe mark index — price moves fold in as K += A × ΔP. Your PnL is read from the delta between K now and K at your entry snapshot.
FThe funding index — periodic funding accrues as F ±= A × rate, netted between sides the same lazy way.

When a liquidated account leaves a deficit the insurance buffer can't absorb, the loss socializes into the opposing side's K index — spread pro-rata across every winner on that side:

K_opposing += −Deficit / OI_opposingeveryone on the winning side absorbs a sliver; nobody gets singled out

#Invariant 3 · bounded cranks

Marks move by crank — a permissionless tick that folds the newest oracle price into K. The crank is bounded:

|ΔP| ≤ MAX_MOVE × P_last per ticka single update can never reprice the book by more than the budgeted step

A flash wick on the oracle therefore can't teleport the mark through a canyon of liquidations in one step — the price walks there tick by tick, each tick settling PnL, liquidations and funding inside a bounded loss budget. Combined with H, this is what makes the worst case slow and solvent instead of instant and bankrupt. It also doubles as a bad-tick guard against oracle glitches.

#Side recovery

If cascading liquidations grind one side's A factor down, that side walks a state machine instead of dying:

StateTriggerBehavior
NormalA ≥ 0.25Business as usual — opens and closes allowed.
DrainOnlyA < 0.25The side is winding down: closes only, no new exposure. Shown as a badge in the market rail.
ResetPending → NormalOI reaches 0Indices snapshot, the epoch increments, A resets to 1, and the side reopens fresh. Stale positions from the old epoch settle at their snapshot.

#Markets & leverage

The fixed board is 10 US equities on live Pyth stock feeds:

MarketWhat it isOracle feed
SPY-PERPS&P 500 ETFPyth · SPY/USD
GLD-PERPGold ETFPyth · GLD/USD
AAPL-PERPApplePyth · AAPL/USD
NVDA-PERPNVIDIAPyth · NVDA/USD
TSLA-PERPTeslaPyth · TSLA/USD
COIN-PERPCoinbasePyth · COIN/USD
MSTR-PERPStrategyPyth · MSTR/USD
META-PERPMetaPyth · META/USD
GOOGL-PERPAlphabetPyth · GOOGL/USD
HOOD-PERPRobinhood — the stock itselfPyth · HOOD/USD

The native board — curated

Alongside the equity board, GAMMA lists a curated pair of Robinhood-native coins: CASHCAT and PONS. Each marks to a pinned, deep-liquidity DEX pair (a fixed pool address, not a token search — so a thin copycat pool can never become the price), and natives carry tighter max leverage than equities to reflect their oracle thinness.

Why only two? Because a perp market is only as honest as its price. A thin pool can be pushed around cheaply, and a pushable pool is a pushable oracle. CASHCAT (~$5.6M pool) and PONS (~$1M pool) clear that bar today; the board grows as other pools earn their depth — by listing decision, not by an open faucet.

#Positions, PnL & liquidation

Positions are isolated sub-accounts: each carries its own collateral C, entry snapshot, and liquidation price. One position blowing up never touches your others.

#Fees & funding

FeeRateWhere it goes
Trading fee0.06% of notionalInsurance buffer I → the residual that backs H
Liquidation fee0.50% of notionalInsurance buffer I
Fundingbilateral, periodicPaid between sides via the F index — only accrues when both sides have open interest

There is no fee switch pointed at a team wallet in the engine: fees exist to keep the balance sheet solvent. Fee capture for $GAMMA is a protocol-layer decision that ships with mainnet.

#Withdrawals & H

Your withdrawable balance is always computed under the haircut:

withdraw = C + min(0, PnL) + max(0, PnL) · H

#The oracle

#API reference

The exchange exposes a public read/write JSON API — the same one the terminal uses. Base URL: the same origin as this site (all paths below are relative).

EndpointMethodReturns
/api/configGETToken, network, markets, leverage caps, maintenance bps, oracle status.
/api/marketsGETAll markets: price, 24h move, funding, OI, per-side A/mode.
/api/market/:symGETOne market: price history + full long/short side-state (A, K, F, OI, epoch, mode).
/api/metricsGETThe balance sheet: V, I, C_tot, ΣPnL⁺, residual, haircut H, OI, leaderboard.
/api/accountPOST{wallet} → balances, positions with pnl / liq / withdraw(H) / adl.
/api/openPOST{wallet, sym, side, size, lev} → opens a position, returns the fill.
/api/closePOST{wallet, id} → closes a position, settles PnL under H.
# watch the balance sheet live (against this site's origin)
curl -s /api/metrics | jq '{residual, haircut, oi}'

# open a paper long: 2,500 USDC at 10× on TSLA
curl -s -X POST /api/open \
  -H 'content-type: application/json' \
  -d '{"wallet":"0xYourAddress","sym":"TSLA","side":"long","size":2500,"lev":10}'

#$GAMMA token

#Trust & status — what's real today

LayerStatus
Risk engineReal & running — the full percolator port (H, A/K/F, bounded cranks, side recovery) settles every trade on this site.
PricesReal — live Pyth oracle feeds, ~2.5s cadence.
Positions & USDCPaper — simulated balances, no deposits, no custody, zero real-fund risk.
On-chain programBuilt — the engine exists as a chain program (fixed-point, on-chain oracle, permissionless liquidation); on-chain deployment next.
MainnetGated on audit — the reference engine is experimental and unaudited; we will not custody real funds before an audit.
Perpetual futures with leverage are extremely high-risk instruments — positions can liquidate to zero. GAMMA is deliberately paper-traded today so you can learn the engine with none of that risk. Nothing on this site is financial advice.

#Road to mainnet

PhaseScopeStatus
P0 · Paper exchangeFull engine + terminal on live Pyth prices, paper-tradedLIVE
P1 · ProgramThe engine as an on-chain program: custody, on-chain oracle, permissionless crank & liquidationBuilt — on-chain next
P2 · HardeningPublic program deployment, keeper network, $GAMMA fee routingNext
P3 · MainnetAudited deployment, real collateral, an expanded curated boardGated on audit

Enter the app →  Read the FAQ