Methods
| Method | Endpoint | Description |
|---|---|---|
private() | wss://api.polymarket.us/v1/ws/private | Orders, positions, balance updates |
markets() | wss://api.polymarket.us/v1/ws/markets | Market data and trades |
private
Connect to the private WebSocket for real-time order, position, and balance updates.Private Subscription Types
| Type | Description |
|---|---|
SUBSCRIPTION_TYPE_ORDER | Order updates and snapshots |
SUBSCRIPTION_TYPE_POSITION | Position changes |
SUBSCRIPTION_TYPE_ACCOUNT_BALANCE | Balance updates |
Private Events
| Event | Description |
|---|---|
orderSnapshot | Initial snapshot of all orders |
orderUpdate | Order state change |
positionSnapshot | Initial snapshot of all positions |
positionUpdate | Position change |
accountBalanceSnapshot | Initial balance snapshot |
accountBalanceUpdate | Balance change |
markets
Connect to the markets WebSocket for real-time market data and trades.Market Subscription Types
| Type | Description |
|---|---|
SUBSCRIPTION_TYPE_MARKET_DATA | Full order book and stats |
SUBSCRIPTION_TYPE_MARKET_DATA_LITE | Lightweight price data (BBO) |
SUBSCRIPTION_TYPE_TRADE | Real-time trade notifications |
Market Events
| Event | Description |
|---|---|
marketData | Full order book update |
marketDataLite | BBO and price update |
trade | Trade execution |
Best Practices
- Use unique request IDs - Track subscriptions with unique identifiers
- Handle reconnection - Implement automatic reconnection with exponential backoff
- Process messages in order - Messages are delivered in sequence
- Limit subscriptions - Only subscribe to markets you need