Market Data Streams
Sparky pushes market data and private account events over a single WebSocket per deployment. The protocol is Sparky's own JSON subscribe/unsubscribe model — it is not Binance's <symbol>@stream URL scheme — so each Binance stream page in this section maps to the Sparky channel that carries the same data.
Endpoints
| URL | Purpose |
|---|---|
wss://api-avax.<sparky-domain>/ws | Native engine data (public + private channels) |
wss://api-avax.<sparky-domain>/ws/internal | Alias of /ws |
wss://api-avax.<sparky-domain>/ws/external | Proxy of the external reference price source; messages follow that source's (Hyperliquid) format and are refreshed every 500 ms. Reference only — not the Sparky order book. |
Use the host of the chain you trade on (see Base URLs).
Message model
Every frame is a JSON object with a type discriminator.
Client → server
type | Fields | Purpose |
|---|---|---|
subscribe | channel | Subscribe to a channel (see Subscribe) |
unsubscribe | channel | |
auth | listenKey or token (JWT) or address + signature + timestamp | Authenticate for private channels |
auth_token | token | JWT-only alias of auth |
ping | — | Application keepalive |
Server → client
type | Emitted for |
|---|---|
subscribed / unsubscribed | acknowledgements, with channel |
auth_result | { success, message } |
trade | trades:<symbol> |
orderbook | orderbook:<symbol> |
ticker | ticker:<symbol> |
kline_snapshot / kline | kline:<symbol>:<interval> |
position / order / balance | private snapshots (User data) |
error | { code, message } — INVALID_CHANNEL, AUTH_REQUIRED, … |
pong | reply to ping |
Private delta events (balance_update, order_update, points, vip_tier_changed, unified_account) use a channel + data envelope instead — see User data.
Channel names
| Channel | Auth | Snapshot on subscribe | Update cadence |
|---|---|---|---|
trades:BTCUSDT | no | no | every fill |
orderbook:BTCUSDT | no | yes (top 30) | every 500 ms while it changes |
ticker:BTCUSDT | no | yes | every 2 s |
kline:BTCUSDT:1m | no | yes (latest bar) | on each update |
positions, orders, balance, unified_account, points, vip_tier | yes | yes | event-driven; positions/orders also re-pushed every 5 s |
candle:, funding_rate:, liquidation:, adl:, mark_price:, index_price: prefixes | no | — | accepted by the validator; used by the web app, shapes not yet documented here |
Symbols in channel names are normalized the same way as REST (aliases).
Binance stream compatibility matrix
| Binance stream | Sparky |
|---|---|
<symbol>@aggTrade | trades:<symbol> (individual fills, not aggregated) |
<symbol>@markPrice, !markPrice@arr | mark_price field on ticker:<symbol> |
<symbol>@kline_<interval> | kline:<symbol>:<interval> |
<symbol>@continuousKline_… | not applicable (perpetuals only) |
<symbol>@miniTicker, !miniTicker@arr, <symbol>@ticker, !ticker@arr | ticker:<symbol> — per symbol only, no all-market array |
<symbol>@bookTicker, !bookTicker | top level of orderbook:<symbol> |
<symbol>@forceOrder, !forceOrder@arr | not implemented (poll GET /fapi/v1/forceOrders) |
<symbol>@depth<levels>, <symbol>@depth (diff) | orderbook:<symbol> snapshots; no diff stream |
<symbol>@compositeIndex, !contractInfo, !assetIndex@arr | not applicable |
/ws/<listenKey> user-data stream | auth with listenKey on the same socket (User data) |
Combined /stream?streams= | one socket, many subscribe messages |