Skip to main content

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

SourceSymbols
BinanceBTCUSDT, ETHUSDT, SOLUSDT
TwelveDataXAUUSD, 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
}
FieldDescription
data.symbolThe ticker symbol.
data.priceCurrent price.
data.timestampSource event time in milliseconds.
timestampServer 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}`);
    }
  }
});