TickQuote logoTickQuoteDocs

Docs search

Search the current language documentation index.

Docs/Core APIs·05

Streaming millisecond-level data.

Use the Market Data WebSocket API to subscribe to realtime quote, snapshot, and kline updates from one stream endpoint.

Transport
WSS
Heartbeat
quote / kline / snapshot
Avg latency
Client-driven reconnect

Connection

Connect to the stream endpoint with a server-side WebSocket client or SDK. The current API authenticates with the Authorization bearer header.

Endpoint

Market Data stream

endpoint
wss://api.tickquote.com/api/v1/market/stream

scope: market:stream

Connection rules

  • Connect with the Authorization bearer header from a server-side client or SDK.
  • Native browser WebSocket does not allow custom Authorization headers.
  • Do not put API keys in the WebSocket URL unless a future release explicitly documents that transport.
  • Reconnect with bounded backoff after network loss.
  • Replay active subscriptions after reconnecting.

Authentication

Provide your product API key in the Authorization header. Website login JWTs are not accepted for market data streams.

headers.http
Authorization: Bearer tkp_****redacted****

Subscribe

Send a subscribe frame with compact tickers and one or more stream names. If streams is omitted, the server subscribes to quote updates.

subscribe.json
{
  "op": "subscribe",
  "tickers": ["EURUSD", "GBPUSD"],
  "streams": ["quote"]
}

Message Types

quote

Quote

Latest bid and ask state for a subscribed ticker.

message: subscribed

snapshot

Snapshot

A broader market panel snapshot. Nullable fields mean the upstream source did not provide that value.

kline

Kline

Incremental OHLCV-style kline updates for supported timeframes.

Live preview

A quote message contains the latest bid, ask, mid, spread, ticker, and millisecond timestamp.

Failure codes

WebSocket errors use stable codes. Clients should branch on code instead of parsing message text.

40001

invalid_market_subscription

HTTP
400
Retry
false

remove unsupported stream or operation values

40101

unauthorized

HTTP
401
Retry
false

provide a valid product API key

40301

market_access_denied

HTTP
403
Retry
false

request market data entitlement

42901

market_rate_limited

HTTP
429
Retry
true

back off and retry later

JavaScript Example

stream.ts
Native WebSocket
import WebSocket from "ws"

const ws = new WebSocket("wss://api.tickquote.com/api/v1/market/stream", {
  headers: { Authorization: `Bearer ${TICKQUOTE_API_KEY}` },
})

ws.onopen = () => {
  ws.send(JSON.stringify({
    op: "subscribe",
    tickers: ["EURUSD", "GBPUSD"],
    streams: ["quote"],
  }))
}

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data)
  if (msg.type === "quote") {
    console.log(msg.ticker, msg.bid, msg.ask)
  }
}

ws.onerror = (err) => console.error("stream error", err)
ws.onclose = () => console.log("connection closed")

Next up

Error Codes

Continue