Skip to main content
All simulator traffic uses wss://www.getavenir.co/ws as JSON text frames. Set action on client messages; the server replies and pushes with type. Trading is WebSocket-only. Past sessions and leaderboards use separate REST routes under /api.

Auth

UI simulators (userConnected)

  • Identity comes from token (sub). Do not rely on a client-supplied userId.
  • applicationType must be one of: tutorial, mirage, artefact, atlas, opera.
  • Access is checked server-side (forbidden if you lack simulator access).
  • Marks the socket as a UI client. Only one live UI socket per user per app; a new connect can close the old one (superseded).
  • Wait for the first orderBook (and any app bootstrap push) before sending trading or session-start actions — userConnected auth is async.
Get a Clerk JWT the same way the web app does (signed-in session). Tokens expire; reconnect with a fresh JWT on unauthorized.

Opera API clients (operaConnect)

External bots authenticate with a short-lived token copied from /opera. See Opera. That path marks the socket as an API client and blocks UI-only actions.

Shared trading (UI clients)

Tutorial, Mirage, Artefact, and Atlas place and cancel with these actions (UI sockets only). There is no per-order ack; watch orderBook (and app-specific pushes). Invalid place/cancel (bad instrument, off-ladder price, not your order) and rate-limit hits are usually dropped without a client error frame. Rate limits (per user per app): 120 places and 240 cancels per 60 seconds.

Instruments

Common server messages