Realtime (WebSocket)
A public Socket.IO gateway streams live market activity: trades, resolutions, and comments. No authentication is required to subscribe.
Connect
Connect to the /markets namespace and join a market room by id.
ts
import { io } from "socket.io-client"; const socket = io("https://api.inklemarket.com/markets", { transports: ["websocket"], }); socket.emit("subscribe", { marketId: "<id>" });
Events
market.trade: a buy or sell executed; carries the post-trade marginal price for the outcome.market.resolved: the market settled; carries the winning outcome.market.comment: a new comment was posted.
ts
socket.on("market.trade", (e) => { console.log(e.outcomeIndex, e.side, e.marginalPriceAfter); }); socket.on("market.resolved", (e) => console.log("winner:", e.winningOutcome)); // Stop receiving a market's events socket.emit("unsubscribe", { marketId: "<id>" });
Notes
- Both
websocketandpollingtransports are available. - Subscribe to as many market rooms as you need on one connection.
- For polling instead of push, the REST
/price-ticksand/betsendpoints return the same data.