WebSocket API
The relay speaks a simple JSON-over-WebSocket protocol. One connection streams one
symbol + channel.
Endpoint
wss://feed.alphaquick.io/ws
Authentication
- Bots / servers: send
Authorization: Bearer aqk_live_v1_…(see API keys). - Browser: pass a short-lived
ticketquery parameter (see Demo feed). The app handles this for the comparison tool.
Query parameters
| Param | Required | Default | Description |
|---|---|---|---|
symbol | yes | — | Instrument, e.g. BTC, ETH, SOL. |
channel | no | tob | Which stream — see below. |
source | no | combined | combined, or a specific book source a / b. |
ticket | browser only | — | Short-lived ticket (in place of the header). |
Example:
wss://feed.alphaquick.io/ws?symbol=BTC&channel=tob100&source=combined
Channels
| Channel | Payload | Description |
|---|---|---|
tob | tob frame | Top of book (best bid/ask), lightest stream. |
tob50 | snapshot + delta | Top 50 levels each side. |
tob100 | snapshot + delta | Top 100 levels each side. |
tob200 | snapshot + delta | Top 200 levels each side. |
book | snapshot + delta | Full order book. |
trades | trades frame | Executions as they print. |
Frame formats
All prices and sizes are decimal strings (preserve them as strings to avoid
float precision loss). ts is a millisecond unix timestamp.
Top of book (tob)
{"type":"tob","symbol":"BTC","bid_price":"63423.0","bid_size":"8.35","ask_price":"63424.0","ask_size":"14.28","ts":1786954142846}
Depth: snapshot + delta (tob50 / tob100 / tob200 / book)
On connect you receive one snapshot (the full current view), then delta
updates. Rows are {dir, price, volume} where dir: 0 = bid, dir: 1 = ask.
{"type":"snapshot","symbol":"BTC","rows":[{"dir":0,"price":"63350.0","volume":"8.99"}, …],"ts":1786954142846}
{"type":"delta","symbol":"BTC","rows":[{"dir":1,"price":"63424.0","volume":"14.28"}],"ts":1786954142857}
Applying deltas:
- Upsert each row at its
price(replace the level'svolume). - A row with
volume"0"means remove that price level. - A new
snapshot(e.g. after a resync) replaces your entire book.
Trades (trades)
{"type":"trades","symbol":"BTC","block_number":42,"ts":1786954142846,"trades":[{"px":"63424.0","sz":"0.12"}]}
Gap / resync
If your client falls behind and the relay's send buffer for your connection overflows, it drops the queued backlog and signals a gap, then re-seeds you with a fresh snapshot:
{"type":"gap","dropped":128,"reason":"slow_consumer","ts":1786954142846}
On a gap, discard your local book and rebuild from the snapshot that follows.
Keep your consumer fast (don't block the socket) to avoid gaps.
Lease & reconnect
Every connection is granted a lease. For API keys the lease is revalidated periodically (about every 30s) and the socket is closed shortly after a key is revoked or a subscription lapses. Browser tickets use a fixed ~60s lease.
Clients should reconnect on close (with a small backoff + jitter) and, for API keys, simply reconnect with the same header. The market-data path is unaffected by revalidation — it runs on a separate control channel.