SSE

The live feed

GET https://zealous.markets/api/v1/streams/{exchange}/{base}/{quote}/sse

Use the same public zealous.markets/api/v1 surface as the rest of the API.

shell
curl -N \
-H "Authorization: Bearer $ZM_KEY" \
-H "Accept: text/event-stream" \
"https://zealous.markets/api/v1/streams/coinbase/BTC/USD/sse?metrics=trade,book"

Opens a Server-Sent Events stream of bars as they close. Authenticate with the same zm_live_* key — pass it in Authorization: Bearer or X-Api-Key.

The public gateway emits an immediate stream-open control event when the connection is accepted, before any seed or live market-data events arrive. This confirms the stream is open even if the pair has not published a fresh bar yet.

typescript
const es = new EventSource(
'https://zealous.markets/api/v1/streams/coinbase/BTC/USD/sse?metrics=trade,book',
// EventSource can't set headers in the browser — see "Authentication" below.
);
es.addEventListener('trade-bar-close', (e) => console.log(JSON.parse(e.data)));
es.addEventListener('book-bar-close', (e) => console.log(JSON.parse(e.data)));
es.addEventListener('book-snapshot', (e) => console.log(JSON.parse(e.data)));
es.addEventListener('scheme-event', (e) => console.log(JSON.parse(e.data)));

Events

EventPayload
stream-openControl frame confirming the public gateway accepted the connection for this pair.
trade-bar-closeOne Bar with the trade fields populated.
book-bar-closeOne Bar with the book fields populated (BBO + cancel aggregates).
book-snapshotOne BookSnapshot (BBO + up to 20 L2 depth levels per side). Emitted alongside book-bar-close from the same upstream entry.
scheme-eventOne SchemeHistoryEvent — a flagged spoofing scheme (flipping, vacuuming, or layering) as it is detected.
errorTerminal frame — the stream is closing after repeated upstream failures.

?metrics= is a comma-separated subset of trade,book,quote (default: all three). On connect, the most recent bar of each requested metric is replayed as a seed event so a fresh subscriber renders immediately.

Authentication

EventSource in the browser cannot set request headers. For browser clients, proxy the SSE connection through your own server (which holds the key), or use a fetch-based SSE client that supports headers. Server-side consumers pass the Authorization header directly to this same public /api/v1/.../sse endpoint.

The connection is gated by the same auth/plan/quota checks as every other endpoint — an unauthorized request is rejected before any upstream connection is opened.

Billing and limits

  • Opening a stream is not charged against your monthly request or byte quota.
  • There is no cap on simultaneous streams — live streaming is billed per pair, and abusive volume is handled at the infrastructure edge.
  • A pair you are not entitled to (unsubscribed, or lapsed payment) is rejected at connect with 402 payment_required.

See Quotas for the full accounting.