跳到主要内容

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

URLPurpose
wss://api-avax.<sparky-domain>/wsNative engine data (public + private channels)
wss://api-avax.<sparky-domain>/ws/internalAlias of /ws
wss://api-avax.<sparky-domain>/ws/externalProxy 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

typeFieldsPurpose
subscribechannelSubscribe to a channel (see Subscribe)
unsubscribechannel
authlistenKey or token (JWT) or address + signature + timestampAuthenticate for private channels
auth_tokentokenJWT-only alias of auth
pingApplication keepalive

Server → client

typeEmitted for
subscribed / unsubscribedacknowledgements, with channel
auth_result{ success, message }
tradetrades:<symbol>
orderbookorderbook:<symbol>
tickerticker:<symbol>
kline_snapshot / klinekline:<symbol>:<interval>
position / order / balanceprivate snapshots (User data)
error{ code, message }INVALID_CHANNEL, AUTH_REQUIRED, …
pongreply 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

ChannelAuthSnapshot on subscribeUpdate cadence
trades:BTCUSDTnonoevery fill
orderbook:BTCUSDTnoyes (top 30)every 500 ms while it changes
ticker:BTCUSDTnoyesevery 2 s
kline:BTCUSDT:1mnoyes (latest bar)on each update
positions, orders, balance, unified_account, points, vip_tieryesyesevent-driven; positions/orders also re-pushed every 5 s
candle:, funding_rate:, liquidation:, adl:, mark_price:, index_price: prefixesnoaccepted 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 streamSparky
<symbol>@aggTradetrades:<symbol> (individual fills, not aggregated)
<symbol>@markPrice, !markPrice@arrmark_price field on ticker:<symbol>
<symbol>@kline_<interval>kline:<symbol>:<interval>
<symbol>@continuousKline_…not applicable (perpetuals only)
<symbol>@miniTicker, !miniTicker@arr, <symbol>@ticker, !ticker@arrticker:<symbol> — per symbol only, no all-market array
<symbol>@bookTicker, !bookTickertop level of orderbook:<symbol>
<symbol>@forceOrder, !forceOrder@arrnot implemented (poll GET /fapi/v1/forceOrders)
<symbol>@depth<levels>, <symbol>@depth (diff)orderbook:<symbol> snapshots; no diff stream
<symbol>@compositeIndex, !contractInfo, !assetIndex@arrnot applicable
/ws/<listenKey> user-data streamauth with listenKey on the same socket (User data)
Combined /stream?streams=one socket, many subscribe messages