Market Data API Overview
Real-time and historical market data: ticker prices, candlestick klines, order book depth, trades, and instrument metadata.
REST endpoints are best for one-shot queries and historical data. WebSocket streams are best for low-latency continuous updates.
| Use case | Recommended |
|---|---|
| Latest price snapshot | REST ticker |
| Continuous price updates | WebSocket ticker |
| Historical candles | REST klines |
| Live candles | WebSocket klines |
| Order book snapshot | REST depth |
| Live order book | WebSocket depth |
| Recent trades | REST trades |
| Symbol metadata | REST exchange-info |
Authentication
All market-data endpoints are publicly accessible without an API key. Signing a request as described in Authentication is optional and increases the per-key rate-limit quota.
Timestamps
The market-data module uses Unix milliseconds (integer) for every timestamp field — open_time, close_time, time, serverTime, ts, etc. This matches Binance spot/futures conventions for OHLCV data and differs from the strategies module, which uses ISO 8601 strings.
Symbol naming
Symbols are uppercase concatenations of the base and quote asset, with no separator: BTCUSDT, ETHUSDT, SOLUSDC. Lowercase symbols are not accepted and will return INVALID_PARAMETER.
Intervals
The interval parameter accepts the following values:
| Group | Values |
|---|---|
| Minutes | 1m, 3m, 5m, 15m, 30m |
| Hours | 1h, 2h, 4h, 6h, 8h, 12h |
| Days | 1d, 3d |
| Weeks | 1w |
| Months | 1M |
Note that 1M (month) is uppercase to disambiguate from 1m (minute).
Best practices
- Use WebSocket streams for live data and trading signals. Subscribe once and consume the push stream.
- Use REST endpoints for historical backfills, one-off snapshots, and data that does not need to be live.
- Never poll a REST endpoint at sub-second intervals. A polling cadence below 1 second will trigger rate limiting and is operationally fragile — switch to WebSocket instead.
- Combine a REST
depthsnapshot with themarket.depthstream to bootstrap a local order book. - Treat all decimal values (
price,qty,volume, ...) as strings; do not parse to float without a decimal library if precision matters for accounting.