Push, don't poll
Two public SSE endpoints carry every price update and trade in real time — the same streams the site renders.
GET /tokens/stream — global ticks
One event per token that traded in an indexer sync, plus a coarse-grained refresh signal. This is the stream behind the discover and portfolio lists.
| Event | Fires | Payload |
|---|---|---|
| tick | Per token per sync that saw a trade | PriceTick — the token's latest price state |
| refresh | Once per sync that wrote trades | A signal to re-fetch /tokens — cheaper than polling the list |
- tick
- Fires
- Per token per sync that saw a trade
- Payload
- PriceTick — the token's latest price state
- refresh
- Fires
- Once per sync that wrote trades
- Payload
- A signal to re-fetch /tokens — cheaper than polling the list
curl -N https://api.vectr.bot/tokens/streamGET /tokens/:address/stream — per-token candles
Streams one token's trades as they index and maintains the candle for the requested resolution. The stream behind the token-page chart.
| Event | Payload |
|---|---|
| bar | The current bucket's OHLCV, updated in place as trades land |
| trade | The raw trade that moved the bar |
| reset | Sent on connect/resume — drop local state and rebuild from what follows |
- bar
- Payload
- The current bucket's OHLCV, updated in place as trades land
- trade
- Payload
- The raw trade that moved the bar
- reset
- Payload
- Sent on connect/resume — drop local state and rebuild from what follows
| Param | Default | Notes |
|---|---|---|
| res | 5m | 1m | 5m | 15m | 1h | 4h | 1d — anything else falls back to 5m |
| from | — | Unix seconds; replay bars from that point before going live |
| Last-Event-ID | — | Request header — resume a dropped connection without a gap |
- res
- Default
- 5m
- Notes
- 1m | 5m | 15m | 1h | 4h | 1d — anything else falls back to 5m
- from
- Default
- —
- Notes
- Unix seconds; replay bars from that point before going live
- Last-Event-ID
- Default
- —
- Notes
- Request header — resume a dropped connection without a gap
const es = new EventSource("https://api.vectr.bot/tokens/0x…/stream?res=1m");
es.addEventListener("bar", (e) => {/* update the current candle */});
es.addEventListener("trade", (e) => {/* append to the tape */});
es.addEventListener("reset", (e) => {/* clear local state */});Conventions worth knowing
Bars share the REST candle conventions: bucket = floor(ts / resolution), quiet buckets are flat at the previous close, volume is quote-asset notional. The same math serves REST, live streams and reconnect replay — a bar means the same thing on every path.
SSE, not WebSocket
These are plain server-sent events — one connection, server→client only. Any HTTP client that holds the connection open works; there is no socket protocol to implement.