Skip to main content

Realtime & WebSocket API Reference

The Realtime API streams live 1-minute market ticks over WebSockets via TradingView bridge connections and Redis Pub/Sub, and exposes high-speed quote REST snapshots.


WS /ws/realtime/{ticker}

Open a persistent WebSocket streaming channel for real-time tick updates on a given ticker.

Connection Protocol

const ws = new WebSocket("ws://localhost:5000/ws/realtime/AIR.PA");

Event Messages

Upon connection, the server sends a initial snapshot message followed by real-time tick events:

Initial Snapshot Event

{
"type": "snapshot",
"ticker": "AIR.PA",
"data": {
"close": 135.90,
"open": 134.20,
"high": 136.50,
"low": 133.80,
"volume": 1245000,
"timestamp": "2026-08-11T10:15:00Z"
}
}

Live Tick Event

{
"type": "tick",
"ticker": "AIR.PA",
"data": {
"close": 136.10,
"change": 0.20,
"change_pct": 0.147,
"volume": 1246500,
"timestamp": "2026-08-11T10:16:00Z"
}
}

GET /quote/{ticker}

Retrieve the latest price quote snapshot from the Redis volatile cache. Auto-triggers realtime stream subscription if REALTIME_AUTO_SUBSCRIBE=true.

Parameters

ParameterTypeRequiredDefaultDescription
tickerstringTicker symbol (e.g. AAPL)

Response Example

{
"ticker": "AAPL",
"price": 224.50,
"open": 222.10,
"high": 225.00,
"low": 221.80,
"volume": 45200000,
"change": 2.40,
"change_pct": 1.08,
"source": "tradingview_stream",
"timestamp": "2026-08-11T10:15:30Z"
}

GET /quotes

Batch quote snapshot retrieval for multiple tickers.

Parameters

ParameterTypeRequiredDefaultDescription
tickersstringComma-separated list of tickers (e.g. AAPL,MSFT,TSLA)

POST /realtime/subscribe

Explicitly subscribe a ticker to the background streaming worker RealtimePriceWorker.

Request Body

{
"ticker": "NVDA"
}

DELETE /realtime/subscribe/{ticker}

Unsubscribe a ticker from background live streaming.


GET /realtime/status

List all active market streaming worker subscriptions.

Response Example

{
"active_subscriptions": 3,
"subscriptions": [
{
"ticker": "AIR.PA",
"subscribed_at": "2026-08-11T08:00:00Z",
"last_tick_at": "2026-08-11T10:15:30Z",
"tick_count": 1350
}
]
}