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

Connection URLs

wss://ws.roxom.com/ws
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:
SymbolDescriptionBase AssetQuote Asset
US500-BTCS&P 500 Index to BitcoinUS500BTC
GOLD-BTCGold to BitcoinGOLDBTC
OIL-BTCOil to BitcoinOILBTC

Message Format

All WebSocket messages use JSON format with a consistent structure:

Client to Server Messages

{
  "op": "subscribe|unsubscribe",
  "args": [
    {
      "channel": "channelName",
      "symbol": "tradingPair"
    }
  ]
}

Server to Client Messages

{
  "topic": "channel.symbol",
  "type": "snapshot|delta",
  "createdTime": 1640995200000000000,
  "data": {
    // Channel-specific data
  }
}

Supported Channels

ChannelDescriptionSymbol RequiredAuthentication
level1Best bid/ask prices and quantitiesYesNo
tradeReal-time trade executionsYesNo
depthOrder book depth (snapshot + deltas)YesNo
tickerReal-time price and market statisticsYesNo
ordersOrder updates for authenticated userNoYes
balanceBalance updates for authenticated userNoYes
positionsPosition updates for authenticated userNoYes

Connection Lifecycle

1

Establish Connection

Connect to the WebSocket endpoint using your preferred WebSocket library.
const ws = new WebSocket('wss://ws.roxom.com/ws');
2

Authenticate (For Private Streams)

For private streams (orders, balance, positions), authenticate using API key during connection.
const ws = new WebSocket('wss://ws.roxom.com/ws', [], {
  headers: {
    'X-API-KEY': 'your-api-key'
  }
});
3

Subscribe to Channels

Send subscription messages for the data streams you need.
{
  "op": "subscribe",
  "args": [
    { "channel": "level1", "symbol": "US500-BTC" },
    { "channel": "depth", "symbol": "GOLD-BTC" },
    { "channel": "orders" }
  ]
}
4

Handle Messages

Process incoming real-time data and maintain connection status.
ws.onmessage = function(event) {
  const data = JSON.parse(event.data);
  console.log('Received:', data);
};
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

Getting Started