Skip to main content

Smart Order Router

The SOR module optimally splits and routes orders across multiple venues to minimize execution cost.

Features

  • Cost Estimation: Walk the orderbook to estimate slippage and fees
  • Venue Scoring: Rank venues by total cost + confidence penalty
  • Balance Constraints: Respects available balances per account
  • Daily Limits: Enforces trading limits per exchange account
  • Multi-venue Splitting: Splits orders across up to 3 venues (configurable)

Cost Calculation

For each venue, the SOR:
  1. Walks the orderbook to estimate VWAP for the order size
  2. Calculates slippage vs mid price in basis points
  3. Adds exchange taker fees (4-6 bps depending on venue)
  4. Applies confidence penalty for stale or unreliable data
Fee Rates (Taker):

Venue Scoring

Lower score = better venue. The confidence penalty prevents routing to venues with stale data even if displayed prices look better.

POST /order-execution/sor/estimate

Get routing estimate without executing.

Request Body (JSON)

  • symbol (string, required): Trading pair (e.g., “BTC/USDT”)
  • side (string, required): Order side: “buy” or “sell”
  • quantity (number, required): Order quantity in base currency
  • exchange_account_ids (array, required): List of eligible exchange account IDs
  • max_venues (number, optional): Maximum venues to use for splitting. Default: 3
  • max_slippage_bps (number, optional): Maximum allowed slippage in basis points. Default: 50

Request Example

Response Example


POST /order-execution/sor/execute

Create and execute a routing plan.

Request Body (JSON)

  • symbol (string, required): Trading pair (e.g., “BTC/USDT”)
  • side (string, required): Order side: “buy” or “sell”
  • quantity (number, required): Order quantity in base currency
  • exchange_account_ids (array, required): List of eligible exchange account IDs
  • max_venues (number, optional): Maximum venues to use for splitting. Default: 3
  • max_slippage_bps (number, optional): Maximum allowed slippage in basis points. Default: 50

Request Example

Response Example


GET /order-execution/sor/plan/

Retrieve status of a routing plan.

Path Parameters

  • plan_id (string, required): The routing plan ID

Request Example

Response Example


GET /order-execution/sor/venues

Get venue availability and cost estimates for a symbol.

Query Parameters

  • symbol (string, required): Trading pair
  • venues (string, optional): Comma-separated venue list (defaults to all)

Request Example

Response Example


Plan Status Values

Slice Status Values

Constraints

  • Minimum Slice Size: $10 USD equivalent
  • Maximum Venues: Configurable (default 3)
  • Minimum Confidence: 0.4 (venues below this are excluded)
  • Maximum Staleness: 2000ms (stale venues excluded)
  • Daily Limit: $100/day per exchange account (enforced)

Integration

The SOR uses:
  • GOB Module: For real-time orderbook data and quality metrics
  • Balance Cache: For available balances (from DB, updated by PMS)
  • TradingLimitService: For daily limit enforcement
  • ExecutionService: For actual order execution