Ticker
Channel Name
spot:ticker:{symbol}
Authentication: not required (public channel).
Description
Provides a rolling 24-hour statistics snapshot on subscribe, then pushes an updated snapshot on every fill. Each push is a complete replacement — no incremental math is needed on the client side.
Subscribe
Send:
{ "type": "subscribe", "channel": "spot:ticker:DFUSDT" }
Response:
{ "type": "subscribed", "channel": "spot:ticker:DFUSDT" }
A spot_ticker snapshot is sent immediately after the ack (identical format to subsequent live pushes).
Push Format
spot_ticker
Used for both the initial snapshot on subscribe and all subsequent live updates. The format is identical in both cases — no separate spot_ticker_snapshot type exists.
{
"type": "spot_ticker",
"channel": "spot:ticker:DFUSDT",
"data": {
"symbol": "DFUSDT",
"last_price": "0.5000",
"open_price": "0.4800",
"high": "0.5100",
"low": "0.4700",
"volume": "10000",
"quote_volume": "5000",
"trade_count": 234,
"open_time": 1778313600,
"close_time": 1778400000,
"ts": 1778400000
}
}
| Field | Type | Description |
|---|---|---|
symbol | string | Market identifier. |
last_price | string (decimal) | Price of the most recent fill. |
open_price | string (decimal) | Price of the first fill in the 24 h window (open_time). |
high | string (decimal) | Highest fill price in the 24 h window. |
low | string (decimal) | Lowest fill price in the 24 h window. |
volume | string (decimal) | Total base volume (DF) in the 24 h window. |
quote_volume | string (decimal) | Total quote volume (USDT) in the 24 h window. |
trade_count | integer | Number of fills in the 24 h window. |
open_time | integer | Start of the 24 h window — unix seconds (≈ now − 86 400). |
close_time | integer | End of the 24 h window — unix seconds (≈ now). |
ts | integer | When this snapshot was computed — unix seconds. |
All timestamps are unix seconds. The 24 h window is [now − 86 400, now] (rolling, not calendar-aligned).
Update Cadence
A spot_ticker push is sent on every fill — immediately after the matching engine records the cross. There is no periodic push: a background task does recompute the 24 h statistics in the database every 60 seconds (handling trades that fall out of the window), but it does not emit a WebSocket frame. During a quiet period with no fills, no pushes arrive — poll GET /spot/ticker/24hr if you need the decayed window statistics without waiting for the next trade.
Because each push is a complete snapshot, a missed push is harmlessly overwritten by the next one. No resync logic is needed.
Code Example
const ws = new WebSocket('wss://api.prex.world/ws');
ws.onopen = () => {
ws.send(JSON.stringify({ type: 'subscribe', channel: 'spot:ticker:DFUSDT' }));
setInterval(() => ws.send(JSON.stringify({ type: 'ping' })), 30000);
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type === 'spot_ticker') {
const d = msg.data;
// Update your UI header stats
renderTicker({
lastPrice: d.last_price,
change24h: ((parseFloat(d.last_price) - parseFloat(d.open_price)) / parseFloat(d.open_price) * 100).toFixed(2) + '%',
high24h: d.high,
low24h: d.low,
volume24h: d.volume,
});
}
};
function renderTicker(stats) {
console.log(`Last: ${stats.lastPrice} Change: ${stats.change24h} High: ${stats.high24h} Low: ${stats.low24h} Vol: ${stats.volume24h}`);
}