Docs, The venue

How it works

Orders, prices, busts and payouts

Two-step orders

Every open and every close is a request followed by a fill.

StepInstructionSigned byPrice used
Requestrequest_open, request_closeThe traderNone
Fillexecute_open, execute_closeAnyone, usually the keeperThe first signed price for a second at or after request time + exec_delay_secs

The fill must carry exactly that update. The program rejects an update published before the target time (FillNotFirstAfterTarget) and one published more than fill_max_gap_secs after it (FillTooLate). Neither the trader nor the keeper can choose a convenient price, and a trader who sees a move on another exchange a second early cannot trade on it, because the price is taken from the future of the order.

Prices

Prices come from the venue's price signers. Every second each signer takes the mid quote (halfway between the best bid and the best ask) of BTC, ETH and SOL against the dollar on Coinbase, Kraken and Bitstamp, and the price of that second is the median of the venues that are live. One signer proposes it, the others sign it only if it matches their own reading within 3 basis points, and a price needs signatures from two of the three keys the admin registered with set_oracle_signers. Anyone holding a signed price posts it with post_price, which checks the ed25519 signatures byte for byte. Fills, liquidations and epoch closes then read the posted account and check its owner (OracleWrongOwner), the market's feed (OracleFeedMismatch), a positive price and an exchange spread no wider than max_conf_bps of the price. Each signer keeps a log of every agreed price with the quotes behind it.

Busts

A position busts when the price moves against it by one over its leverage, less the market's bust_buffer_bps. With the 5 bp buffer of the reference design:

LeverageMove that bustsOn BTC at $60,000
10x9.95%$5,970
100x0.95%$570
1000x0.05%$30

A bust is total. The whole margin goes to the pool, less the liquidator's reward. Anyone can call liquidate with a signed price for any second from the position's entry on (up to the exit time of a pending close); a position still above its bust price returns NotLiquidatable.

Wins

Small moves pay little on purpose. Moves under 0.2 bps of entry pay nothing. Above that, the profit is scaled by (1 - impact_base) x move / (move + knee) with the market's impact_base_bps and impact_knee_ppb, and then the win_fee_bps fee is taken. A tiny, fast win is the shape latency and selection edge take, and this curve makes it nearly worthless while leaving large moves close to whole.

The payout queue

Winners always get their margin back at once. If pool cash cannot cover the profit, the position becomes Queued and holds its claim. Claims are paid first in, first out by harvest as later losses add cash. While the queue is not empty, the pool pays no surplus to stakers and charges no loss fee.

Position states

StateMeaning
PendingOpenMargin escrowed, waiting for its fill
OpenFilled at entry_price
PendingCloseClose requested, waiting for its fill
QueuedClosed at a profit the pool has not finished paying
AwaitingMintClosed at a loss, waiting for its epoch to mint the venue token
NextEconomics