Home

/

Library

/

phase1-skeleton.md

Phase 1 Skeleton (Ingest + Signal Only)

Phase 1 Skeleton (Ingest + Signal Only)

Scope

Single FastAPI app, async tasks for data ingestion and signal emission. No trading.

Core Loops

startup:
  launch discovery_loop()
  launch price_loop()

discovery_loop (slow):
  for venue in [polymarket, kalshi]:
    fetch active markets
    normalize -> MarketMetadata
    upsert into Postgres
  run mapping_heuristics()

price_loop (fast):
  for venue in [polymarket, kalshi]:
    fetch top-of-book or WS updates
    normalize -> MarketUpdate/OrderBookDepth
    publish to RabbitMQ
    emit socket.io updates
  run signal_detection()

Signal Detection (Minimal)

  • Compare best YES/NO asks across mapped markets.
  • Emit signal.arb.detected when yes + no < 100.
  • Emit to RabbitMQ + socket.io; no execution yet.

Minimal FastAPI Endpoints

  • GET /health status and version.
  • GET /markets latest normalized metadata.
  • GET /signals recent opportunities (in-memory or DB).

Suggested Files (No Execution Yet)

  • app/data/clients/polymarket.py
  • app/data/clients/kalshi.py
  • app/data/normalize.py
  • app/data/mapping.py
  • app/strategy/scorer.py
  • app/infra/db.py
  • app/infra/mq.py
  • app/api/http.py
  • app/api/socketio.py