Skip to content

About

Polymarket Infrastructure Tools — CLOB Indexer, OMS, Market Maker, Smart Order Router, Arb Engine, CLOB Simulator

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Polymarket Infrastructure Tools

A professional-grade operations dashboard and infrastructure layer for Polymarket quant traders and engineers. Six standalone tools covering every part of the trading stack — from raw on-chain data to market making, order routing, cross-venue arbitrage, and local simulation.

Live app: Part of the Polymarket Hub monorepo, served at /infra-tools/


Tools

Tool Path Description
CLOB Indexer /infra/indexer/* Streams and stores on-chain fills from Polygon
OMS /infra/oms/* Position tracking, fill reconciliation, double-entry P&L
Market Maker /infra/mm/* Configurable quote engine with kill switch
Smart Order Router /infra/sor/* TWAP/VWAP execution for large positions
Arb Engine /infra/arb/* Cross-venue arb detection vs Kalshi, Manifold, PredictIt
CLOB Simulator /infra/sim/* In-memory matching engine for local testing

Architecture

artifacts/
  infra-tools/          # React + Vite frontend
    src/
      pages/
        dashboard.tsx   # Mission Control overview
        indexer.tsx
        oms.tsx
        market-maker.tsx
        smart-router.tsx
        arbitrage.tsx
        simulator.tsx

artifacts/api-server/
  src/routes/
    infra-indexer.ts    # GET/POST /infra/indexer/*
    infra-oms.ts        # GET /infra/oms/*
    infra-mm.ts         # GET/PUT /infra/mm/*
    infra-sor.ts        # CRUD /infra/sor/orders
    infra-arb.ts        # GET/POST /infra/arb/*
    infra-sim.ts        # matching engine + /infra/sim/*

lib/
  api-spec/openapi.yaml # Single source of truth for all contracts
  db/src/schema/
    infra-indexer.ts    # indexer_fills, indexer_state
    infra-oms.ts        # oms_positions, oms_fills, oms_ledger
    infra-mm.ts         # mm_configs, mm_quotes, mm_inventory
    infra-sor.ts        # sor_orders, sor_child_fills
    infra-arb.ts        # arb_markets, arb_opportunities
    infra-sim.ts        # sim_orders, sim_fills, sim_book_orders, sim_positions

Tech Stack

  • Frontend: React 18, Vite, TanStack Query, Recharts, Tailwind CSS
  • Backend: Express 5, TypeScript, Drizzle ORM
  • Database: PostgreSQL (Replit managed)
  • API contract: OpenAPI 3.1 → Orval codegen (Zod validators + React Query hooks)
  • Chain: Polygon PoS (primary RPC: polygon-rpc.com, fallback: 1rpc.io/matic)

Getting Started

# Install dependencies
pnpm install

# Push database schema
pnpm --filter @workspace/db run push

# Regenerate API client after spec changes
pnpm --filter @workspace/api-spec run codegen

# Start API server
pnpm --filter @workspace/api-server run dev

# Start frontend
pnpm --filter @workspace/infra-tools run dev

Database Tables

Table Purpose
indexer_fills Indexed on-chain CLOB fill events
indexer_state Indexer sync state (block cursor)
oms_positions Open and closed trader positions
oms_fills Individual fill records
oms_ledger Double-entry accounting ledger
mm_configs Market maker configuration
mm_quotes Resting quote history
mm_inventory Per-token inventory snapshots
sor_orders SOR parent orders
sor_child_fills Individual slice fills under a SOR order
arb_markets Configured cross-venue market pairs
arb_opportunities Detected and executed arb opportunities
sim_orders Simulator order history
sim_fills Simulator fill history
sim_book_orders Active resting orders in the sim orderbook
sim_positions Simulated net positions

Roadmap

  • Live Polygon RPC indexing via eth_getLogs on the Exchange contract
  • SOR child-slice scheduler (setInterval / Chainlink Automation)
  • Real Kalshi + Manifold price polling for the arb scanner
  • WebSocket price feeds for the MM and sim orderbooks
  • Bright Data geo-bypass integration for US traders

Related

About

Polymarket Infrastructure Tools — CLOB Indexer, OMS, Market Maker, Smart Order Router, Arb Engine, CLOB Simulator

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors