> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metastreams.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# REST reads and their streams

> Which stream replaces polling which endpoint, and how to combine a snapshot with live updates.

Every REST read that changes over time has a stream that pushes the same objects. A streamed candle or token has exactly the shape the REST endpoint returns. A streamed trade has the REST trade shape, minus some fields per subscription mode: see [`spot.trades`](/reference/streams/spot-trades#update).

| Instead of polling | Subscribe to | With filters |
| - | - | - |
| `GET /v1/tokens/{chain}/{address}` | [`spot.tokens`](/reference/streams/spot-tokens) | `chain`, `tokens` |
| `GET /v1/tokens/{chain}/{address}/ohlcv` | [`spot.candles`](/reference/streams/spot-candles) | `chain`, `token`, `timeframe`, `metric`, `denomination` |
| `GET /v1/tokens/{chain}/{address}/trades` | [`spot.trades`](/reference/streams/spot-trades) | `chain`, `token`, optional `flags` |
| `GET /v1/trades?identity=kol` | [`spot.trades`](/reference/streams/spot-trades) | `identity`, optional `flags` |

A stream costs no request budget after its handshake, so it is the cheaper way to follow anything that changes more than once a minute.

## Snapshot, then stream

A stream sends only what happens after you subscribe. To show a complete view, combine the two:

1. **Subscribe first,** and buffer the updates that arrive.
2. **Read the snapshot** from the REST endpoint.
3. **Apply the buffered updates** on top of the snapshot, then apply new updates as they arrive.

Subscribing before you read means nothing that happens between the two calls is lost.

### Merging without duplicates

| Object | Match on | Rule |
| - | - | - |
| Trade | `id` | Skip an update whose `id` you already have. Keep the REST copy, which carries `flags` and `platforms`. |
| Candle | `time` | Replace the candle with the same `time`; append a new one. |
| Token | `chain` + `address` | Keep the object with the later `updatedAt`. |

## After a reconnect

Subscriptions end when a connection closes. When you reconnect:

1. Resubscribe, and buffer updates again.
2. Re-read the REST endpoint to cover the gap: the latest trades, or candles with `to` left out.
3. Merge with the rules above.

See [Connecting to streams](/streams/overview#when-the-server-closes-the-connection) for close codes and a reconnect loop.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.