Developer APIWebSocket

WebSocket API reference

Open a WebSocket to receive live quote snapshots for the symbols you subscribe to. Your API key requires the quotes:read scope.

Developer WebSocket access requires Plus or higher. Connection and symbol limits come from the API key owner's current plan. The workstation market stream is a separate product channel.

Endpoint

Connect to the stream and pass the requested symbols in the comma-separated symbols query parameter:

text
wss://api.candlescript.io/v1/stream/quotes?symbols=NASDAQ:AAPL,CRYPTO:BTCUSD

Message format

The server pushes quote.snapshot messages. Each message carries the latest values for the symbols on the connection.

json
{
  "type": "quote.snapshot",
  "ts": "2026-06-22T20:31:05.000Z",
  "payload": {
    "quotes": [
      { "symbolId": "NASDAQ:AAPL", "last": 212.44, "changePercent": 0.58, "volume": 51230000 }
    ]
  }
}

Example: browser

javascript
const ws = new WebSocket(
  "wss://api.candlescript.io/v1/stream/quotes?symbols=NASDAQ:AAPL",
  ["candlescript", window.CANDLESCRIPT_API_KEY]
);

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.type === "quote.snapshot") {
    for (const q of msg.payload.quotes) {
      console.log(q.symbolId, q.last);
    }
  }
};

ws.onclose = () => {
  // Reconnect with backoff in production.
};

Example: Node.js

javascript
import WebSocket from "ws";

const ws = new WebSocket(
  "wss://api.candlescript.io/v1/stream/quotes?symbols=NASDAQ:AAPL",
  { headers: { Authorization: `Bearer ${process.env.CHARTING_API_KEY}` } }
);

ws.on("message", (data) => {
  const msg = JSON.parse(data.toString());
  if (msg.type === "quote.snapshot") {
    console.log(msg.payload.quotes);
  }
});

Operational notes

  • Reconnect with exponential backoff and resubscribe after reconnecting.
  • Snapshots are conflated: you receive the latest value, not every tick.
  • Plus supports 2 concurrent connections and 100 symbols per connection.
  • Premium supports 10 connections and 500 symbols per connection.
  • Ultimate supports 50 connections and 1,000 symbols per connection.
WebSocket API reference