WebSocket stream
One native WebSocket. Authenticate on connect, wait for ready, subscribe to channels, receive quote and trade frames. No Socket.IO.
How it works
Connect
Open
wss://stream.tickerlayer.com/?apiKey=…; the parameter name is exactlyapiKey. The key is checked on this upgrade only, never on later frames (Connection, Authentication).Wait for ready
The first frame is
{ "type": "system", "event": "ready" }. Send nothing before it.Subscribe
Send a JSON text frame with
action,channelsandsymbols. The server replies withsubscribedand, by default, a snapshot.Receive
Live
quoteandtradeframes arrive on those channels. Useunsubscribeandpingas needed.
Try it live
Signed in with an active key? Pick an asset and a stream, add up to two symbols, and watch the latest tick update in place.
Try it live
WebSocket playground
Connect with your account key, subscribe to one channel, and watch the latest tick update in place. The key is never shown in this panel.
Channel crypto.quotes
Flow: connect → ready → subscribe → live quote / trade frames. Same protocol as production clients.
Connect to see the live tick update here.
Minimal example
The same flow in code. The Quickstart walks through it step by step.
const ws = new WebSocket(
"wss://stream.tickerlayer.com/?apiKey=" + encodeURIComponent(rawKey)
);
ws.onmessage = (ev) => {
const msg = JSON.parse(String(ev.data));
if (msg.type === "system" && msg.event === "ready") {
ws.send(JSON.stringify({
action: "subscribe",
channels: ["crypto.quotes"],
symbols: ["BTCUSD"],
}));
return;
}
console.log(msg); // quote | trade | system | error
};Supported channels
| Asset class | Channels | Example |
|---|---|---|
| Stocks | stocks.quotes stocks.trades stocks.agg stocks.status | US:KO DE:BMW |
| Forex | forex.quotes forex.trades | EURUSD |
| Crypto | crypto.quotes crypto.trades | BTCUSD |
| Indices | indices.quotes indices.trades | US500 |
| ETFs | etfs.quotes etfs.trades etfs.agg | US500ETF |
| Commodities | commodities.quotes commodities.trades | XAUUSD |
| Bonds | bonds.quotes | US:10Y |
| Perpetuals | perpetuals.quotes perpetuals.marks perpetuals.trades | XAUUSDT |
| Futures CFDs | futures.quotes | WTIUSD.C1 XAUUSD.DEC26 |
stocks.agg- Settled US OHLCV bars, from 1 minute to 1 day.
etfs.agg- The same settled bars for US-listed ETFs, with ETF access.
stocks.status- US trading halt and resume events.
bonds.quotes- The latest daily yield on subscribe, then one frame per new observation.
perpetuals.*- Composite top of book, mark price and trades, streamed on the Perpetuals Business plan.
futures.quotes- Contract months, the C1-C3 chain and roll series, for accounts with Futures CFDs.
- Forex raw line
SYMBOL.RAWstreams a single-venue line; see Forex.
Symbols come from the same registries as REST, and each channel needs its asset class on your plan.
Deeper reference
- ConnectionURL, upgrade outcomes and the ready frame.
- AuthenticationWhy the key goes on the URL, and how that differs from REST.
- SubscriptionsSubscribe, unsubscribe, ping, snapshots and limits.
- Message typesEvery frame the stream sends, field by field.
- Errors & troubleshootingUpgrade failures, error codes and common fixes.