Overview
The Provider API offers WebSocket endpoints for real-time data streaming. Each vertical has its own WebSocket path with multiplexed channels supporting multiple providers on a single connection.Connection URLs
| Vertical | WebSocket Path |
|---|---|
| Perps | wss://api.perps.studio/ws/v1/perps |
| Spot | wss://api.perps.studio/ws/v1/spot |
| RWAs | wss://api.perps.studio/ws/v1/rwas |
| Predictions | wss://api.perps.studio/ws/v1/predictions |
Authentication
Authenticate by passing your API key as a query parameter on connect:4001.
Subscribe / Unsubscribe
After connecting, send JSON messages to subscribe to channels:Subscribe
Unsubscribe
Available Channels
Perps Channels
| Channel | Description | Required Params | HL Upstream | Aster Upstream |
|---|---|---|---|---|
orderbook | Level 2 orderbook updates | symbol | l2Book | depth |
trades | Real-time trade executions | symbol | trades | aggTrade |
ticker | 24h ticker statistics | symbol | activeAssetCtx | ticker |
candle | Candlestick/kline updates | symbol, interval | candle | kline |
prices | All mid prices (broadcast) | none | allMids | !ticker@arr |
Spot Channels
| Channel | Description | Required Params | HL Upstream | Aster Upstream |
|---|---|---|---|---|
orderbook | Level 2 orderbook updates | symbol | l2Book | depth |
trades | Real-time trade executions | symbol | trades | aggTrade |
ticker | 24h ticker statistics | symbol | activeAssetCtx | ticker |
RWA Channels
| Channel | Description | Required Params |
|---|---|---|
orderbook | HIP-3 dex orderbook updates | symbol, dex |
trades | HIP-3 dex trade executions | symbol, dex |
ticker | HIP-3 dex ticker statistics | symbol, dex |
Prediction Channels
| Channel | Description | Required Params |
|---|---|---|
orderbook | Outcome token orderbook | tokenId |
prices | Market price updates | marketId |
Message Format
All messages from the server follow this format:Full Example
Reconnection Best Practices
Detect Disconnection
Listen for the
close event. Normal closure is code 1000. Anything else indicates an unexpected disconnect.Exponential Backoff
Wait 1s, 2s, 4s, 8s, … up to 30s between reconnection attempts. Add random jitter to avoid thundering herd.
Re-subscribe
After reconnecting, re-send all your subscription messages. The server does not remember previous subscriptions.