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}`);
    }
  }
});
import asyncio
import json
import websockets

async def stream_prices():
    async with websockets.connect("wss://socket.bayse.markets/ws/v1/realtime") as ws:
        await ws.send(json.dumps({
            "type": "subscribe",
            "channel": "asset_prices",
            "symbols": ["BTCUSDT", "ETHUSDT", "SOLUSDT"]
        }))

        async for message in ws:
            for line in message.split("\n"):
                if not line.strip():
                    continue
                msg = json.loads(line)

                if msg["type"] == "asset_price":
                    data = msg["data"]
                    print(f"{data['symbol']}: ${data['price']}")

asyncio.run(stream_prices())
package main

import (
	"encoding/json"
	"fmt"
	"log"
	"strings"

	"github.com/gorilla/websocket"
)

func main() {
	conn, _, err := websocket.DefaultDialer.Dial(
		"wss://socket.bayse.markets/ws/v1/realtime", nil,
	)
	if err != nil {
		log.Fatal(err)
	}
	defer conn.Close()

	conn.WriteJSON(map[string]any{
		"type":    "subscribe",
		"channel": "asset_prices",
		"symbols": []string{"BTCUSDT", "ETHUSDT", "SOLUSDT"},
	})

	for {
		_, data, err := conn.ReadMessage()
		if err != nil {
			log.Fatal(err)
		}
		for _, line := range strings.Split(string(data), "\n") {
			if strings.TrimSpace(line) == "" {
				continue
			}
			var msg map[string]any
			json.Unmarshal([]byte(line), &msg)

			if msg["type"] == "asset_price" {
				d := msg["data"].(map[string]any)
				fmt.Printf("%s: %v\n", d["symbol"], d["price"])
			}
		}
	}
}