Documentation Index
Fetch the complete documentation index at: https://docs.bayse.markets/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The /ws/v1/realtime endpoint streams live asset prices. No authentication is required. Prices update approximately every second per symbol.
wss://socket.bayse.markets/ws/v1/realtime
Available symbols
| Source | Symbols |
|---|
| Binance | BTCUSDT, ETHUSDT, SOLUSDT |
| TwelveData | XAUUSD, EURUSD, GBPUSD, USDNGN |
Subscribe
Send a subscribe message with the symbols you want to track:
{
"type": "subscribe",
"channel": "asset_prices",
"symbols": ["BTCUSDT", "ETHUSDT", "SOLUSDT"]
}
You can subscribe to one or more symbols in a single message.
Events received
asset_price — A price tick for a subscribed symbol.
{
"type": "asset_price",
"data": {
"symbol": "BTCUSDT",
"price": 67432.15,
"timestamp": 1700000000000
},
"timestamp": 1700000000000
}
| Field | Description |
|---|
data.symbol | The ticker symbol. |
data.price | Current price. |
data.timestamp | Source event time in milliseconds. |
timestamp | Server timestamp in milliseconds. |
Unsubscribe
Each symbol has its own room. To unsubscribe from a specific symbol:
{ "type": "unsubscribe", "room": "asset_prices:BTCUSDT" }
Full example
const ws = new WebSocket("wss://socket.bayse.markets/ws/v1/realtime");
ws.addEventListener("open", () => {
ws.send(JSON.stringify({
type: "subscribe",
channel: "asset_prices",
symbols: ["BTCUSDT", "ETHUSDT", "SOLUSDT"]
}));
});
ws.addEventListener("message", (event) => {
for (const line of event.data.split("\n")) {
if (!line.trim()) continue;
const msg = JSON.parse(line);
if (msg.type === "asset_price") {
console.log(`${msg.data.symbol}: $${msg.data.price}`);
}
}
});