Skip to content
UNHEDGED / DOCS

Search documentation

Browse docs or start typing to find a topic

↑ ↓ to navigate Enter to open Esc to close

Order-book basics

Trade binary or multi-outcome markets on a central limit order book. Prices are quoted in USD per share, between 0 and 1. A price of 0.59 USD represents a 59% implied probability.

Crypto order books use a 20 ms maker-protection window for every account, including market makers, before incoming taking-capable orders or replacements can execute. Typed validation runs during this window. Read maker_protection_ms from the gateway's list_markets or new_market metadata for the configured window. A batch waits as one instruction if any leg can take. Matching checks current prices and funds after the wait; the API returns the final result.

Crypto markets with priceMethod: "twap-60s-v1" settle from two 60-second time-weighted average prices. Each reference averages 60 one-second closing prices in the minute before its boundary; the boundary itself is excluded. BTC, ETH, and SOL use Binance one-second candles. CC uses Bybit trades sampled once per second. Up wins when the final ending TWAP is greater than the final starting TWAP; equal or lower resolves Down. Range markets have fixed dollar bands and are listed after the starting TWAP is final.

Up/Down markets are listed five minutes before the start with a pending starting price. References can be provisional after their boundary and target finalization 10 seconds later. Missing source data can delay finalization. The market response's priceReferences contains each reference's status, exact price, source, time window, and samples. Use windowStartTime for the nominal market start. Markets without this price method retain their one-minute candle open settlement rule.

Other accounts' post-only quotes and cancels can run during the window. Your later mutations in the same market, including cancels, follow your pending orders. New stop-loss and take-profit registrations wait; already-armed conditions keep their existing activation rule. The window is a minimum age, not a maximum response time.

Find a market

Choose a market from the feed with marketType set to ORDER_BOOK and status set to ACTIVE.

Choose a side

bid buys an outcome; ask sells it. In binary markets, selling YES at p is economically equivalent to buying NO at 1 − p.

Prices & quantities

REST prices & budgets
Prices, trigger prices, and budgets are denominated in USD and use strings with exactly 2 decimal places, e.g. "0.59" means 0.59 USD.
Share quantities
Strings with 0–2 decimals; minimum "0.01". Positive integers mean whole contracts: 100 = "100.00". Fractions require strings; responses use decimal strings.
Price bounds
Limit and trigger prices: (0, 1), endpoints excluded. Optional Market price bounds: [0, 1], endpoints included.
Invalid decimals
Errors return code, field, and received.

Fees

Schedule
Set engineMarketType on creation: default (default) or sports_vip. The API returns feeSchedule tiers from market_fee_type. platformFeeRate and per-market maker/taker fields do not apply.
Per fill
Orders expose cum_fees and last_trade_fee.
Fee reserve
locked_fees uses the snapshotted maker_fee_rate, order price, and remaining quantity with the risk-shaped curve.

Settlement & balance lock

  1. Place: maximum cost moves from balance.available to balance.lockedEngine, visible immediately in GET /balance.
  2. Fill: the matched portion is debited from lockedEngine; a position contract is created on the Canton ledger.
  3. Cancel: unfilled funds return to available.

Matching is real-time off-chain; settlement is atomic on-chain in batches.

Client order IDs are not retry receipts

After a timeout, the outcome is unknown. Check every page of open orders (follow nextCursor) and trade history. If still unresolved, stop. Reusing the same client ID or choosing a new one can duplicate a fill.

Client order IDs
Optional clientOrderId on place and clientOrderIds on cancel identify open orders; order objects use client_order_id. An alias is unique among open orders for one balance and market, across outcomes and API keys. It can be reused after close. Trade history has numeric order IDs only.
Direct Order Gateway
Omit Idempotency-Key on order mutations and trading-session calls to order-gateway.unhedged.gg. The gateway rejects the header with HTTP 400 (IDEMPOTENCY_NOT_SUPPORTED). The TypeScript SDK and MCP omit it on order requests.
General REST API
On api.unhedged.gg, a keyed order placement or replacement can replay its original response for up to 60 seconds. Use the same account, method, URL, JSON body, and key. A matching request still in flight returns 503 with Retry-After. Reusing the key with a different body during that window returns 409. DELETE cancellations have no replay.
Batch results
A committed batch can return HTTP 400. Check each results entry before resubmitting a leg. Successful legs may already have filled or may still be open.