Skip to main content
This guide walks you through integrating with the Paxos Smart Order Routing WebSocket API to receive real-time market data and execution updates. The Smart Order Routing WebSocket API requires authentication and is available only to authorized Smart Order Routing platform customers.
Before starting, ensure you have Smart Order Routing platform access and valid OAuth2 credentials with the exchange:read_aggregated_marketdata_stream scope.

➊ Authenticate and Get Access Token

First, obtain an OAuth2 access token using your client credentials.

Sandbox Environment

Save the access_token from the response. You’ll use this as the Bearer token for the WebSocket connection.

➋ Establish WebSocket Connection

Connect to the WebSocket server using your preferred WebSocket client library.

JavaScript/Node.js Example

Python Example

➌ Subscribe to Market Data

Once connected, subscribe to market data channels to receive order book updates.

Handle Market Data Messages

➍ Subscribe to Execution Data

Subscribe to execution data to receive real-time trade notifications.

➎ Manage Subscriptions

List Active Subscriptions

Unsubscribe from Channels

Complete Integration Example

Error Handling

Handle errors gracefully and implement appropriate retry logic:

Next Steps