WebSocket Connections
Aries provides real-time WebSocket APIs for streaming market data, account updates, and other time-sensitive information.Available WebSocket Endpoints
Market Data & Trading
Market Data WebSocket
Real-time equity quotes, options data, time & sales, level 2 order book, and market statusEndpoint:
wss://api.aries.com/v1/marketdata/wsWebSocket Features
Real-Time Data Streaming
All WebSocket connections support bi-directional communication for real-time data streaming with minimal latency.Authentication Required
All WebSocket endpoints require authentication using OAuth2 access tokens before subscribing to data streams.Keep-Alive Support
WebSocket connections support ping/pong messages to maintain active connections and detect disconnections.Selective Subscriptions
Subscribe only to the specific data you need to minimize bandwidth and processing overhead.Connection Flow
1
Establish Connection
Connect to the WebSocket endpoint using the WSS protocol
2
Authenticate
Send authentication message with your OAuth2 access token
3
Subscribe
Subscribe to specific data streams or symbols
4
Receive Data
Process real-time data as it arrives
5
Maintain Connection
Send periodic ping messages to keep connection alive
Best Practices
Connection Management
Handle Reconnections
Handle Reconnections
Implement automatic reconnection logic with exponential backoff when connections drop:
Maintain Keep-Alive
Maintain Keep-Alive
Send ping messages regularly (recommended every 30-60 seconds) to maintain the connection:
Handle Errors Gracefully
Handle Errors Gracefully
Implement proper error handling for connection failures, authentication errors, and data parsing issues:
Clean Up Resources
Clean Up Resources
Always close WebSocket connections and clear intervals when they’re no longer needed:
Performance Optimization
Selective Subscriptions
Only subscribe to symbols and fields you actively need to reduce bandwidth and processing overhead
Batch Updates
Process incoming messages in batches rather than individually for better performance
Connection Pooling
Reuse WebSocket connections when possible instead of creating new connections frequently
Message Throttling
Implement client-side throttling to handle high-frequency updates without overwhelming your UI
Quick Start Example
Here’s a basic example of connecting to the Market Data WebSocket:Authentication
All WebSocket endpoints require authentication. Include your OAuth2 access token in the authentication message:Obtain your access token through the OAuth2 flow. See the API References section for authentication details.