The Trades WebSocket streams real-time trade executions for markets. Use this to show live trade feeds, calculate volume, and track market activity.
Endpoint: wss://synthesis.trade/ws/trades
Use cases
| Use Case | Description |
|---|
| Trade feed | Display a live stream of trades showing price, size, side, and trader info |
| Volume tracking | Calculate real-time trading volume by aggregating trade amounts |
| Last trade price | Show the most recent execution price as an alternative to mid-market |
| Whale alerts | Monitor for large trades and alert users to significant market activity |
Subscribe
Subscribe using condition IDs (market identifiers). You can subscribe to up to 1,000 markets:
const ws = new WebSocket("wss://synthesis.trade/ws/trades");
ws.onopen = () => {
ws.send(JSON.stringify({
type: "subscribe",
venue: "polymarket",
markets: [
"0xabcdef1234567890abcdef1234567890abcdef12",
"0x1234567890abcdef1234567890abcdef12345678"
]
}));
};
Initial response
Upon subscribing, you receive recent historical trades:
{
"success": true,
"response": {
"trades": [
{
"venue": "polymarket",
"trade": {
"tx_hash": "0x9876543210fedcba...",
"token_id": "21742633143463906290569050155826241533067272736897614950488156847949938836455",
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"side": true,
"amount": "100",
"shares": "153.846",
"price": "0.65",
"username": "trader123",
"image": "https://...",
"created_at": "2026-01-01T12:00:00"
},
"event": { "..." },
"market": { "..." }
}
]
}
}
Real-time updates
New trades are streamed as they occur:
{
"success": true,
"response": {
"venue": "polymarket",
"trade": {
"tx_hash": "0xfedcba9876543210...",
"token_id": "21742633143463906290569050155826241533067272736897614950488156847949938836455",
"address": "0x1234567890abcdef1234567890abcdef12345678",
"side": false,
"amount": "500",
"shares": "714.285",
"price": "0.70",
"username": "whale_trader",
"image": "https://...",
"created_at": "2026-01-01T12:05:30"
},
"market": { "..." }
}
}
Complete example: Trade feed
const ws = new WebSocket("wss://synthesis.trade/ws/trades");
const trades = [];
const MAX_TRADES = 50;
ws.onopen = () => {
ws.send(JSON.stringify({
type: "subscribe",
venue: "polymarket",
markets: ["0xabcdef1234567890abcdef1234567890abcdef12"]
}));
};
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
if (!message.success) return;
const data = message.response;
if (data.trades) {
trades.push(...data.trades.map(t => t.trade));
renderTrades();
return;
}
trades.unshift(data.trade);
if (trades.length > MAX_TRADES) {
trades.pop();
}
renderTrades();
};
function renderTrades() {
const container = document.getElementById("trade-feed");
container.innerHTML = trades.map(trade => `
<div class="trade ${trade.side ? 'buy' : 'sell'}">
<span class="price">${trade.price}</span>
<span class="size">${trade.shares} shares</span>
<span class="user">${trade.username || trade.address.slice(0, 8)}</span>
</div>
`).join("");
}
Trades include Polymarket profile info (username, image) when available. For anonymous traders, you can display a truncated address instead.