Access and connection
Broker stream access is available only to brokers explicitly enabled by Orderly. Contact Orderly to enable access and obtain the broker WebSocket endpoint for your environment. Use your configured broker admin account ID and an Orderly Key associated with that account. An ordinary user account cannot open a broker stream. Mainnet (production):{admin_account_id} with your configured broker admin account ID. Use /ws/stream/ in both environments. The account-level private stream endpoint is a separate connection.
The server derives the broker from the configured admin account. You do not supply a broker ID to select another broker’s data.
Authentication
Use the WebSocket authentication signature scheme:- Generate a current Unix timestamp in milliseconds.
- Sign the timestamp’s decimal string using the admin account’s Orderly secret key and Ed25519. Do not append an HTTP method, path, or body.
- Encode the signature as base64url.
- Authenticate with all three URL parameters or an
AUTHmessage before subscribing.
ed25519:<public-key> value for orderly_key. Only send the public key, timestamp, and signature; keep the secret key local.
Authenticate in the connection URL
Appendorderly_key, timestamp, and sign to the connection URL. Preserve the literal colon in ed25519:<public-key>; percent-encoding it as %3A does not work with the tested staging endpoint. The timestamp is a decimal string and the signature is base64url. Provide all three parameters together; successful URL authentication does not require a separate AUTH message.
Authenticate with a message
Alternatively, connect to the URL for your environment without query parameters, then send:timestamp as a JSON string. Wait for a successful authentication response before subscribing:
Subscribe and unsubscribe
Use the plain topic name in subscription requests. The server scopes the subscription to your broker automatically.UN_SUBSCRIBE with the topic names in a nonempty params array. The event name includes an underscore; unsubscribe is rejected. Changing only event in a subscribe request is not sufficient:
params.symbol filter shown on the account-level execution report page; filter received events in your application.
Event topics
Broker forwarding is available for the following event types. Access also depends on the topics enabled for your environment; confirm availability with Orderly when enabling the stream.
Use the topics listed above and confirm that they are enabled for your broker. A successful subscription acknowledgment alone does not establish that a topic produces broker events.
Message envelope
Broker events use this envelope:
The linked account-level pages describe each event’s business fields. Broker payloads preserve the following wire-format details:
algoexecutionreport.datais an array, including when it contains one report.algoexecutionreportv2.datais an object with optional nestedchildOrders.executionreport.data.averageExecutedPriceis the cumulative average execution price. The payload also includes theavgPricealias; do not expect theavgExecutedPricespelling shown in the account-level example.executionreport.data.matchIdis a JSON number. Algo reports use a string-valuedmatchId. Do not expect the snake-casematch_idfield from the account-level execution report example.liquidationsaccount.datais a single liquidation object containingliquidationId,timestamp,transferAmountToInsuranceFund, and apositionsByPerparray. The array wrapper in the account-level example does not apply to broker events.position.data.positionsis an array. Each position usesupdatedTimefor its update timestamp and includesmarginTokenfor its margin asset, defaulting toUSDC. UseupdatedTimeinstead of theupdated_timespelling in the account-level example.balance.data.balancesis keyed by token. Broker balance entries do not includeaverageOpenPriceorpnl24H; those fields in the account-level example are not part of the broker balance payload.- Optional fields with null values can be omitted. Examples on account-level pages do not require every field to be present in every broker event.
type values:
The
MARKET value in the linked account-level v1 example does not apply to broker v1 reports. Parse each topic using its own values. The two topics provide different report formats; do not assume every v1 event has a corresponding v2 event.
For example, a balance update for a user under example_broker is:
accountId to keep each user’s state separate. Do not route events to the admin account or assume the received topic equals the subscription string.
Liquidation event example
A broker liquidation event contains one liquidation object. ItspositionsByPerp array lists the affected perpetual positions:
Errors and reconnecting
An unrecognized broker admin account is rejected when the connection is opened. Invalid credentials supplied in the URL also cause rejection and connection closure. Authentication and subscription command failures returnsuccess: false; broker stream error details are carried in data:
{"event": "PING"} regularly, for example every 10 seconds. The server responds with event: "PONG", success: true, and a millisecond ts. Handle server-initiated ping as well as command responses; idle timeout settings can vary by environment.
After reconnecting, authenticate again and restore your subscriptions. Treat the stream as live events: do not assume a subscription sends an initial snapshot or replays events missed during a disconnection. Events for newly registered users may also be delayed. Reconcile state through the appropriate authorized REST APIs.