Overview
The Roxom WebSocket API provides real-time access to market data and account updates with minimal latency. Perfect for building trading applications, monitoring portfolios, and implementing algorithmic trading strategies.What You Can Access
Market Data Streams
Market Data Streams
Authentication required for market data streams:
- Level 1 Quotes: Best bid/ask prices and quantities
- Trade Executions: Real-time trade data with volume statistics
- Order Book Depth: Complete order book with multiple price levels
- Ticker Data: Real-time price and market statistics including funding rates and open interest
Private Account Data
Private Account Data
Authentication required for private account streams:
- Order Updates: Real-time order status changes and fills
- Balance Changes: Account balance updates from trades and transfers
- Position Updates: Position changes and PnL updates
Connection URLs
Use the sandbox environment for testing and development. Production credentials will not work with sandbox endpoints.
Supported Trading Pairs
Current supported symbols for market data streams:Symbol | Description | Base Asset | Quote Asset |
---|---|---|---|
US500-BTC | S&P 500 Index to Bitcoin | SPY | BTC |
US100-BTC | Nasdaq 100 Index to Bitcoin | QQQ | BTC |
GOLD-BTC | Gold to Bitcoin | PAX | BTC |
OIL-BTC | Oil to Bitcoin | USO | BTC |
Message Format
All WebSocket messages use JSON format with a consistent structure:Client to Server Messages
Server to Client Messages
Supported Channels
Channel | Description | Symbol Required | Authentication |
---|---|---|---|
level1 | Best bid/ask prices and quantities | Yes | Yes |
trade | Real-time trade executions | Yes | Yes |
depth | Order book depth (snapshot + deltas) | Yes | Yes |
ticker | Real-time price and market statistics | Yes | Yes |
orders | Order updates for authenticated user | No | Yes |
balance | Balance updates for authenticated user | No | Yes |
positions | Position updates for authenticated user | No | Yes |
Account Event Broadcasting: Account-related events (
orders
, positions
, balance
) are automatically sent to all authenticated connections for your account, regardless of individual subscriptions. This ensures critical account changes are never missed.Connection Lifecycle
1
Establish Authenticated Connection
All WebSocket connections require authentication using API key headers during the connection handshake.
2
Handle Connection Events
Implement proper event handlers for connection management.
3
Subscribe to Channels
Send subscription messages for the data streams you need.
4
Handle Messages
Process incoming real-time data and maintain connection status.
5
Maintain Connection
Implement ping/pong and reconnection logic for reliability.
Send ping frames every 30 seconds to keep the connection alive.
Key Features
Low Latency
Sub-millisecond message delivery for time-sensitive trading applications
Multiple Streams
Subscribe to multiple symbols and channels simultaneously
Reliable Delivery
Built-in heartbeat and reconnection mechanisms
Efficient Updates
Delta updates minimize bandwidth usage for order book streams
Best Practices
Connection Management
Connection Management
- Single Connection: Use one connection per application when possible
- Reconnection Logic: Implement exponential backoff for reconnections
- Heartbeat Monitoring: Send ping frames every 30 seconds
- Resource Cleanup: Properly close connections when shutting down
Subscription Management
Subscription Management
- Selective Subscriptions: Only subscribe to data you actually need
- Unsubscribe Unused: Remove subscriptions you no longer need
- Batch Operations: Subscribe to multiple channels in single message
- Symbol Validation: Verify symbol names before subscribing
Error Handling
Error Handling
- Graceful Degradation: Handle connection drops gracefully
- Error Parsing: Always validate JSON before parsing
- Retry Logic: Implement smart retry mechanisms
- Logging: Log connection events for debugging