Skip to content

Latest commit

 

History

History
71 lines (58 loc) · 942 Bytes

File metadata and controls

71 lines (58 loc) · 942 Bytes

WebSocket Events

Connect to the WebSocket server at /ws/connect for real-time updates.

Client -> Server Messages

Subscribe to order book updates

{
  "type": "subscribe",
  "channel": "orderbook",
  "event_id": 1,
  "option_id": 1
}

Unsubscribe from updates

{
  "type": "unsubscribe",
  "channel": "orderbook",
  "event_id": 1,
  "option_id": 1
}

Server -> Client Messages

Order book update

{
  "type": "orderbook_update",
  "event_id": 1,
  "option_id": 1,
  "bids": [...],
  "asks": [...],
  "last_price": "50.00"
}

Trade notification

{
  "type": "trade",
  "event_id": 1,
  "option_id": 1,
  "price": "50.00",
  "quantity": 100,
  "timestamp": "2024-01-01T12:00:00Z"
}

Price update

{
  "type": "price_update",
  "updates": [
    {
      "event_id": 1,
      "option_id": 1,
      "price": "50.00",
      "change_24h": "2.50"
    }
  ]
}