Skip to main content
Build a live price dashboard on WhiteBIT public market data: one REST call paints the initial board, and a single WebSocket subscription keeps every displayed price current. The full flow runs without an account or API key. The guide targets price aggregators and market-data consumers.

Prerequisites

  • A terminal with curl, or any HTTP client
  • Python 3 with the websocket-client package, or wscat for interactive testing — for the streaming step
  • No WhiteBIT account or API key needed — every endpoint in this guide is public

Architecture

The dashboard combines two data paths: a REST snapshot for the initial paint and a WebSocket stream for continuous updates. A REST polling loop substitutes for the stream while a dropped connection recovers.

Select markets to track

Market discovery comes first. GET /api/v4/public/markets returns configuration and trading rules for every market enabled for trading. Read name for the pair identifier and filter by type (spot, futures, or tradfiFutures) to scope the board — a spot-only dashboard keeps type: spot entries. Market configuration is reference data: the server re-syncs the response approximately every 10 seconds, so fetch the list once at startup and refresh on a slow cycle. For a step-by-step first call against each public market-data endpoint, see the Market Data Quickstart.

Fetch the price snapshot

GET /api/v4/public/ticker returns a 24-hour pricing and volume summary for every market pair in a single response — one call fills the whole board.
For Go and PHP examples, see SDKs. Response (BTC_USDT entry, trimmed):
Key fields for a dashboard: last_price (most recent trade price in the quote currency), change (percentage change against the rolling 24-hour open), quote_volume (24-hour volume in the quote currency), and isFrozen (true when trading is disabled for the pair — flag or hide the entry). The API caches the response for 1 second, so polling faster than once per second returns identical data.

Stream price updates

Polling covers one-shot lookups; a live board needs continuous updates. Subscribe to the Last Price channel — the server pushes an update every second when the price changes, and each update replaces the displayed value. One connection carries the full watchlist: the subscription accepts an array of market names. A single connection maintains subscriptions across 200 or more markets (see WebSocket Rate Limits).
Subscribe confirmation:
Update message:
The params array contains the market name (index 0) and the last traded price (index 1). For an order book widget next to the price board, add the Depth channel — a snapshot-plus-delta stream with recovery rules of its own, covered in State recovery after reconnect. The WebSocket Quickstart covers connection setup, keepalive pings, and the 60-second inactivity timeout; the dashboard reuses the same connection pattern.

Reconcile snapshot and stream

Last price updates follow a replacement model: each lastprice_update fully replaces the previous value for the market, so the board needs no gap handling. Three rules keep the board consistent:
  1. Startup ordering. Subscribe first, then fetch the ticker snapshot. Apply snapshot values only to pairs without a streamed value yet — the snapshot response can lag behind the stream by its 1-second cache. With replacement semantics, even the reverse order self-corrects within one update interval.
  2. Liveness. Do not infer connection health from update frequency alone. Send a ping every 50 seconds or less — the server closes a connection after 60 seconds of client inactivity — and treat a missed pong as a dropped connection. Reconnection with backoff and resubscription follows the standard pattern in Reconnection and state recovery.
  3. Polling fallback. While a connection recovers, keep the board live by polling GET /api/v4/public/ticker. The 1-second server-side cache makes one request per second the effective polling ceiling. Stop polling once resubscription confirms.

Rate limits

The endpoints and channels used on this page carry the following limits: Full reference: Rate Limits & Error Codes and WebSocket Rate Limits & Error Codes.

Complete example

The two snippets above cover the critical path — the ticker snapshot and the price stream. The remaining assembly (multi-pair state, staleness flags, reconnection, the polling fallback) is standard application code. A complete runnable dashboard is planned as a clone-and-run starter repository.

What’s next

Market Data Quickstart

First calls against each public market-data endpoint — ping, markets, ticker, orderbook, trades.

WebSocket Quickstart

Connection setup, keepalive, reconnection, and state recovery patterns.

Partner Solutions

Integration routes by use case — trading bots, payments, account monitoring.