What this stream gives you. Open one HTTP connection and the server keeps it open, pushing each contract’s latest price, every new bid, and every trade as they happen. It uses server-sent events: a browser reads it with
EventSource, and any HTTP client can read it line by line.Request
Send
symbols, events, or both; duplicates are removed. A connection can carry up to 200 contracts, counted after events are expanded.
Event IDs come from Search with type=events, or from a contract’s eventId. Get Event Contracts lists the contracts an event expands to. An event is expanded once, when you connect: a contract listed under it later is not added until you reconnect.
Events
ForecastEx takes buy orders only. Every order is a bid, for YES or for NO, so there is no ask.
A
: ping comment is sent every 15 seconds to keep idle connections open.
subscribed
events is present only when you asked for events.
snapshot
The venue reports a contract’s last trade without saying which outcome it was for. The snapshot reads it as the YES price and sets NO to
1.00 minus it. After the first live trade, yes and no come from tagged trades.
bid
bid event does not mean the order is still resting.
trade
trade events with the same tradeId: one for each outcome, at prices that add up to 1.00. Count matches by tradeId, not by event.
stats
stats replaces the last. A match usually sends two: volume and notional change with the trade, and open interest follows. A new last price on its own sends no stats, because the trade events already carry it.
Contracts from events
For a contract you subscribed to throughevents, every snapshot, bid, trade, stats, and gap also carries eventId:
Ordering
- For each contract,
snapshotcomes first, and nothing else is sent for that contract before it. - After that,
bid,trade, andstatsarrive in the order the venue sent them, and a match’s two trades come before thestatsthey moved. - Events for different contracts interleave.
Reconnecting
Events have no IDs and are not replayed. When you reconnect, asEventSource does on its own, you receive a new subscribed and a fresh snapshot for every contract. Bids and trades sent while you were disconnected are lost, but the snapshot’s prices and statistics show where the market is now.
Examples
cURL
Browser
Working with the stream
- Prices are decimal strings.
"0.53", not0.53. Parse them with a decimal type. - A missing value is
null, not zero. Anulllast price means the outcome has not traded. - Do not put the stream behind a buffering proxy. Events must reach you as they are sent.
Errors
Errors are returned before the stream opens, in the usual error envelope:
An unknown symbol is not an error. It never receives a snapshot.