Documentation Index
Fetch the complete documentation index at: https://unitedmarket.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The public real-time API is exposed through the mainnet backend Socket.IO endpoint.
| Network | Socket.IO URL |
|---|
| Mainnet | https://backend.themarketunited.com |
United Market is currently in sandbox/development stage. All funds, balances, markets, and trades are for testing only and do not represent real money.
Use the Socket.IO client protocol. Do not connect with a plain WebSocket client.
Install Client
npm install socket.io-client
Connect
import { io } from "socket.io-client";
const socket = io("https://backend.themarketunited.com", {
transports: ["websocket", "polling"],
reconnection: true,
});
Subscribe to a Market
Join a market room with the market conditionId.
const conditionId = "0xd19487c4038d0dce2edeb510a21d6f8534e09d8065d40cb9e10ad2652d86a276";
socket.on("connect", () => {
socket.emit("join:market", conditionId);
});
socket.emit("leave:market", conditionId);
Client Events
| Event | Payload | Description |
|---|
join:market | conditionId: string | Subscribe to one market room. |
leave:market | conditionId: string | Unsubscribe from one market room. |
join:activity | none | Subscribe to global trade activity. |
leave:activity | none | Unsubscribe from global trade activity. |
Server Events
| Event | Description |
|---|
orderbook:update | Emitted when market orderbook state changes. |
trade:new | Emitted when a trade is confirmed on-chain. |
ob:snapshot | L2 orderbook snapshot for an outcome token. |
price:snapshot | Latest bid, ask, and midpoint for an outcome. |