NIOX Developer API
Introduction
The NIOX API gives you programmatic access to market data, trading, and account operations. Field names, JSON shapes, and pagination conventions match the de-facto industry standard used by major centralized exchanges so existing bot tooling (CCXT-style libraries) works without per-exchange shims.
There are three layers — explore each from the sidebar:
- Public Market Data — REST endpoints, no auth, IP-rate-limited.
- WebSocket Streams — push-style market data over a single multiplexed connection.
- Trading + Account — JWT (web UI) or HMAC-signed API key (bots). Same endpoints, two auth methods.
Base URLs
REST:
https://api.niotx.com
WebSocket (combined stream):
wss://ws.niotx.com/ws/v1/stream
Authentication
Endpoints under /api/v1/public/ need no authentication. Trading and account endpoints accept either:
- JWT — used by the web UI. Standard Authorization: Bearer <token> header.
- HMAC-signed API key — used by bots. See the next section for the full signing protocol.
When both styles are valid on the same endpoint, the API key path takes priority if the X-API-Key header is present. Otherwise the JWT path runs unchanged.
HMAC signing
Create an API key from your account page. The plaintext secret is returned exactly once at creation — store it immediately. Every signed request carries three headers:
- X-API-Key — your public key id (niox_pk_…).
- X-Timestamp — current time in ms epoch. Tolerance ±30s.
- X-Signature — hex HMAC-SHA256 of the canonical message, signed with your secret.
Canonical message
<timestamp_ms> + <METHOD> + <path> + <query_string> + sha256(body)
All concatenated as one string, no delimiters. The body hash is the hex SHA-256 of the raw request body (empty string when there's no body). Query string is the raw URL-encoded string (no leading ?).
curl example — signed GET
TS=$(date +%s000)
PATH_="/api/v1/trade/orders/open/"
MSG="${TS}GET${PATH_}"
SIG=$(printf '%s' "$MSG" | openssl dgst -sha256 -hmac "$NIOX_API_SECRET" | awk '{print $2}')
curl "https://api.niotx.com${PATH_}" \
-H "X-API-Key: $NIOX_API_KEY" \
-H "X-Timestamp: $TS" \
-H "X-Signature: $SIG"curl example — signed POST (place LIMIT BUY)
BODY='{"symbol":"BTCUSDT","side":"BUY","type":"LIMIT","quantity":"0.001","price":"50000","timeInForce":"GTC"}'
TS=$(date +%s000)
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 | awk '{print $2}')
MSG="${TS}POST/api/v1/trade/order${BODY_HASH}"
SIG=$(printf '%s' "$MSG" | openssl dgst -sha256 -hmac "$NIOX_API_SECRET" | awk '{print $2}')
curl -X POST https://api.niotx.com/api/v1/trade/order \
-H "X-API-Key: $NIOX_API_KEY" \
-H "X-Timestamp: $TS" \
-H "X-Signature: $SIG" \
-H "Content-Type: application/json" \
-d "$BODY"Permissions are checked per request — keys with onlyread are rejected on trading endpoints, etc. Granting thewithdraw permission requires a current TOTP code in the create/update request.
Rate limits
Public market-data endpoints: 1200 req/min/IP(industry-standard default). Listing-format endpoints:60 req/min/IP. Authenticated endpoints use per-user DRF throttles.
Every public response carriesX-Used-Weight-1m and the alias X-MBX-USED-WEIGHT-1m(for CCXT-style libraries that already look for that name) — track these to pace your requests against your IP's rolling-60s weight total. Heavier endpoints cost more weight per call (ping = 1, exchangeInfo = 10, ticker/24hr all-symbols = 40).
Conventions
- All numeric values are JSON strings to preserve full decimal precision.
- Timestamps are unix milliseconds (UTC).
- Symbol format: standard endpoints use BTCUSDT (concatenated, uppercase). Listing-format endpoints use BTC_USDT (underscore-delimited).
- WebSocket subscribe payloads accept both {"action":"subscribe"} (native) AND {"method":"SUBSCRIBE"} (CCXT-style).
/api/v1/public/pingPing
Connectivity check. Returns an empty object on success.
/api/v1/public/timeServer Time
Server's current Unix epoch time in milliseconds. Use this if your local clock drifts more than 30s from ours (HMAC signature requests will be rejected outside that window).
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| serverTime | integer | Always | Server time, ms since epoch. |
/api/v1/public/exchangeInfoExchange Info
Exchange metadata + every active symbol with its trading filters (PRICE_FILTER, LOT_SIZE, NOTIONAL). Read this on startup; cache it for the session.
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| timezone | string | Always | Always "UTC". |
| serverTime | integer | Always | Server time, ms epoch. |
| rateLimits | array | Always | Documented IP/weight rate limits. |
| symbols | array | Always | Per-symbol info: status, base/quote asset + precision, supported orderTypes, filters. |
/api/v1/public/depthOrder Book Depth
Top-N bid/ask levels. bids are sorted highest-first, asks lowest-first. Each level is [price, quantity], both string-encoded.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Mandatory | Pair symbol (e.g. BTCUSDT). Uppercase. |
| limit | integer | Recommended | One of 5, 10, 20, 50, 100, 500, 1000. Default 20. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| lastUpdateId | integer | Always | Monotonic update counter — use to order consecutive snapshots. |
| bids | array | Always | [price, quantity] arrays, highest-price first. |
| asks | array | Always | [price, quantity] arrays, lowest-price first. |
/api/v1/public/tradesRecent Trades
Most recent trades (newest first). Includes the trade ID, fill price, quantity, and which side was the maker.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Mandatory | Pair symbol. |
| limit | integer | Recommended | 1..1000, default 500. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| id | integer | Always | Trade ID (monotonic per pair). |
| price | decimal | Always | Execution price. |
| qty | decimal | Always | Base-asset quantity. |
| quoteQty | decimal | Always | Quote-asset quantity (price × qty). |
| time | integer | Always | Trade time, ms epoch. |
| isBuyerMaker | boolean | Always | true = buyer was the resting maker (so taker sold). |
| isBestMatch | boolean | Always | Always true on our exchange (no aggregator inheritance). |
/api/v1/public/historicalTradesHistorical Trades (cursor)
Trade history with cursor pagination. Pass fromId to walk forward from a known ID.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Mandatory | Pair symbol. |
| limit | integer | Recommended | 1..1000, default 500. |
| fromId | integer | Optional | Return trades with id >= fromId (inclusive). Omit for newest-first. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| id | integer | Always | Trade ID. |
| price | decimal | Always | Execution price. |
| qty | decimal | Always | Base quantity. |
| quoteQty | decimal | Always | Quote quantity. |
| time | integer | Always | Trade time, ms epoch. |
| isBuyerMaker | boolean | Always | Same as /trades. |
/api/v1/public/klinesKlines (candles)
OHLCV candles for a symbol + interval. Returns oldest-first. Each row is the 12-element industry-standard array: [openTime, open, high, low, close, volume, closeTime, quoteVolume, trades, takerBuyBaseVolume, takerBuyQuoteVolume, ignore].
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Mandatory | Pair symbol. |
| interval | string | Mandatory | One of: 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w. |
| limit | integer | Recommended | 1..1000, default 500. |
| startTime | integer | Optional | Inclusive ms epoch. |
| endTime | integer | Optional | Inclusive ms epoch. |
/api/v1/public/ticker/24hr24h Ticker
Full 24h price/volume statistics. Returns one object when symbol is given, or an array of every active pair when omitted. Heavy endpoint when called without symbol (weight 40); prefer the WebSocket !ticker@arr stream for continuous updates.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Optional | Omit to fetch every pair. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| symbol | string | Always | Pair symbol. |
| lastPrice | decimal | Always | Most recent trade price. |
| priceChange | decimal | Always | Absolute 24h price change. |
| priceChangePercent | decimal | Always | 24h percent change. |
| openPrice | decimal | Always | Price 24h ago. |
| highPrice | decimal | Always | 24h high. |
| lowPrice | decimal | Always | 24h low. |
| bidPrice | decimal | Always | Best current bid. |
| askPrice | decimal | Always | Best current ask. |
| volume | decimal | Always | 24h base-asset volume. |
| quoteVolume | decimal | Always | 24h quote-asset volume. |
| openTime | integer | Always | Window start, ms epoch. |
| closeTime | integer | Always | Window end, ms epoch. |
| count | integer | Always | Trade count in the window. |
/api/v1/public/ticker/priceLast Price
Last trade price only. Lightest ticker endpoint. Returns one object or an array of all pairs.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Optional | Omit for all pairs. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| symbol | string | Always | Pair symbol. |
| price | decimal | Always | Last traded price. |
/api/v1/public/ticker/bookTickerBook Ticker
Best bid/ask + quantity only. Use this to spot quote when you don't need the full 24h stats.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Optional | Omit for all pairs. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| symbol | string | Always | Pair symbol. |
| bidPrice | decimal | Always | Best current bid. |
| bidQty | decimal | Always | Quantity at best bid. |
| askPrice | decimal | Always | Best current ask. |
| askQty | decimal | Always | Quantity at best ask. |
/api/v1/public/avgPriceAverage Price
Mean trade price over the last 5 minutes. Returns 404 if no trades occurred in that window.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Mandatory | Pair symbol. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| mins | integer | Always | Window length (always 5). |
| price | decimal | Always | Mean trade price. |
| closeTime | integer | Always | Computation time, ms epoch. |
/api/v1/public/summaryExchange Summary (CMC)
Per-pair summary in CoinMarketCap-compatible schema. Used by CMC's exchange-tracking integration.
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| trading_pairs | string | Always | Pair ID like BTC_USDT. |
| base_currency | string | Always | Base asset symbol. |
| quote_currency | string | Always | Quote asset symbol. |
| last_price | decimal | Always | Last trade price. |
| lowest_ask | decimal | Always | Best ask. |
| highest_bid | decimal | Always | Best bid. |
| base_volume | decimal | Always | 24h volume in base units. |
| quote_volume | decimal | Always | 24h volume in quote units. |
| price_change_percent_24h | decimal | Always | 24h percent change. |
| highest_price_24h | decimal | Always | 24h high. |
| lowest_price_24h | decimal | Always | 24h low. |
/api/v1/public/pairsPairs
Every active trading pair on the exchange. Used by aggregators to discover what is tradable before subscribing to ticker / orderbook / trade streams.
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| ticker_id | string | Always | Pair identifier with underscore delimiter (e.g. BTC_USDT). |
| base | string | Always | Base asset symbol. |
| target | string | Always | Quote asset symbol. |
/api/v1/public/tickersTickers
24-hour pricing and volume for every active pair. Polled by listing aggregators at ~1-minute intervals.
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| ticker_id | string | Always | Pair identifier with underscore delimiter. |
| base_currency | string | Always | Base asset symbol. |
| target_currency | string | Always | Quote asset symbol. |
| last_price | decimal | Always | Last traded price (string-encoded). |
| base_volume | decimal | Always | 24h single-sided volume in base units. |
| target_volume | decimal | Always | 24h single-sided volume in quote units. |
| bid | decimal | Conditional | Best bid; omitted when the book is empty or crossed. |
| ask | decimal | Conditional | Best ask; omitted when the book is empty or crossed. |
| high | decimal | Conditional | 24h high price; omitted when no trades. |
| low | decimal | Conditional | 24h low price; omitted when no trades. |
/api/v1/public/orderbookOrderbook (listing format)
Top-of-book depth for a single pair. Each entry is [price, quantity], both string-encoded for full precision.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| ticker_id | string | Mandatory | Pair identifier with underscore delimiter (e.g. BTC_USDT). |
| depth | integer | Recommended | Levels per side. Default 100, max 500. Pass 0 for full book (still capped at 500). |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| ticker_id | string | Always | Echoes the requested pair. |
| timestamp | integer | Always | Snapshot time (ms epoch). |
| bids | array | Always | [price, quantity] arrays sorted by price descending. Empty when no bids. |
| asks | array | Always | [price, quantity] arrays sorted by price ascending. Empty when no asks. |
/api/v1/public/historical_tradesHistorical Trades (listing format)
Recent trades for a pair, grouped by side. trade_id is the engine execution ID, never a unix timestamp.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| ticker_id | string | Mandatory | Pair identifier with underscore delimiter. |
| type | string | Optional | Filter to "buy" or "sell". Omit for both. |
| limit | integer | Recommended | Number of trades. Default 100, max 500. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| trade_id | string | Always | Engine-assigned execution identifier (not a timestamp). |
| price | decimal | Always | Execution price in target currency. |
| base_volume | decimal | Always | Amount in base units. |
| target_volume | decimal | Always | Amount in quote units. |
| trade_timestamp | integer | Always | Execution time (ms epoch). |
| type | string | Always | "buy": taker lifted an ask. "sell": taker hit a bid. |
/api/v1/trade/orderJWT or HMACPlace Order
Place a limit, market, stop-loss, or take-profit order. Both /api/v1/trade/order (singular, for CCXT-style libraries) and /api/v1/trade/orders/ (plural, used by the web UI) route to the same handler. Accepts both industry-standard and internal field names — the endpoint normalises before validation.
Body fields
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | Mandatory | Pair symbol, e.g. BTCUSDT. Internal alias: pair_symbol. |
| side | string | Mandatory | BUY or SELL (case-insensitive). Internal: lowercase buy/sell. |
| type | string | Mandatory | LIMIT, MARKET, STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT. Internal alias: order_type (lowercase). |
| quantity | decimal | Mandatory | Base-asset quantity. Internal alias: orig_qty. |
| price | decimal | Conditional | Required for LIMIT orders. Omit for MARKET. |
| timeInForce | string | Optional | GTC (default), IOC, or FOK. Internal alias: time_in_force. |
| stopPrice | decimal | Conditional | Trigger price; required for STOP_* and TAKE_PROFIT_* orders. Internal alias: stop_price. |
| quoteOrderQty | decimal | Conditional | Required for MARKET BUY (spend this much quote currency). Internal alias: quote_order_qty. |
| newClientOrderId | string | Optional | Client-supplied order ID (max 64 chars). Internal alias: client_order_id. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| id | integer | Always | Server-assigned order ID. |
| status | string | Always | new | partially_filled | filled | cancelled | rejected. |
| pair_symbol | string | Always | Pair (echoed). |
| side | string | Always | buy or sell. |
| order_type | string | Always | Order type. |
| orig_qty | decimal | Always | Original quantity. |
| executed_qty | decimal | Always | Filled so far. |
| price | decimal | Conditional | Order price (null for MARKET). |
| created_at | string | Always | ISO timestamp. |
curl
BODY='{"symbol":"BTCUSDT","side":"BUY","type":"LIMIT","quantity":"0.001","price":"50000","timeInForce":"GTC"}'
TS=$(date +%s000)
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 | awk '{print $2}')
MSG="${TS}POST/api/v1/trade/order${BODY_HASH}"
SIG=$(printf '%s' "$MSG" | openssl dgst -sha256 -hmac "$NIOX_API_SECRET" | awk '{print $2}')
curl -X POST https://api.niotx.com/api/v1/trade/order \
-H "X-API-Key: $NIOX_API_KEY" \
-H "X-Timestamp: $TS" \
-H "X-Signature: $SIG" \
-H "Content-Type: application/json" \
-d "$BODY"/api/v1/trade/orders/{order_id}/JWT or HMACCancel Order
Cancel an open order by its server-assigned ID. The singular alias /api/v1/trade/order/{order_id} resolves to the same view.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| order_id | integer | Mandatory | Order ID from the create response. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| id | integer | Always | Order ID. |
| status | string | Always | cancelled (or partially_filled if already partially filled). |
/api/v1/trade/orders/open/JWT or HMACOpen Orders
Your currently open orders (status = new or partially_filled). Paginated.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pair | string | Optional | Filter to a specific pair (e.g. BTCUSDT). |
| page | integer | Optional | Page number, default 1. |
| page_size | integer | Optional | Page size, default 10. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| results | array | Always | Array of order objects. |
| current_page | integer | Always | Current page (1-based). |
| total_pages | integer | Always | Total page count. |
| total_count | integer | Always | Total open-order count. |
/api/v1/trade/orders/history/JWT or HMACOrder History
Filled, cancelled, and rejected orders. Same pagination as open orders.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pair | string | Optional | Filter by pair. |
| page | integer | Optional | Page, default 1. |
| page_size | integer | Optional | Default 10. |
/api/v1/trade/fills/JWT or HMACTrade Fills
Individual fill records (one per match). Use this to compute realized P&L per trade.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pair | string | Optional | Filter by pair. |
| page | integer | Optional | Page, default 1. |
/api/v1/accounts/profile/JWT onlyMy Profile
Your account profile: email, base currency, total balance, KYC status, 2FA status.
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| id | integer | Always | User ID. |
| string | Always | Account email. | |
| is_active | boolean | Always | Account active. |
| base_currency | string | Always | Display currency (e.g. USDT). |
| total_balance | decimal | Always | Total balance in base currency. |
| is_totp | boolean | Always | Whether 2FA is enabled. |
| is_kyc_verified | boolean | Always | KYC status. |
/api/v1/accounts/apiKeys/JWT onlyCreate API Key
Issue a new API key. The plaintext `secret` is returned in this response exactly once — save it immediately. After this, only the public `key` is ever returned. Granting `can_withdraw: true` requires submitting a current TOTP code in the same request.
Body fields
| Name | Type | Required | Description |
|---|---|---|---|
| label | string | Mandatory | Free-text name, max 100 chars. Just for your own reference. |
| can_read | boolean | Optional | Account info, balances, order history. Default true. |
| can_trade | boolean | Optional | Place and cancel orders. Default false. |
| can_withdraw | boolean | Optional | Initiate withdrawals. Requires totp_code AND 2FA enabled on the account. Default false. |
| ip_whitelist | array | Optional | Array of allowed source IPs (e.g. ["1.2.3.4"]). Empty array = any IP. |
| totp_code | string | Conditional | Current 6-digit TOTP code. Required ONLY when can_withdraw is true. |
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| id | integer | Always | Server-assigned key ID. |
| key | string | Always | Public key id (niox_pk_…). Safe to log. |
| secret | string | Always | Plaintext secret (niox_sk_…). SHOWN ONCE. Never returned again. |
| label | string | Always | Echoed from request. |
| permissions | array | Always | Array of granted permissions: ["read", "trade", "withdraw"]. |
| ip_whitelist | array | Always | Echoed. |
| warning | string | Always | "Save your secret now. It will not be shown again." |
/api/v1/accounts/apiKeys/JWT onlyList API Keys
All your API keys. Secrets are never returned — use them from your own records.
Response fields
| Name | Type | Presence | Description |
|---|---|---|---|
| id | integer | Always | Key ID. |
| key | string | Always | Public key id. |
| label | string | Always | Your label. |
| permissions | array | Always | Granted permissions. |
| ip_whitelist | array | Always | Allowed IPs. |
| is_active | boolean | Always | Disabled keys still appear in the list. |
| last_used_at | string | Conditional | ISO timestamp; null if never used. |
| last_used_ip | string | Conditional | IP of the last request; null if never used. |
| created_at | string | Always | When the key was issued. |
/api/v1/accounts/apiKeys/{key_id}/JWT onlyUpdate API Key
Update label, IP whitelist, or permissions. Granting `can_withdraw: true` (turning it on for a key that was previously without it) requires a TOTP code.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| key_id | integer | Mandatory | Key ID from create/list response. |
Body fields
| Name | Type | Required | Description |
|---|---|---|---|
| label | string | Optional | New label. |
| can_read | boolean | Optional | Toggle read permission. |
| can_trade | boolean | Optional | Toggle trade permission. |
| can_withdraw | boolean | Optional | Toggle withdraw permission. Requires totp_code if granting (false→true). |
| ip_whitelist | array | Optional | Replace the IP whitelist entirely. |
| is_active | boolean | Optional | Disable a key without deleting it. |
| totp_code | string | Conditional | Required when granting can_withdraw. |
/api/v1/accounts/apiKeys/{key_id}/JWT onlyRevoke API Key
Permanently revoke a key. The deletion is immediate — any in-flight request signed with this key will start failing within seconds.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| key_id | integer | Mandatory | Key ID to revoke. |
One WSS connection multiplexes many streams. Subscribe via JSON after connect, or pass ?streams=foo/bar in the URL for instant subscription. Up to 30 streams per connection; the server auto-closes after 24 hours (clients should reconnect).
Subscribe
{"method":"SUBSCRIBE","params":["btcusdt@trade","btcusdt@depth"],"id":1}Unsubscribe
{"method":"UNSUBSCRIBE","params":["btcusdt@trade"],"id":2}Connect via wscat
wscat -c "wss://ws.niotx.com/ws/v1/stream?streams=btcusdt@trade/btcusdt@depth"
<symbol>@tradeTrade
Individual trades as they execute. Carries the trade ID `t` for client-side dedup. The high-water mark guarantees each trade is emitted at most once per connection.
Subscribe param
btcusdt@trade
Event fields
| Name | Type | Presence | Description |
|---|---|---|---|
| e | string | Always | "trade". |
| E | integer | Always | Event time, ms epoch. |
| s | string | Always | Pair symbol, uppercase. |
| t | integer | Always | Trade ID (monotonic per pair, resets on engine restart). |
| p | decimal | Always | Execution price. |
| q | decimal | Always | Base quantity. |
| T | integer | Always | Trade time, ms epoch. |
| m | boolean | Always | true = buyer was the maker. |
Example message
{
"stream": "btcusdt@trade",
"data": {
"e": "trade",
"E": 1779011120306,
"s": "BTCUSDT",
"t": 70141750,
"p": "78156.03",
"q": "0.000497",
"T": 1779011120306,
"m": false
}
}<symbol>@ticker24h Ticker
Full 24h rolling ticker. Fires once per real trade (≈5/s on active pairs).
Subscribe param
btcusdt@ticker
Event fields
| Name | Type | Presence | Description |
|---|---|---|---|
| e | string | Always | "24hrTicker". |
| E | integer | Always | Event time, ms epoch. |
| s | string | Always | Pair symbol. |
| c | decimal | Always | Last trade price. |
| o | decimal | Always | Open price (24h ago). |
| h | decimal | Always | 24h high. |
| l | decimal | Always | 24h low. |
| v | decimal | Always | 24h base-asset volume. |
| q | decimal | Always | 24h quote-asset volume. |
| p | decimal | Always | Absolute price change. |
| P | decimal | Always | Percent price change. |
| b | decimal | Always | Best bid. |
| a | decimal | Always | Best ask. |
| n | integer | Always | 24h trade count. |
Example message
{"stream":"btcusdt@ticker","data":{"e":"24hrTicker","E":1779011200000,"s":"BTCUSDT","c":"78119.71","o":"78100.69","h":"78369.88","l":"77654.50","v":"94.32","q":"7367633.28","p":"19.02","P":"0.0244","b":"78097.06","a":"78143.94","n":19896}}<symbol>@miniTickerMini Ticker
Lightweight 24h subset — close, open, high, low, volume. No bid/ask, no count.
Subscribe param
btcusdt@miniTicker
Event fields
| Name | Type | Presence | Description |
|---|---|---|---|
| e | string | Always | "24hrMiniTicker". |
| E | integer | Always | Event time, ms epoch. |
| s | string | Always | Pair symbol. |
| c | decimal | Always | Last price. |
| o | decimal | Always | Open price. |
| h | decimal | Always | 24h high. |
| l | decimal | Always | 24h low. |
| v | decimal | Always | 24h base volume. |
| q | decimal | Always | 24h quote volume. |
Example message
{"stream":"btcusdt@miniTicker","data":{"e":"24hrMiniTicker","E":1779011200000,"s":"BTCUSDT","c":"78119.71","o":"78100.69","h":"78369.88","l":"77654.50","v":"94.32","q":"7367633.28"}}<symbol>@bookTickerBook Ticker
Best bid/ask + quantity only. The lightest live-quote stream.
Subscribe param
btcusdt@bookTicker
Event fields
| Name | Type | Presence | Description |
|---|---|---|---|
| e | string | Always | "bookTicker". |
| u | integer | Always | Book update ID. |
| s | string | Always | Pair symbol. |
| b | decimal | Always | Best bid price. |
| B | decimal | Always | Best bid quantity. |
| a | decimal | Always | Best ask price. |
| A | decimal | Always | Best ask quantity. |
Example message
{"stream":"btcusdt@bookTicker","data":{"e":"bookTicker","u":1779011200,"s":"BTCUSDT","b":"78097.06","B":"0.045","a":"78143.94","A":"0.038"}}<symbol>@depth | <symbol>@depth@100ms | <symbol>@depth@1000msOrder Book Depth (full)
Full top-20 orderbook snapshot. Optional cadence suffix: @100ms or @1000ms.
Subscribe param
btcusdt@depth
Event fields
| Name | Type | Presence | Description |
|---|---|---|---|
| s | string | Always | Pair symbol. |
| bids | array | Always | Top-20 bids: [price, quantity] highest-first. |
| asks | array | Always | Top-20 asks: [price, quantity] lowest-first. |
| lastUpdateId | integer | Always | Monotonic update counter. |
Example message
{"stream":"btcusdt@depth","data":{"s":"BTCUSDT","bids":[["78097.06","0.04"]],"asks":[["78143.94","0.03"]],"lastUpdateId":1779011200}}<symbol>@depth5 | <symbol>@depth10 | <symbol>@depth20Order Book Depth (partial)
Partial-book snapshot. The server slices the full top-20 to your requested level count before sending — useful for bandwidth-sensitive clients.
Subscribe param
btcusdt@depth5
Event fields
| Name | Type | Presence | Description |
|---|---|---|---|
| s | string | Always | Pair symbol. |
| bids | array | Always | Top N bids (5/10/20). |
| asks | array | Always | Top N asks (5/10/20). |
| lastUpdateId | integer | Always | Monotonic counter (shared with full @depth). |
Example message
{"stream":"btcusdt@depth5","data":{"s":"BTCUSDT","bids":[…5 levels…],"asks":[…5 levels…],"lastUpdateId":1779011200}}<symbol>@kline_<interval>Kline / Candle
Live updates for the current candle. Intervals: 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w.
Subscribe param
btcusdt@kline_1m
Event fields
| Name | Type | Presence | Description |
|---|---|---|---|
| e | string | Always | "kline". |
| E | integer | Always | Event time, ms epoch. |
| s | string | Always | Pair symbol. |
| k | object | Always | Kline object: {t, T, s, i, o, c, h, l, v, q, n, x} — open/close time, interval, OHLCV, trade count, is_closed flag. |
Example message
{"stream":"btcusdt@kline_1m","data":{"e":"kline","E":1779011200000,"s":"BTCUSDT","k":{"t":1779011160000,"T":1779011219999,"s":"BTCUSDT","i":"1m","o":"78100","c":"78120","h":"78130","l":"78090","v":"0.5","q":"39062.5","n":3,"x":false}}}!ticker@arrAll Tickers
Array of every pair's 24h ticker in a single message. Fires once every 5 seconds.
Subscribe param
!ticker@arr
Event fields
| Name | Type | Presence | Description |
|---|---|---|---|
| e | string | Always | "allMiniTickers". |
| E | integer | Always | Event time, ms epoch. |
| tickers | array | Always | Array of per-pair ticker objects (s, c, o, h, l, v, q, P). |
Example message
{"stream":"!ticker@arr","data":{"e":"allMiniTickers","E":1779011200000,"tickers":[{"s":"BTCUSDT","c":"78119.71",...},{"s":"ETHUSDT","c":"2222.47",...}]}}!miniTicker@arrAll Mini Tickers
Same cadence as !ticker@arr but with the mini-ticker subset only.
Subscribe param
!miniTicker@arr
Event fields
| Name | Type | Presence | Description |
|---|---|---|---|
| e | string | Always | "allMiniTickers". |
| E | integer | Always | Event time, ms epoch. |
| tickers | array | Always | Array of mini-ticker objects. |
Example message
{"stream":"!miniTicker@arr","data":{"e":"allMiniTickers","E":1779011200000,"tickers":[…]}}Errors
Public market-data endpoints use the industry-standard{code, msg} shape with negative integer codes:
| Code | HTTP | Meaning |
|---|---|---|
| -1100 | 400 | Illegal characters in a parameter. |
| -1102 | 400 | Mandatory parameter missing or empty. |
| -1121 | 400 | Invalid symbol. |
| -1130 | 400 | Invalid value for parameter. |
| — | 401 | HMAC signature failed, key disabled/expired, or IP not whitelisted. |
| — | 403 | Permission denied (e.g. API key lacks trade). |
| — | 429 | Rate limit exceeded. Back off and retry. |
Trading endpoints use DRF's standard{error, message, details} shape on 4xx responses.