Streaming
GET /v2/stream keeps one HTTP connection open and sends each new trade and market move the moment it lands. Each frame has the same shape as a row from List Trades or List Moves. Rivo applies your filters before it sends anything, so you receive only what you asked for.
curl -N "https://api.rivo.markets/v2/stream?channels=trades&venue=kalshi&minWinRate=0.6" \
-H "Authorization: Bearer $RIVO_API_KEY"Frames
| Event | Carries |
|---|---|
trade | One trade, in the same shape as a /v2/trades row. |
move | One market move, in the same shape as a /v2/moves row. |
error | An object with code and error. Rivo sends it just before it closes the stream, for example when you have used up the day's trades. |
: ping | A comment line that Rivo sends every 25 seconds so proxies keep the connection open. You can ignore it. |
One market, everything on it
The market filter applies to both channels. Send ?market=<ref> to receive every trade and every move on one market over a single connection. Repeat market to watch up to 50 markets.
Reconnecting
A connection lasts at most 15 minutes, and it also drops when we deploy, when a network fails, or when a laptop goes to sleep. Every trade frame carries an id. Save the last one you handled, and send it back as the Last-Event-ID header when you reconnect. The stream first sends the trades you missed, from the last hour and with the same filters, then carries on live. A browser EventSource does this on its own.
let lastEventId: string | null = null;
async function connect(): Promise<void> {
const res = await fetch(`https://api.rivo.markets/v2/stream?venue=kalshi&channels=trades`, {
headers: { ...headers, ...(lastEventId ? { "Last-Event-ID": lastEventId } : {}) },
});
// Read frames from res.body. On each trade frame: lastEventId = the frame's id line.
// When the body ends or fails, wait a second or two, then call connect() again.
}Without a saved id, pass since with the time of the last trade you handled instead. Remove duplicates by id, because a trade from the same moment as the last one can arrive twice. For a gap longer than an hour, or more than 200 trades, page List Trades with since.
Live dashboards
Keep one stream open on your server and reconnect it with Last-Event-ID, rather than polling /v2/trades. If you do poll, set since to a time within the last hour: those reads never count toward your daily trade allowance.
Limits
- Each account can hold three streams open at once across its keys, including any on
/v1/stream. Opening a fourth closes the oldest, which receives anerrorevent with codeSTREAM_REPLACED. - An open stream counts as one request a minute.
- Trades the stream sends do not count toward your daily trade allowance.
The Stream reference lists every parameter and shows a full client in three languages.