Skip to main content

Global Orderbook Module API

The Orderbook API provides real-time orderbook aggregation across multiple exchanges (Binance, Bybit, Gate.io, Kraken). It streams public orderbook data via WebSocket and provides quality metrics for each venue.

Key Features

  • Multi-venue aggregation: Subscribe to orderbooks across multiple exchanges simultaneously
  • Quality metrics: Staleness, spread, depth, and confidence scoring per venue
  • Global best prices: Find the best bid/ask across all venues
  • Ref-counting subscriptions: Efficient resource management with warm cache
  • Public market data: Orderbook data is not account-specific. REST endpoints still require authentication at the API gateway; the WebSocket stream does not.

POST /order-execution/orderbook/subscribe

Subscribe to orderbook updates for one or more symbols on one or more venues.

Request Body (JSON)

  • symbols (array, required): List of trading pairs in CCXT format (e.g., ["BTC/USDT", "ETH/USDT"])
  • venues (array, required): List of exchange venues: "binance", "bybit", "gateio", "kraken"

Request Example

Response Examples

Success

Invalid Request

Subscription Status Values


POST /order-execution/orderbook/unsubscribe

Unsubscribe from orderbook updates. Subscriptions move to warm cache (5 minutes) before being fully closed.

Request Body (JSON)

  • symbols (array, required): List of trading pairs to unsubscribe from
  • venues (array, required): List of exchange venues to unsubscribe from

Request Example

Response Example


GET /order-execution/orderbook/book

Get current orderbook data. Returns either a single venue’s book or a global aggregated view.

Query Parameters

  • symbol (string, required): Trading pair (e.g., “BTC/USDT”)
  • venue (string, optional): Specific venue (omit for global view across all subscribed venues)
  • venues (string, optional): Comma-separated list of venues to filter global view (e.g., “binance,gateio”). Use this to get a client-specific view of subscribed venues.
  • depth (integer, optional): Number of orderbook levels to return (1-100). Default: 20

Request Examples

Response Examples

Single Venue

Global View

Not Found

Notes

  • A negative global spread (best_bid > best_ask) indicates a cross-venue arbitrage opportunity
  • Bids are sorted by price descending (best first)
  • Asks are sorted by price ascending (best first)

GET /order-execution/orderbook/quality

Get quality metrics for all venues with orderbook data for a symbol.

Query Parameters

  • symbol (string, required): Trading pair (e.g., “BTC/USDT”)

Request Example

Response Example

Quality Levels

Confidence Scoring

Confidence starts at 1.0 and is reduced by:
  • Staleness: Up to -0.4 (linear to 5000ms)
  • Wide spread: Up to -0.2 (linear from 1bps to 20bps)
  • Sequence gaps: -0.05 per gap, max -0.3
  • If quality is UNAVAILABLE: confidence = 0

GET /order-execution/orderbook/subscriptions

Get current subscription status and statistics.

Request Example

Response Example


GET /order-execution/orderbook/stats

Get service statistics including store and subscription metrics.

Request Example

Response Example


Supported Venues


Typical Use Cases

1. Smart Order Routing (SOR)

2. Arbitrage Detection

3. Execution Quality Monitoring


WebSocket Streaming

Real-time orderbook streaming via WebSocket for low-latency updates.

Connection

Connect to the Socket.IO endpoint:
See Global Orderbook Module Websocket for the full streaming reference.

Events

Client to Server

Server to Client

Subscribe Parameters

JavaScript Example

Update Payload

Each update includes arrays of price and quantity pairs:
  • bids: Sorted by price descending (best first)
  • asks: Sorted by price ascending (best first)

Python Example

Performance

  • Update rate: 10-20 updates/sec per symbol
  • Latency: Under 100ms from exchange to client
  • Broadcast interval: 100ms (sends only changed data)
  • Recommended depth: 5-10 for most use cases, 20 for detailed analysis