WebSocket Streaming

Real-time data streaming via WebSocket connections for live quotes, order updates, and market events.

WebSocket URL: ws://localhost:8000/ws
Authentication: Send access token in initial connection message

Connecting to WebSocket

JavaScript Example:

const ws = new WebSocket('ws://localhost:8000/ws');

// Authenticate on connection
ws.onopen = () => {
  ws.send(JSON.stringify({
    type: 'auth',
    token: 'your-access-token'
  }));
};

// Handle messages
ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log('Received:', data);
};

Available Channels

quotes

Real-time price updates for subscribed symbols. Updates every 1-5 seconds.

trades

Individual trade executions as they happen. Includes price, volume, timestamp.

alerts

Alert triggers and notifications in real-time.

paper_orders

Paper trading order fills and position updates.