APIs, Bots & Automation

How to Stream Live Crypto Quotes with the Quote.Trade WebSocket API

Connect to wss://app.quote.trade/ws/liquidity, subscribe to a live symbol, parse prices and quantities without floating-point errors, and handle reconnects and stale data.

30 minutesIntermediateBot developers and market-data engineers

What you will accomplish

  • Subscribe to a live symbol
  • Parse bid and ask depth separately
  • Enforce message and freshness limits
  • Reconnect without using stale state

Before you begin

  • A WebSocket client
  • An active symbol from exchange information
  • A logging and reconnect strategy
Endpointwss://app.quote.trade/ws/liquidity
Documented requestsymbol plus unsubscribe flag
Numeric handlingString / Decimal
Schema sourceLive subscription response and current documentation
Step-by-step

Connect to the documented public stream

Use wss://app.quote.trade/ws/liquidity. A public liquidity subscription does not require account credentials.

Subscribe with the documented request

Send symbol and unsubscribe=0. Keep the requested symbol in your local subscription state.

json
{"symbol":"BTC","unsubscribe":0}

Parse without binary floating-point assumptions

The documentation example uses p and q fields. Preserve them as strings or convert with a decimal library before calculating spreads or VWAP.

Implement heartbeat, reconnect, and resubscribe

Use a bounded exponential backoff with jitter, cap retries, and resubscribe only after the socket is open. Record receive time. Do not infer sequence guarantees that the docs do not state.

Unsubscribe cleanly and reload state

Send unsubscribe=1 before planned shutdown. After reconnect, retrieve a fresh REST depth snapshot instead of assuming no data was missed.

json
{"symbol":"BTC","unsubscribe":1}
Troubleshooting

Common problems and fixes

The socket closes after rapid subscriptions

Throttle ping, pong, subscribe, and unsubscribe control messages below the documented limit.

The book appears crossed or stale

Validate receive times and sequence/update fields, discard invalid state, and request a fresh stream.

No messages arrive

Confirm the symbol is active and the subscription JSON matches the current documentation.

Primary sources

Ready for the next step?

Open WebSocket documentation

Open WebSocket documentation