Trade Updates
Receive real-time public trade notifications as they occur on the exchange.
Endpoint
Public subscriptions (candles, marketPrices, orderbook, trades):
wss://papi.synthetix.io/v1/ws/infoPrivate subscriptions (subAccountUpdates - requires authentication):
wss://papi.synthetix.io/v1/ws/tradeOverview
The trades subscription provides a real-time stream of trades as they are executed. Each message contains details about a single trade including price, quantity, side, and timing information.
Subscription Request
Subscribe to a Specific Symbol
{
"id": "sub-1",
"method": "subscribe",
"params": {
"type": "trades",
"symbol": "BTC-USDT"
}
}Subscribe to All Symbols
{
"id": "sub-all",
"method": "subscribe",
"params": {
"type": "trades",
"symbol": "ALL"
}
}Alternatively, omit the symbol parameter to subscribe to all symbols (defaults to "ALL"):
{
"id": "sub-all",
"method": "subscribe",
"params": {
"type": "trades"
}
}Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Client-generated unique request identifier |
method | string | Yes | Must be "subscribe" |
params.type | string | Yes | Must be "trades" |
params.symbol | string | No | Trading pair symbol (e.g., "BTC-USDT") or "ALL" for all symbols. Defaults to "ALL" if omitted |
Unsubscription Request
{
"id": "unsub-1",
"method": "unsubscribe",
"params": {
"type": "trades",
"symbol": "BTC-USDT"
}
}The type and symbol must match the original subscription request.
Trade Notification Messages
Message Format
{
"channel": "trade",
"data": {
"tradeId": "12345",
"symbol": "BTC-USDT",
"side": "buy",
"price": "50125.50",
"quantity": "0.15",
"timestamp": "2025-01-03T12:34:56.789Z",
"isMaker": false
},
"timestamp": 1735907696789
}Message Fields
| Field | Type | Description |
|---|---|---|
tradeId | string | Unique trade identifier |
symbol | string | Trading pair symbol (e.g., "BTC-USDT") |
side | string | Taker side of the trade: "buy" or "sell" |
price | string | Execution price |
quantity | string | Trade quantity |
timestamp | string | Time of trade execution (RFC3339 format) |
isMaker | boolean | Whether the reported side was the maker |
Implementation Example
const ws = new WebSocket('wss://papi.synthetix.io/v1/ws/info');
ws.onopen = () => {
ws.send(JSON.stringify({
id: 'sub-1',
method: 'subscribe',
params: {
type: 'trades',
symbol: 'BTC-USDT'
}
}));
};
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
if (message.channel === 'trade') {
const { tradeId, symbol, side, price, quantity, timestamp } = message.data;
console.log(`[${timestamp}] ${symbol} ${side} ${quantity} @ ${price} (trade ${tradeId})`);
}
};Use Cases
Trading Interfaces
- Trade Feed: Display a live trade ticker showing recent executions
- Time & Sales: Build a time-and-sales panel with trade-by-trade data
- Trade Alerts: Trigger notifications for large trades
Market Analysis
- Volume Tracking: Aggregate trade quantities over time windows
- Buy/Sell Pressure: Monitor the ratio of buy vs sell trades
- Price Impact: Observe how individual trades move the market
Data Feeds
- Trade History: Build a local trade history database
- VWAP Calculation: Compute volume-weighted average price in real time
- Tick Data: Capture every trade for backtesting or analytics
Implementation Notes
- Public Data: No authentication required — connects to the info WebSocket endpoint
- Side: The
sidefield represents the taker side of the trade - Default Symbol: Omitting
symboldefaults to"ALL", streaming trades for every market - Message Frequency: High-volume markets may produce a large number of messages — consider filtering by symbol if you only need specific pairs
Error Handling
Subscription Errors
{
"id": "sub-1",
"status": 400,
"result": null,
"error": {
"code": 400,
"message": "Invalid symbol: XYZ-USDT not supported"
}
}Common Issues
| Error | Description | Solution |
|---|---|---|
| Invalid symbol | Symbol not available | Check supported trading pairs via Get Markets |
| Subscription failed | Too many active subscriptions | Reduce the number of concurrent subscriptions |
| Connection timeout | WebSocket disconnected | Implement reconnection logic with exponential backoff |
Related Endpoints
- Get Last Trades - Recent trades via REST API
- Get Last Trades (WebSocket) - Recent trades via WebSocket query
- Market Price Updates - Real-time price ticker data
- Orderbook Updates - Real-time orderbook depth updates