?>
ESC to close

Real-Time Stock Quotes WebSocket API

Last updated:

Stream real-time stock quotes over a persistent WebSocket connection. Each message delivers the latest price, open, high, low, close, volume, percent change, and market session for every subscribed ticker as trades happen. Subscribe to any ticker mix within your plan limit, add or remove symbols mid-session with unsubscribe, and get the current price state for each ticker instantly on subscribe. Free to use.

WSS wss://stream.businessquant.com?api-key={api_key}

Related endpoints: Use the List of Securities API to enumerate valid tickers before subscribing. For historical EOD and intraday prices, see the Stock Quotes API.

WebSocket API Capabilities

One persistent connection streams live ticks for all your subscribed tickers simultaneously — no polling, no per-ticker HTTP requests, no stitching responses together.

Live Price Updates

Every trade triggers a price update pushed instantly over your open connection — open, high, low, close, and volume are delivered in each message as they happen.

Price State on Connect

On subscribe, the server immediately sends the current price state for each requested ticker before live ticks begin — your display is populated on connect, not after the next trade.

Dynamic Subscriptions

Add or remove tickers at any time during an open session by sending a new subscribe or unsubscribe action — no need to reconnect or restart.

Pre & After-Hours Coverage

Quotes arrive across all four sessions — pre-market, regular hours, after-hours, and extended. Every message includes a marketHours flag so you can filter or label by session in your application.

Same Auth as REST API

Authentication uses the same API key as all other Business Quant endpoints — no separate credentials, no additional sign-up. Pass your key as a URL query parameter on connect.

Plan-Based Ticker Limits

Ticker limits scale with your plan tier — from 2 tickers on the entry plan to 5,000 on the highest tier. If you exceed your limit, the connection stays open and the server returns an error; simply resend a smaller list.

1. Connecting & Authentication

Open a WebSocket connection to the stream endpoint and pass your API key as the api-key query parameter in the connection URL. Authentication is evaluated at the moment the handshake is made — an invalid or expired key closes the socket immediately with an error message before any data flows.

ParameterDescription
api-key
Required URL Query Parameter
Your Business Quant API key. Passed in the WebSocket handshake URL — not in a message body after connecting.
Format: ?api-key=YOUR_API_KEY

One connection per API key. Opening a second connection while one is already active returns a connection_limit_reached error and closes the new socket. Close the existing connection first, or use the unsubscribe action to change your ticker list without reconnecting.

Connection URL
wss://stream.businessquant.com?api-key=YOUR_API_KEY

2. Subscribing to Tickers

After connecting, send a JSON message with action: "subscribe" and an array of ticker symbols. The server immediately sends the current price state for each requested ticker, then streams live ticks as trades arrive. You can send a new subscribe message at any point to add more tickers — up to your plan's limit across the entire session.

Subscribe Message
{
    "action": "subscribe",
    "tickers": [
        "AAPL",
        "MSFT",
        "GOOGL"
    ]
}
Unsubscribe Message
{
    "action": "unsubscribe",
    "tickers": [
        "GOOGL"
    ]
}
Server Confirmation
{
    "status": "subscribed",
    "tickers": [
        "AAPL",
        "MSFT",
        "GOOGL"
    ]
}

Plan Ticker Limits

Plan TierMax Tickers per Connection
Entry2
Basic10
Pro200
Enterprise5,000

Exceeding your limit returns a ticker_limit_exceeded error message and keeps the connection open — you can immediately resend a smaller list without reconnecting.

3. Quote Message Schema

Each message from the server carries the latest price quote for one ticker. The close field reflects the most recent trade price and updates on every incoming trade. The open, high, and low fields reflect the day's range as reported by the exchange.

FieldDescription
ticker Ticker symbol of the security (e.g. AAPL).
timestamp Timestamp of the price update in Eastern Time. Format: YYYY-MM-DD HH:MM:00.
open Opening price for the current trading session.
high Highest trade price of the day. Updates as new highs are reached.
low Lowest trade price of the day. Updates as new lows are reached.
close Most recent trade price — updated on every incoming trade. This is the primary "live price" field.
volume Cumulative day volume (all sessions) as reported by the exchange. Integer.
change_pct Percentage change from the previous session's closing price. Float — e.g. 0.8734 means +0.87%.
change Dollar change from the previous session's closing price. Float.
marketHours Integer indicating the active trading session. See the Market Session Reference table in Section 4 for values.
Sample Quote Message — AAPL
{
    "ticker": "AAPL",
    "timestamp": "2026-06-08 14:32:00",
    "open": 195.2,
    "high": 196.85,
    "low": 194.1,
    "close": 196.42,
    "volume": 34521800,
    "change_pct": 0.8734,
    "change": 1.7,
    "marketHours": 1
}

4. Market Session Reference

The marketHours integer in every quote message identifies which trading session the trade occurred in. Use this to conditionally render session labels, apply session-specific styling, or filter out sessions you don't need.

ValueSessionHours (Eastern Time)
0 PRE Pre-market  ·  4:00 AM – 9:30 AM EST
1 MKT Regular market hours  ·  9:30 AM – 4:00 PM EST
2 POST After-hours  ·  4:00 PM – 8:00 PM EST
3 EXT Extended hours

5. Error & Status Messages

All messages from the server are JSON objects. System confirmations carry a status key. Errors carry an error key and a human-readable detail string. Auth errors close the connection immediately after sending the message; operational errors (like exceeding your ticker limit) leave the connection open.

Auth & Connection Errors (connection closed after)

error ValueCause & Resolution
missing_api_key No api-key parameter was included in the connection URL. Add ?api-key=YOUR_KEY to the WebSocket URL.
invalid_api_key The key was not found. Verify your key at businessquant.com/account.
access_revoked The key's access has been administratively suspended. Contact [email protected].
subscription_expired Your subscription has lapsed. Renew at businessquant.com/pricing.
connection_limit_reached An active WebSocket session is already open for this key (limit is 1 per key). Close the existing connection before opening a new one.

Operational Errors (connection stays open)

error ValueCause & Resolution
ticker_limit_exceeded The subscribe list contains more tickers than your plan allows. The response includes ticker_limit and requested fields. Reduce the list and resend — no reconnect needed.
ticker_limit_exceeded Response
{
    "error": "ticker_limit_exceeded",
    "detail": "Your plan (group2) allows a maximum of 10 tickers per connection. You requested 25. Reduce your list or upgrade at businessquant.com/pricing.",
    "group": "group2",
    "ticker_limit": 10,
    "requested": 25,
    "upgrade": "https://businessquant.com/pricing"
}

Frequently Asked Questions

How often do ticks arrive?

Updates arrive as trades are reported by the exchange — there is no fixed interval. High-volume equities during regular market hours may produce multiple updates per second; thinly-traded names or pre/post-market sessions will produce fewer.

Can I change my subscribed tickers without reconnecting?

Yes. Send an unsubscribe action with the tickers you want to stop receiving, then send a new subscribe with your additions. Both actions are processed immediately and do not interrupt the connection or your existing subscriptions.

What does close represent — is it end-of-day or a live price?

close is the last trade price received — it is a live price, not an end-of-day close. It updates on every incoming trade. For end-of-day closing prices, use the Stock Quotes API.

What happens if my connection drops?

The server does not buffer or replay missed ticks. Reconnect and resubscribe to resume receiving live tick updates — ticks that occurred during the disconnection are not replayed.

Is the WebSocket API free to use?

Yes, the WebSocket API is free to use. Ticker limits vary by plan — up to 2 simultaneous tickers are available without a paid subscription. Sign up for an API key at businessquant.com/pricing.