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.
#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:
#Quickstart
- Enter the app — hit Enter App. No signup, no wallet signature, no risk.
- Load an account — paste any
0x…wallet address. Your paper account is seeded with 10,000 USDC. - 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).
- Open a position — choose Long or Short, set size and leverage, review entry / margin / est. liquidation / fee, execute.
- 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:
| Term | Meaning |
|---|---|
| V | The vault — every dollar that has actually entered the system (margin + fees). |
| C_tot | Total trader capital — the sum of everyone's deposited margin. Paid out first. |
| I | The insurance buffer — accumulated from trading and liquidation fees. |
| ΣPnL⁺ | The sum of all unrealized winning PnL — what winners would like to withdraw. Junior. |
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
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.
- It's a guarantee, not a penalty. H exists so that the statement "you can never withdraw more than exists" is always true — for everyone, simultaneously, at any instant.
- H recovers. As fees accrue, positions close, or the market normalizes, the residual refills and H returns to 100%.
- Fresh profit matures. New profit lands in a per-account reserve
Rand unlocks over a warm-up window (25 ticks) before it counts as withdrawable — so a one-tick wick can't be printed and instantly extracted.
#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:
| Index | What it accumulates |
|---|---|
| A | The 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. |
| K | The 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. |
| F | The 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:
- No ADL queue. Traditional exchanges rank winners and force-close the top of the queue at a price they didn't choose. GAMMA has no queue — deleveraging is a uniform, pro-rata index update.
- No admin discretion. There is no operator deciding who eats the loss. The math is the same for every account, every time.
- Snapshot accounting. Your position stores
(basis, A, K, F)at entry; settlement just diffs the current indices against your snapshot. That's why it stays O(1).
#Invariant 3 · bounded cranks
Marks move by crank — a permissionless tick that folds the newest oracle price into K. The crank is bounded:
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:
| State | Trigger | Behavior |
|---|---|---|
| Normal | A ≥ 0.25 | Business as usual — opens and closes allowed. |
| DrainOnly | A < 0.25 | The side is winding down: closes only, no new exposure. Shown as a badge in the market rail. |
| ResetPending → Normal | OI reaches 0 | Indices 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:
| Market | What it is | Oracle feed |
|---|---|---|
| SPY-PERP | S&P 500 ETF | Pyth · SPY/USD |
| GLD-PERP | Gold ETF | Pyth · GLD/USD |
| AAPL-PERP | Apple | Pyth · AAPL/USD |
| NVDA-PERP | NVIDIA | Pyth · NVDA/USD |
| TSLA-PERP | Tesla | Pyth · TSLA/USD |
| COIN-PERP | Coinbase | Pyth · COIN/USD |
| MSTR-PERP | Strategy | Pyth · MSTR/USD |
| META-PERP | Meta | Pyth · META/USD |
| GOOGL-PERP | Alphabet | Pyth · GOOGL/USD |
| HOOD-PERP | Robinhood — the stock itself | Pyth · 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.
- Margin — opening a position moves
size / leveragefrom your account into the position as collateral. - PnL — settled continuously from the K/F index deltas against your entry snapshot, marked to the live oracle.
- Maintenance margin —
0.50%of current notional. You are liquidatable whenmax(0, C + PnL) ≤ maintenance. - Liquidation — permissionless. The position is closed, a liquidation fee goes to insurance, the side's A shrinks, and any uninsured deficit socializes into the opposing K (see ADL).
- ADL badge — your positions table shows
ADL −x%when your side's A has shrunk: that's the fraction of your effective size that liquidations have already deleveraged, transparently.
#Fees & funding
| Fee | Rate | Where it goes |
|---|---|---|
| Trading fee | 0.06% of notional | Insurance buffer I → the residual that backs H |
| Liquidation fee | 0.50% of notional | Insurance buffer I |
| Funding | bilateral, periodic | Paid 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:
- At
H = 100%this is simply capital + PnL. - Below 100%, your capital and your losses are honored in full — only the profit leg scales. The stress banner and the gold H readout make this state impossible to miss.
- Fresh profit sits in the warm-up reserve
Rfor 25 ticks before it becomes withdrawable.
#The oracle
- Source — Pyth price feeds via Hermes (including the US-equity feeds), fetched every ~2.5 seconds per market; pinned deep-liquidity DEX pairs for Robinhood-native coins.
- Marking — each new price enters through the bounded crank (Invariant 3), which also acts as a bad-tick guard.
- Restart safety — after a redeploy, the first tick re-anchors price without marking, so downtime gaps can't print PnL out of thin air.
- Funding rate — model-based on the paper market (labeled as such in the UI); on-chain funding ships with the program.
#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).
| Endpoint | Method | Returns |
|---|---|---|
| /api/config | GET | Token, network, markets, leverage caps, maintenance bps, oracle status. |
| /api/markets | GET | All markets: price, 24h move, funding, OI, per-side A/mode. |
| /api/market/:sym | GET | One market: price history + full long/short side-state (A, K, F, OI, epoch, mode). |
| /api/metrics | GET | The balance sheet: V, I, C_tot, ΣPnL⁺, residual, haircut H, OI, leaderboard. |
| /api/account | POST | {wallet} → balances, positions with pnl / liq / withdraw(H) / adl. |
| /api/open | POST | {wallet, sym, side, size, lev} → opens a position, returns the fill. |
| /api/close | POST | {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
- $GAMMA is the governance and fee token of the GAMMA protocol.
- It is separate from trading collateral — the engine settles in USDC terms; $GAMMA never backs positions. It is also distinct from the HOOD stock market, which trades on the equity board like any other ticker.
- Planned utility: fee capture routing, listing governance (which markets/feeds get added), and insurance-buffer staking — finalized alongside the mainnet program.
- The contract address appears in the site header the moment it's live. Anything else claiming to be $GAMMA is fake.
#Trust & status — what's real today
| Layer | Status |
|---|---|
| Risk engine | Real & running — the full percolator port (H, A/K/F, bounded cranks, side recovery) settles every trade on this site. |
| Prices | Real — live Pyth oracle feeds, ~2.5s cadence. |
| Positions & USDC | Paper — simulated balances, no deposits, no custody, zero real-fund risk. |
| On-chain program | Built — the engine exists as a chain program (fixed-point, on-chain oracle, permissionless liquidation); on-chain deployment next. |
| Mainnet | Gated on audit — the reference engine is experimental and unaudited; we will not custody real funds before an audit. |
#Road to mainnet
| Phase | Scope | Status |
|---|---|---|
| P0 · Paper exchange | Full engine + terminal on live Pyth prices, paper-traded | LIVE |
| P1 · Program | The engine as an on-chain program: custody, on-chain oracle, permissionless crank & liquidation | Built — on-chain next |
| P2 · Hardening | Public program deployment, keeper network, $GAMMA fee routing | Next |
| P3 · Mainnet | Audited deployment, real collateral, an expanded curated board | Gated on audit |