Skip to content

Market Data Ingestion Plan

Goal

Ingest real-time orderbook data from Polymarket (CLOB) and Kalshi (Exchange) to feed the Arbitrage Engine.

Polymarket (CLOB)

  • Protocol: WebSocket
  • Endpoint: wss://ws-fidelity.polymarket.com
  • Message Format: JSON
  • Channels: book (L2 Orderbook)

Kalshi

  • Protocol: WebSocket
  • Endpoint: wss://api.kalshi.com/trade-api/v2/ws

Implementation Steps

  1. Types: Define normalized OrderBook struct in types/market.rs.
  2. Polymarket Monitor:
  3. Connect to WS using tokio-tungstenite.
  4. Parse messages.
  5. Update local state.