Skip to main content
Opera is the API-first simulator. External clients authenticate with operaConnect, place and cancel with request/response (operaResult), and receive operaState plus orderBook. Product overview: Opera. Full message schemas: OpenAPI group Opera in the sidebar.

Get a token

  1. Sign in at getavenir.co
  2. Open Opera (or go to /opera)
  3. Click Copy token
  4. Send it in operaConnect as token
Tokens expire quickly. On operaResult with status: 401, copy a fresh token and reconnect.

Protocol

  1. Connect to wss://www.getavenir.co/ws
  2. { "action": "operaConnect", "token": "...", "requestId": "c1" }
  3. Expect operaResult (op: "connect", status: 200), then orderBook and operaState
  4. { "action": "operaPlace", ... } / operaCancel / operaCancelAll / operaGetState
  5. Correlate replies with optional requestId on operaResult
The in-app UI may instead use userConnected with applicationType: "opera" (UI client). Bot-mode and session record/reset are UI-only; API sockets get those rejected.

Starter code

Client actions

Default instrument is 0. orderId is optional on place (server can assign a UUID). Status codes on operaResult are HTTP-like (200 / 201 / 400 / 403 / 404 / 429). Cancel of another participant’s order returns 403; place/cancel rate limits return 429 (same 120 / 240 per 60s bands as UI trading). operaCancelAll is not cancel-rate-limited. UI placeOrder / toggleBots are not available on API sockets (forbidden / ui_only).

Server messages