Skip to main content

Data Sources

Real-Time Data

The WebSocket API provides real-time streaming data from exchanges.

Market Data

Data TypeSourceLatencyDelivery
Order BookExchange WebSocket< 100msPush (subscription)
TradesExchange WebSocket< 100msPush (subscription)
InstrumentsExchange RESTOn-demandRPC query
VenuesCadenza PlatformStaticRPC query

Trading Data

Data TypeSourceDelivery
Order updatesExchange + CadenzaPush (subscription)
ExecutionsExchangePush (subscription)
PortfolioExchange + CadenzaPush (subscription)
BalancesExchangePush (subscription)

Data Flow

┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│ Exchange │────▶│ Cadenza │────▶│ Client │
│ WebSocket │ │ Server │ │ │
└──────────────┘ └──────────────┘ └──────────────┘
│ │ │
│ Market Data │ Aggregated & │
│ Order Updates │ Normalized Data │
│ Executions │ │

Order Book Updates

Order book data is streamed with incremental updates:

Initial Snapshot

When subscribing, you receive a full order book snapshot:

{
"type": "snapshot",
"bids": [["50000.00", "1.5"], ["49999.00", "2.0"]],
"asks": [["50001.00", "1.2"], ["50002.00", "0.8"]],
"timestamp": 1703052635110
}

Incremental Updates

Subsequent messages contain only changes:

{
"type": "update",
"bids": [["50000.00", "2.0"]],
"asks": [["50001.00", "0"]],
"timestamp": 1703052635200
}
  • Quantity "0" means remove the price level
  • Non-zero quantity means update or add the level

Trading Account Updates

Account updates are pushed in real-time:

Order Update

{
"type": "order",
"tradeOrderId": "770e8400-...",
"status": "FILLED",
"executedQuantity": "0.1",
"timestamp": 1703052635110
}

Balance Update

{
"type": "balance",
"symbol": "USDT",
"available": "10000.00",
"locked": "5000.00",
"timestamp": 1703052635110
}

Data Consistency

Sequence Numbers

Some channels include sequence numbers for ordering:

{
"seq": 12345,
"data": {...}
}

If you detect a gap in sequence numbers, re-subscribe to get a fresh snapshot.

Reconnection

After reconnection:

  1. Re-subscribe to all channels
  2. You'll receive fresh snapshots
  3. Rebuild local state from snapshots

Comparison: HTTP vs WebSocket

AspectHTTP APIWebSocket API
Data freshnessOn-demandReal-time push
Order bookSnapshot onlyStreaming updates
Order statusPolling requiredPush notifications
LatencyHigherLower
Use caseInfrequent queriesContinuous monitoring