Skip to main content
Use the WebSocket gateway to stream market data or your private order and trade updates.

Prerequisites

Market channel example

npm install ws
import WebSocket from "ws";

const socket = new WebSocket("wss://ws-subscriptions-clob.kuest.com/ws/market");

socket.on("open", () => {
  socket.send(
    JSON.stringify({
      type: "market",
      assets_ids: ["<token_id>"],
      custom_feature_enabled: true
    })
  );
});

socket.on("message", (data) => {
  console.log(JSON.parse(data.toString()));
});

User channel example

import WebSocket from "ws";

const socket = new WebSocket("wss://ws-subscriptions-clob.kuest.com/ws/user");

socket.on("open", () => {
  socket.send(
    JSON.stringify({
      type: "user",
      markets: ["<condition_id>"],
      auth: {
        apikey: "<uuid>",
        secret: "<base64-secret>",
        passphrase: "<hex-passphrase>"
      }
    })
  );
});

socket.on("message", (data) => {
  console.log(JSON.parse(data.toString()));
});

Unsubscribe

{
  "operation": "unsubscribe",
  "assets_ids": ["<token_id>"],
  "markets": ["<condition_id>"]
}