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
- Sign in at getavenir.co
- Open Opera (or go to
/opera) - Click Copy token
- Send it in
operaConnectastoken
operaResult with status: 401, copy a fresh token and reconnect.
Protocol
- Connect to
wss://www.getavenir.co/ws { "action": "operaConnect", "token": "...", "requestId": "c1" }- Expect
operaResult(op: "connect",status: 200), thenorderBookandoperaState { "action": "operaPlace", ... }/operaCancel/operaCancelAll/operaGetState- Correlate replies with optional
requestIdonoperaResult
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
Related
- Guide: Opera
- Shared overview: API overview
- Schemas: OpenAPI Opera group