documentation

API Reference

REST and WebSocket reference for https://api.arizal.xyz/v1. All endpoints use JSON unless noted, and all paths below are relative to /v1.

Schema, rate limits & price units OpenAPI spec: GET /v1/openapi.yaml. HTTP is rate-limited per client IP (default 10,000 req / 60s; configured via http_rate_limit_per_min in clearbook.toml, 0 = off; 429 + Retry-After when exceeded; GET /health and upgraded WebSocket frames are exempt; IP taken from first X-Forwarded-For, else X-Real-IP, else TCP peer). Order price and book levels use decicents (600 = 60.0¢; a cross occurs at p + q >= 1000).

Sign in

Your orders, TP/SL and stops are private. Reading them needs a session for your wallet, opened with Sign-In with Ethereum: the node writes a readable sign-in message, your wallet signs it (no transaction, no gas), and you get a bearer token valid for 7 days.

POST /auth/challenge

Get the message to sign. Valid 5 minutes, single use.

{ "trader": "0x…", "domain": "app.arizal.xyz", "uri": "https://app.arizal.xyz" }

Response

{
  "message": "app.arizal.xyz wants you to sign in with your Ethereum account:\n0x5D17…\n\nSign in to Arizal to view your open orders, order history and TP/SL. This does not send a transaction, cost gas, or approve any trade.\n\nURI: https://app.arizal.xyz\nVersion: 1\nChain ID: 31337\nNonce: 4fJ2kq9XbLm0aT7cZ\nIssued At: 2026-11-15T12:00:00Z\nExpiration Time: 2026-11-22T12:00:00Z",
  "trader": "0x5d17…",
  "expires_at": 1794744300
}

POST /auth/login

personal_sign the exact message, then exchange it for a session.

{ "message": "…exact text…", "signature": "0x…" }

Response

{ "token": "…", "trader": "0x5d17…", "expires_at": 1795347000 }

Send Authorization: Bearer <token> on GET /ledger/orders, GET /exits and GET /orders/:id, and token on the WebSocket wallet subscribe. A session only unlocks its own wallet (401 without one, 403 for another wallet). GET /auth/session returns { trader, expires_at }; POST /auth/logout ends it. Contract (EIP-1271) wallets are not supported yet.

Meta

GET /health

Liveness probe.

Parameters

None.

Response

ok

GET /version

Node / engine identity.

Parameters

None.

Response

{
  "git_sha": "dev",
  "version": "0.1.0"
}

GET /config

Chain addresses, EIP-712 domain, fees, TIFs. assets.<id>.sigma is live annualized volatility from Binance daily klines (GARCH(1,1) × √365; weekday = Mon–Fri UTC, weekend = Sat–Sun UTC, all = every day) — same calculation as polybot-react. Omitted until the first successful fetch after boot; refreshed about once an hour.

Parameters

None.

Response

{
  "chain_id": 31337,
  "exchange": "0x…",
  "usdc": "0x…",
  "resolution_source": "mock",
  "resolution_feed": "0x…",
  "resolution_feeds": { "BTC": "0x…", "ETH": "0x…" },
  "size_decimals": 6,
  "size_unit": 1000000,
  "eip712": { "name": "Arizal", "version": "1" },
  "gtd_min_secs": 60,
  "tif": ["GTC", "GTD", "FOK", "FAK"],
  "trading_fee_factor": "40000000000000000",
  "gas_fee": 50000,
  "min_order_shares": "5",
  "min_order_value": 1000000,
  "assets": {
    "btc": {
      "price_decimals": 0,
      "sigma": { "weekday": 0.48, "weekend": 0.36, "all": 0.45 }
    }
  }
}

GET /openapi.yaml

OpenAPI 3 YAML (content-type application/yaml).

Parameters

None.

Response

openapi: 3.0.3
info:
  title: Clearbook API
  version: "1"
# …

Markets

GET /markets

All markets from memory (not PostgreSQL).

Parameters

None.

Response

[
  {
    "id": "btc-hit-80000-up-daily-…",
    "kind": "Hit",
    "status": "Open",
    "barrier": "80000",
    "expires_at": 1735689600,
    "best_yes_bid": 450,
    "best_yes_ask": 550,
    "last_yes_price": 500
  }
]

GET /markets/:id

One market.

Parameters

NameInRequiredDescription
idpathyesMarket id

Response

{
  "id": "btc-hit-80000-up-daily-…",
  "kind": "Hit",
  "status": "Open",
  "barrier": "80000",
  "expires_at": 1735689600,
  "last_yes_price": 500
}

GET /markets/:id/book

Aggregated Yes / No depth.

Parameters

NameInRequiredDescription
idpathyesMarket id

Response

{
  "market_id": "btc-hit-80000-up-daily-…",
  "status": "Open",
  "bids_yes": [[450, "10.0"], [400, "5.0"]],
  "bids_no": [[500, "8.0"]],
  "seq": 42
}

GET /markets/:id/tape

Engine log for that market.

Parameters

NameInRequiredDescription
idpathyesMarket id
cursorquerynoReturn events with seq > cursor
limitquerynoMax events (default 100)

Response

[
  { "seq": 10, "ts": 1735689000, "kind": "Accepted", "order_id": 1, "market_id": "…" }
]

GET /markets/:id/chart

Yes mid OHLC candles (¢) plus fair close line for this market id. Native bars are 5m; coarser tf folds from those. current / current_fair are live tips.

Parameters

NameInRequiredDescription
idpathyesMarket id
tfqueryno5m, 15m, 1h, or 1d

Response

{
  "market_id": "btc-hit-80000-up-daily-…",
  "start_ts": 1735600000,
  "end_ts": 1735689600,
  "now_ts": 1735689000,
  "status": "Open",
  "current": "52.5",
  "current_fair": "48.1",
  "source": "BOOK_MID",
  "points": [{
    "ts": 1735688400,
    "open": "50.0",
    "high": "52.5",
    "low": "49.5",
    "close": "51.0",
    "price": "51.0"
  }],
  "fair": [{ "ts": 1735688400, "price": "48.1" }]
}

GET /markets/:id/holders

Yes / No holders from the positions mirror.

Parameters

NameInRequiredDescription
idpathyesMarket id

Response

{
  "market_id": "btc-hit-80000-up-daily-…",
  "yes": [{ "trader": "0x…", "shares": "10.0", "usdc_staked": 5000000 }],
  "no": [{ "trader": "0x…", "shares": "5.0", "usdc_staked": 2500000 }]
}

GET /trades

Recent in-memory fills (not PostgreSQL).

Parameters

NameInRequiredDescription
marketquerynoFilter by market id

Response

[
  {
    "fill_id": 12,
    "market_id": "btc-hit-80000-up-daily-…",
    "yes_price": 550,
    "size": "2.0",
    "taker_side": "Yes",
    "confirmed": false
  }
]

GET /price

Latest price of an asset (?asset=BTC default, or ETH) — the latest round of its Chainlink Data Feed, which its markets resolve on (ts = its update time) — and the barrier of its first open market. WS price frames carry the same fields with asset, one per asset.

Parameters

None.

Response

{
  "price": "97500.12",
  "ts": 1735689000,
  "barrier": "97000",
  "source": "chainlink"
}

Orders

GET /orders/:id

One of your open orders. Needs sign-in (Authorization: Bearer); other wallets’ orders return 404.

Parameters

NameInRequiredDescription
idpathyesOrder id

Response

{
  "id": 7,
  "status": "Resting",
  "remaining": "3.0",
  "order": { "trader": "0x…", "market_id": "…", "side": "Yes", "price": 600, "size": 5 }
}

POST /orders

All order types on one path. Immediate limit / market / post only / close, position TP/SL, and standalone stop market / stop limit. Optional agent_auth for 1-click.

Body (immediate)

{
  "order": {
    "trader": "0x…",
    "market_id": "btc-hit-80000-up-daily-…",
    "asset": "BTC",
    "kind": "hit",
    "direction": "up",
    "barrier_e8": 8000000000000,
    "barrier_high_e8": 0,
    "market_start": 1794897118,
    "market_expiry": 1795064400,
    "side": "Yes",
    "action": "Buy",
    "price": 600,
    "size": 2000000,
    "order_type": "Limit",
    "tif": "GTC",
    "nonce": 1,
    "salt": 99,
    "expires_at": 0,
    "gas_fee": 50000,
    "chain_id": 31337,
    "verifying_contract": "0x…"
  },
  "signature": "0x…",
  "agent_auth": null,
  "close": false,
  "exits": null
}

Body (position TP/SL only)

{
  "exits": {
    "trader": "0x…",
    "market_id": "btc-hit-80000-up-daily-…",
    "side": "Yes",
    "trigger": "mid",
    "take_profit": {
      "trigger_price": 700,
      "order": { "…": "SignedOrder close, price=0 or limit, tif=FAK" },
      "signature": "0x…"
    },
    "stop_loss": {
      "trigger_price": 400,
      "order": { "…": "SignedOrder close, price=0 or limit, tif=FAK" },
      "signature": "0x…"
    }
  }
}

Body (stop limit buy)

{
  "order": { "…": "SignedOrder buy, price=650, tif=GTC" },
  "signature": "0x…",
  "close": false,
  "condition": {
    "trigger": "mid",
    "trigger_price": 600,
    "when": "above"
  }
}

Body (stop market sell)

{
  "order": { "…": "SignedOrder sell, price=0, tif=FAK" },
  "signature": "0x…",
  "close": true,
  "condition": {
    "trigger": "mid",
    "trigger_price": 350,
    "when": "below"
  }
}

Response (immediate)

{
  "order_id": 7,
  "fills": [12],
  "status": "Resting",
  "remaining": 1000000,
  "reason": null
}

Response (TP/SL)

{
  "trader": "0x…",
  "market_id": "…",
  "side": "Yes",
  "trigger": "mid",
  "take_profit": { "trigger_price": 700, "size": "5.0", "order": { "…" } },
  "stop_loss": { "trigger_price": 400, "size": "5.0", "order": { "…" } }
}

Response (stop)

{
  "ok": true,
  "conditional": "stop",
  "stop": {
    "kind": "stop",
    "id": "ab12…",
    "trader": "0x…",
    "market_id": "…",
    "side": "Yes",
    "trigger": "mid",
    "when": "above",
    "close": false,
    "trigger_price": 600,
    "size": "5.0",
    "order": { "…" }
  }
}

DELETE /orders/:id

Cancel one order (EIP-712 Cancel). Signer may be trader or session agent.

Parameters

NameInRequiredDescription
idpathyesOrder id

Body

{
  "cancel": {
    "order_id": 7,
    "trader": "0x…",
    "market_id": "btc-hit-80000-up-daily-…",
    "nonce": 2
  },
  "signature": "0x…",
  "agent_auth": null
}

Response

{
  "ok": true,
  "order_id": 7,
  "status": "Cancelled"
}

POST /orders/replace

Atomic cancel + place. Same market/side/remaining size; new price required.

Body

{
  "cancel": {
    "order_id": 7,
    "trader": "0x…",
    "market_id": "…",
    "nonce": 3,
    "signature": "0x…"
  },
  "order": { "…": "SignedOrder fields" },
  "signature": "0x…",
  "agent_auth": null
}

Response

{
  "cancelled": 7,
  "order_id": 8,
  "fills": [],
  "status": "Resting",
  "remaining": 2000000
}

POST /orders/cancel-all

EIP-712 CancelAll. Omit market_id (or empty) to cancel every open order for the trader.

Body

{
  "trader": "0x…",
  "market_id": null,
  "nonce": 10,
  "signature": "0x…",
  "agent_auth": null
}

Response

{
  "ok": true,
  "count": 3,
  "errors": []
}

POST /batch

FIFO cancels and places (ops, or cancels then orders). Cap ~64 ops.

Body

{
  "ops": [
    { "cancel": { "order_id": 1, "trader": "0x…", "market_id": "…", "nonce": 1, "signature": "0x…" } },
    { "order": { "…": "SignedOrder" }, "signature": "0x…" }
  ]
}

Response

{
  "results": [
    { "ok": true, "order_id": 1 },
    { "order_id": 9, "fills": [], "status": "Resting", "remaining": 1000000 }
  ]
}

Account

GET /account

Balances, profile, open orders. Optional market for Yes/No share snapshot. open_orders and email need Authorization: Bearer with a sign-in session for this wallet; without a token you get the public view (no orders), and a token that is expired or for another wallet is 401 (sign in again). 503 means the engine was busy — retry.

Parameters

NameInRequiredDescription
traderqueryyesWallet address
marketquerynoMarket id for share fields

Response

{
  "trader": "0x…",
  "collateral": 100000000,
  "reserved": 5000000,
  "available": 95000000,
  "volume_30d": 2500000,
  "taker_coeff": 0.04,
  "nickname": "alice",
  "email": "a@example.com",
  "email_verified": true,
  "referrer": "0x…",
  "referred_taker_volume": 0,
  "referred_maker_volume": 0,
  "referred_taker_fees": 0,
  "yes_shares": "0",
  "no_shares": "0",
  "eth_wei": "10000000000000000000",
  "usdc_unit": 1000000,
  "open_orders": []
}

POST /account/nickname

Set nickname via EIP-191 personal_sign of a human-readable Arizal Set Nickname message. Stored per wallet (not exchange/network); unique globally.

Body

{
  "trader": "0x…",
  "nickname": "alice",
  "nonce": 1735689000123,
  "signature": "0x…"
}

Response

{
  "ok": true,
  "trader": "0x…",
  "nickname": "alice"
}

POST /account/email

Set email (unverified) via personal_sign Arizal Set Email. Stored per wallet (not exchange/network). With Resend configured, emails the code and omits verification_code.

Body

{
  "trader": "0x…",
  "email": "a@example.com",
  "nonce": 1735689000456,
  "signature": "0x…"
}

Response

{
  "ok": true,
  "trader": "0x…",
  "email": "a@example.com",
  "email_verified": false,
  "email_sent": true,
  "code_expires_at": 1735689900,
  "resend_after": 1735689060
}

POST /account/email/resend

New code for pending email. Signed Arizal Resend Email Code. Rate limited to 1 / 60s per trader (429).

Body

{
  "trader": "0x…",
  "nonce": 1735689060123,
  "signature": "0x…"
}

Response

{
  "ok": true,
  "trader": "0x…",
  "email": "a@example.com",
  "email_verified": false,
  "email_sent": true,
  "code_expires_at": 1735689960,
  "resend_after": 1735689120
}

POST /account/email/verify

Mark email verified with the 6-digit code.

Body

{
  "trader": "0x…",
  "code": "123456"
}

Response

{
  "ok": true,
  "trader": "0x…",
  "email": "a@example.com",
  "email_verified": true
}

POST /account/referrer

Set referrer once if unset. First write wins.

Body

{
  "trader": "0xAlice…",
  "referrer": "0xBob…"
}

Response

{
  "ok": true,
  "trader": "0xAlice…",
  "referrer": "0xbob…",
  "newly_set": true
}

GET /account/referrals

Wallets that set this address as referrer, with per-wallet and total weighted volume / taker fees.

Parameters

NameInRequiredDescription
traderqueryyesReferrer wallet

Response

{
  "trader": "0xBob…",
  "referrals": [
    {
      "trader": "0xalice…",
      "taker_volume": 2400000,
      "maker_volume": 1000000,
      "taker_fees": 42000
    }
  ],
  "referred_taker_volume": 2400000,
  "referred_maker_volume": 1000000,
  "referred_taker_fees": 42000
}

Leaderboard

GET /leaderboard

Public. Wallets ranked by PnL (realized + unrealized of open positions) over a range, from the node's hourly PnL snapshots — figures are up to an hour old.

Parameters

NameInRequiredDescription
rangequeryno1d · 1w (default) · 1m · 1y · ytd · all
limitquerynoRows, 1–500 (default 100)

Response

{
  "range": "1w",
  "since": 1794200000,
  "as_of": 1794830400,
  "rows": [
    { "rank": 1, "trader": "0x5d17…", "nickname": "alice", "pnl": 2400000, "realized": 2000000, "unrealized": 400000, "positions": 3, "as_of": 1794830400 }
  ]
}

Amounts are USDC base units (6 decimals). pnl = (realized + unrealized) at the wallet's newest snapshot minus the same at its newest snapshot at or before the start of the range (0 if none); realized is the change over the range; unrealized is open positions at as_of. A wallet is snapshotted every hour while it holds shares, and once more when it goes flat with a changed realized PnL.

Ledger

GET /ledger/orders

Open (or scope=closed) orders for your wallet. Needs sign-in (Authorization: Bearer).

Parameters

NameInRequiredDescription
traderqueryyesWallet address

Response

[
  {
    "id": 7,
    "market_id": "…",
    "side": "Yes",
    "price": 600,
    "size": "5.0",
    "remaining": "3.0",
    "status": "Resting",
    "tif": "GTC",
    "expires_at": 0,
    "origin": null,
    "condition": null
  }
]

origin / condition say what released an order that was not placed directly: origin is take_profit or stop_loss (a fired position TP/SL leg, shown as Sell (TP) / Sell (SL)) or stop_market / stop_limit (a standalone stop), and condition is { "trigger": "mid" | "fair", "when": "above" | "below", "trigger_price": 950 } (decicents of the order's side). Both are null for ordinary orders.

GET /ledger/history

Wallet fills / split / merge / redeem newest first.

Parameters

NameInRequiredDescription
traderqueryyesWallet address

Response

[
  {
    "fill_id": 12,
    "market_id": "…",
    "side": "Yes",
    "op": "trade",
    "price": 550,
    "size": "2.0",
    "fee": 15000,
    "status": "confirmed",
    "ts": 1735689000
  }
]

GET /ledger/positions

Holdings (active markets + unredeemed winning resolved sides).

Parameters

NameInRequiredDescription
traderqueryyesWallet address

Response

[
  {
    "market_id": "…",
    "side": "Yes",
    "shares": "10.0",
    "usdc_staked": 5500000
  }
]

GET /ledger/funds

Deposits and withdrawals.

Parameters

NameInRequiredDescription
traderqueryyesWallet address

Response

[
  {
    "op": "deposit",
    "amount": "100000000",
    "tx_hash": "0x…",
    "status": "confirmed",
    "ts": 1735688000
  }
]

POST /ledger/pending

Note a wallet tx as pending until the chain log is indexed.

Body

{
  "trader": "0x…",
  "op": "deposit",
  "amount": "100000000",
  "tx_hash": "0x…",
  "market_id": null
}

Response

{
  "ok": true,
  "status": "pending"
}

Announcements

GET /announcements

Newest product announcements. Optional trader adds unread count vs wallet_profiles.last_visit_at.

Parameters

NameInRequiredDescription
limitquerynoMax rows (default 50, max 100)
traderquerynoWallet for unread / last_visit_at

Response

{
  "announcements": [
    { "id": 1, "title": "…", "body": "…", "created_at": 1735688000 }
  ],
  "unread": 0,
  "last_visit_at": 0
}

POST /announcements

Create an announcement. Broadcasts { channel: "announcements", op: "new", announcement } on the websocket.

Body

{ "title": "Welcome", "body": "Trading is live." }

DELETE /announcements/{id}

Delete an announcement. Broadcasts { channel: "announcements", op: "deleted", id } on the websocket.

POST /announcements/visit

Wallet login: returns up to 3 announcements newer than the prior visit, stamps last_visit_at, and pushes the same set on WS op: "missed".

Body

{ "trader": "0x…" }

Faucet (testnets)

POST /faucet

Gas ETH + 1,000 mock USDC to the wallet (not the exchange). ETH is 10 on the local chain and 0.001 on Arbitrum Sepolia, and is skipped when the wallet already holds that much (eth_tx_hash is then null, amount_eth "0").

Body

{ "address": "0x…" }

Response

{
  "address": "0x…",
  "eth_tx_hash": "0x…",
  "usdc_tx_hash": "0x…",
  "amount_eth": "0.001",
  "amount_usdc": "1000"
}

POST /faucet/gas

Gas ETH only (same amount and skip rule).

Body

{ "address": "0x…" }

Response

{
  "address": "0x…",
  "tx_hash": "0x…",
  "amount_eth": "0.001"
}

POST /faucet/usdc

1,000 mock USDC only.

Body

{ "address": "0x…" }

Response

{
  "address": "0x…",
  "tx_hash": "0x…",
  "amount": "1000000000"
}

WebSocket

WS /ws

Connect to wss://api.arizal.xyz/v1/ws. Text frames are JSON. After connect the node fans out every public broadcast to all sockets; subscribe only requests an immediate snapshot for that channel; filter by market on the client. Wallet-private frames are sent only to sockets subscribed to that wallet (see wallet below).

Client → server

{
  "op": "subscribe",
  "channel": "book",
  "market": "btc-hit-80000-up-daily-…"
}

op: "subscribe" is handled for every channel, and op: "unsubscribe" for wallet. market is required for book, tape, trades, and resolved; trader for wallet. Other frames are ignored.

Subscribe channels

ChannelmarketImmediate reply
confignoconfig (same as on-connect)
marketsnomarkets
pricenoprice
bookyesbook (+ quote)
tapeyestape_snapshot
tradesyestrades_snapshot
resolvedyesresolved
wallet + trader + tokenno{ channel: "wallet", op, trader, ok, error }; with a sign-in token for that wallet, this socket gets an orders snapshot at once and then receives its orders deltas, ledger, ledger_delta, account, exits and wallet announcements frames (up to 8 wallets per socket)

Push-only channels (no subscribe)

market, last_yes, quote, holders, announcements (new / deleted), live tape / trades / book / config refreshes.

config

Sent on connect, on subscribe config, about about once a second into 5m candles when gas_fee refreshes, and about once an hour when asset σ refreshes. Subset of GET /config (gas_fee, trading_fee_factor, chain_id, exchange, assets with live sigma when available).

{
  "channel": "config",
  "gas_fee": 50000,
  "trading_fee_factor": "40000000000000000",
  "chain_id": 31337,
  "exchange": "0x…",
  "assets": {
    "btc": {
      "price_decimals": 0,
      "sigma": { "weekday": 0.48, "weekend": 0.36, "all": 0.45 }
    }
  }
}

markets

On subscribe and when a market locks or resolves. markets is the same array as GET /markets.

{
  "channel": "markets",
  "markets": [ /* same objects as GET /markets */ ]
}

market

When a market opens (push only). market matches GET /markets/:id / one element of GET /markets.

{
  "channel": "market",
  "op": "opened",
  "market": { /* Market */ }
}

resolved

On subscribe with market, and again when any peer for that strike/expiry resolves. markets are resolved Market rows (same shape as GET /markets) sharing kind + barrier (+ high) + expiry with the subscribed id (hit up and down both included; newest resolve first).

{
  "channel": "resolved",
  "market": "btc-hit-80000-up-daily-…",
  "strike": "…",
  "expires_at": 1735689600,
  "markets": [ /* Market[] */ ]
}

price

On subscribe and on each new Chainlink feed round. Same core fields as GET /price, plus spot (same value as price) and round (the feed round id).

{
  "channel": "price",
  "price": "97500.12",
  "spot": "97500.12",
  "barrier": "97000",
  "ts": 1735689000,
  "round": "0x100000000000b0392",
  "source": "chainlink"
}

book / quote

Subscribe book (with market) publishes both immediately. Further book/quote pushes after place/cancel/fill, rate-limited to about once per market per 80ms (cancel-all forces an immediate book). bids_yes / bids_no match GET /markets/:id/book (WS uses market instead of market_id, adds book_hash, omits status).

{
  "channel": "book",
  "market": "btc-hit-80000-up-daily-…",
  "seq": 42,
  "bids_yes": [[450, "10.0"], [400, "5.0"]],
  "bids_no": [[500, "8.0"]],
  "book_hash": "0x…"
}
{
  "channel": "quote",
  "market": "btc-hit-80000-up-daily-…",
  "best_yes_bid": 450,
  "best_yes_ask": 550
}

best_yes_bid / best_yes_ask match those fields on GET /markets rows.

tape / tape_snapshot

Subscribe tape returns tape_snapshot (latest ~100 events for that market, plus recent chain confirms). Live events arrive as tape. Each event matches one element of GET /markets/:id/tape.

{
  "channel": "tape_snapshot",
  "market": "btc-hit-80000-up-daily-…",
  "events": [ /* same as GET /markets/:id/tape items */ ]
}
{
  "channel": "tape",
  "seq": 10,
  "event": { "seq": 10, "ts": 1735689000, "kind": "Accepted", "order_id": 1, "market_id": "…" }
}

trades / trades_snapshot

Subscribe trades returns trades_snapshot (up to 200 fills for that market). Each fill matches GET /trades items. Live fills use channel: "trades" with a single fill.

{
  "channel": "trades_snapshot",
  "market": "btc-hit-80000-up-daily-…",
  "fills": [ /* same as GET /trades?market=… */ ]
}
{
  "channel": "trades",
  "fill": {
    "fill_id": 12,
    "market_id": "btc-hit-80000-up-daily-…",
    "yes_price": 550,
    "size": "2.0",
    "taker_side": "Yes",
    "confirmed": false
  }
}

last_yes

After each fill (instead of republishing the full markets list). price is the fill’s Yes price (¢); same meaning as last_yes_price on GET /markets.

{
  "channel": "last_yes",
  "market": "btc-hit-80000-up-daily-…",
  "price": 550
}

account

Push only. Filter by trader (lowercase). Always includes volume_30d and taker_coeff (same fields as GET /account). Variants:

Deposit / withdraw delta:

{
  "channel": "account",
  "trader": "0x…",
  "op": "deposit",
  "amount": 100000000,
  "tx_hash": "0x…",
  "ts": 1735689000,
  "volume_30d": 2500000,
  "taker_coeff": 0.04
}

Absolute collateral after redeem / split / merge / fill / close (and fund refresh):

{
  "channel": "account",
  "trader": "0x…",
  "collateral": 95000000,
  "ts": 1735689000,
  "volume_30d": 2500000,
  "taker_coeff": 0.04
}

Hourly volume snapshot (optional collateral):

{
  "channel": "account",
  "trader": "0x…",
  "ts": 1735689600,
  "volume_30d": 2500000,
  "taker_coeff": 0.04,
  "collateral": 95000000
}

ledger

Full snapshot after resolve / settle confirm / redeem / split / merge. positions matches GET /ledger/positions; trades matches GET /ledger/history.

{
  "channel": "ledger",
  "trader": "0x…",
  "positions": [ /* GET /ledger/positions */ ],
  "trades": [ /* GET /ledger/history */ ]
}

ledger_delta

Match-time patch (merge into local state; do not replace full history). trades / positions items use the same shapes as GET /ledger/history and GET /ledger/positions. remove_positions drops those sides from the Positions tab.

{
  "channel": "ledger_delta",
  "trader": "0x…",
  "trades": [ /* new history rows */ ],
  "positions": [ /* upserted position rows */ ],
  "remove_positions": [{ "market_id": "…", "side": "Yes" }]
}

holders

After positions change on a market. yes / no match GET /markets/:id/holders (WS uses market instead of market_id).

{
  "channel": "holders",
  "market": "btc-hit-80000-up-daily-…",
  "yes": [{ "trader": "0x…", "shares": "10.0", "usdc_staked": 5000000 }],
  "no": []
}

orders

Your open orders, after a wallet subscribe with a sign-in token. The full list is sent once, then only what changed. Rows have the same shape as GET /ledger/orders.

opWhenApply
snapshotRight after each wallet subscribe (to that socket only)Replace your list with orders; remember seq
deltaWhen orders change (placed, filled, cancelled, expired), at most every 80 ms per walletRows in upsert replace / add by id; ids in remove left the open list
resyncToo many changes at once (e.g. cancel-all)Subscribe the wallet again for a fresh snapshot

seq counts per wallet: apply a delta only when its seq is exactly one more than the last you applied. Ignore lower or equal ones (sent before your snapshot). If one is skipped (a dropped frame), subscribe the wallet again for a new snapshot. seq restarts when the node restarts; the snapshot after reconnecting resets it.

{
  "channel": "orders",
  "op": "snapshot",
  "trader": "0x5d17…",
  "seq": 41,
  "orders": [ /* same as GET /ledger/orders, newest first */ ]
}

{
  "channel": "orders",
  "op": "delta",
  "trader": "0x5d17…",
  "seq": 42,
  "upsert": [ { "id": 812, "market_id": "btc-hit-…", "side": "Yes", "price": 600, "size": "10", "remaining": "4", "status": "partial", "tif": "GTC", "expires_at": 0, "ts": 1794742400, "sell": false, "agent_auth_expires_at": 0 } ],
  "remove": [ 807, 809 ]
}

exits

Position TP/SL and standalone stop updates (push only). Position: op: set + exit, op: clear after DELETE, op: fired when a TP/SL leg triggers (OCO clears both). Standalone stop: op: set_stop + stop, op: clear_stop + stop_id, op: fired_stop when the mark crosses when/trigger_price.

{
  "channel": "exits",
  "op": "set",
  "exit": { "trader": "0x…", "market_id": "…", "side": "Yes", "trigger": "mid", "take_profit": { "…" }, "stop_loss": null }
}
{
  "channel": "exits",
  "op": "set_stop",
  "stop": {
    "kind": "stop",
    "id": "ab12…",
    "trader": "0x…",
    "market_id": "…",
    "side": "Yes",
    "trigger": "mid",
    "when": "above",
    "close": false,
    "trigger_price": 600,
    "size": "5.0",
    "order": { "…" }
  }
}
{
  "channel": "exits",
  "op": "clear_stop",
  "trader": "0x…",
  "stop_id": "ab12…"
}
{
  "channel": "exits",
  "op": "fired_stop",
  "stop_id": "ab12…",
  "trader": "0x…",
  "market_id": "…",
  "side": "Yes",
  "when": "above",
  "close": false
}

announcements

Push-only. op: "new" on create (all clients). op: "deleted" after DELETE /announcements/{id}. op: "missed" after POST /announcements/visit (filter on trader; up to 3 rows).

{
  "channel": "announcements",
  "op": "new",
  "announcement": { "id": 1, "title": "…", "body": "…", "created_at": 1735688000 }
}
{
  "channel": "announcements",
  "op": "deleted",
  "id": 1,
  "announcement": { "id": 1, "title": "…", "body": "…", "created_at": 1735688000 }
}
{
  "channel": "announcements",
  "op": "missed",
  "trader": "0x…",
  "announcements": [ { "id": 1, "title": "…", "body": "…", "created_at": 1735688000 } ],
  "prev_visit_at": 0,
  "visited_at": 1735689000
}