Skip to main content

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.
NetworkSocket.IO URL
Mainnethttps://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

EventPayloadDescription
join:marketconditionId: stringSubscribe to one market room.
leave:marketconditionId: stringUnsubscribe from one market room.
join:activitynoneSubscribe to global trade activity.
leave:activitynoneUnsubscribe from global trade activity.

Server Events

EventDescription
orderbook:updateEmitted when market orderbook state changes.
trade:newEmitted when a trade is confirmed on-chain.
ob:snapshotL2 orderbook snapshot for an outcome token.
price:snapshotLatest bid, ask, and midpoint for an outcome.