PredictEdge is a live quant-style dashboard and automation stack for Polymarket crypto direction markets (BTC, ETH, SOL, XRP) across 5m, 15m, and 1h windows.
- Streams live market/streak data over WebSocket
- Ingests active + historical market data from Gamma and CLOB APIs into SQLite
- Runs configurable strategies (default: streak reversal — 6× UP/DOWN + USD momentum reversal)
- Auto-claims winnings (Safe-based claim flow)
- Quant cockpit: regime, edge health, signal tape, execution tracker
- Real-time React dashboard
backend/— FastAPI, ingestion (Gamma + CLOB), analytics, trading, auto-claimerfrontend/— React + Vite dashboard (streaks, Quant Cockpit, Execution Tracker)start.sh— starts backend + frontend (ports configurable via.env), optional full historical sync
- Resolutions / winner: From Gamma API (
/eventsby tag or slug,/markets).outcomePrices→ UP/DOWN. - Spot open/close (for
spot_change_usd): Gamma only —eventMetadata.priceToBeatwhen present; previous window’s close = next market’sprice_to_beat. No Binance or other backfill; CLOB/prices-historyis token price, not underlying spot. - Historical sync: Every 5 min: primary Gamma
/markets?closed=true&tag_slug=cryptoplus tag-based sync (events pages 1–8) so BTC 5m/15m resolutions are always present. - Live: CLOB orderbook/midpoint, spot feed (Binance) for live ticks; strategy logic reads from DB (
market_resolutions,auto_trade_orders). - Strategy mode (
STRATEGY_MODE):streak_reversal(default),all, orpattern. Streak reversal uses only streak + USD reversal triggers;allruns pattern + fast_reversal + streak_reversal.
cd backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtcd ../frontend
npm installCreate .env in repo root (or update existing) with at least:
CLOB_HOST=https://clob.polymarket.com
GAMMA_HOST=https://gamma-api.polymarket.com
POLYGON_RPC_URL=<your_polygon_rpc_url>
PRIVATE_KEY=<your_private_key>
WALLET_PROXY_SAFE=<your_safe_or_wallet_address>
CLOB_API_KEY=<your_clob_api_key>
CLOB_SECRET=<your_clob_secret>
CLOB_PASS_PHRASE=<your_clob_passphrase>
# Strategy (default: streak_reversal)
STRATEGY_MODE=streak_reversal
STREAK_REVERSAL_SIZE=100
STREAK_REVERSAL_ORDER_PRICE=0.50
DEFAULT_ORDER_SIZE=10
AUTO_TRADE_LOOP_SECONDS=30
TOP_PATTERN_COUNT=10
MIN_PATTERN_WIN_RATE_PCT=55
AUTO_CLAIM_INTERVAL_SECONDS=600Notes:
- CLOB API credentials can be auto-generated from
PRIVATE_KEYon startup if missing. POLYGON_RPC_URLis required for claim execution.WALLET_PROXY_SAFEis the proxy/Safe address used for orders and claiming.
From repo root:
./start.shApp URLs (default ports; override via .env):
- Frontend:
http://localhost:3000(orFRONTEND_PORT) - Backend:
http://localhost:8888(orPORT) - API docs:
http://localhost:8888/docs
Production: Set HOST=0.0.0.0, PUBLIC_HOST=<your-server-ip> in .env so URLs reflect the server address.
./start.sh --full-clob-sync --clob-pages=1-100You can run additional bounded chunks:
./start.sh --full-clob-sync --clob-pages=101-200- Backend starts spot feed, CLOB ingestion, historical sync loop (Gamma every 5 min), then traders and auto-claimer based on
STRATEGY_MODE. - With
STRATEGY_MODE=streak_reversal(default): only StreakReversalTrader and AutoClaimer run; no pattern or fast_reversal. - Streak reversal: 6× consecutive UP → buy DOWN (and vice versa); or previous market |spot_change_usd| > $200 (5m) / $400 (15m) → contrarian order on next market.
- Dashboard: live streaks, Quant Cockpit (regime, edge health, signal tape), Execution Tracker (orders placed/executed/wins/losses).
- WebSocket broadcasts live market/streak data; API docs at
/docs.
- If ports are busy,
start.shprompts to kill existing services. - If claims fail, verify:
POLYGON_RPC_URLis reachablePRIVATE_KEYowner matches configured Safe owner- wallet has claimable winning token balances
- If WebSocket shows disconnected, ensure backend is healthy at
/health.
- Resolution/strategy data:
PYTHONPATH=backend python backend/scripts/verify_btc_resolutions.py— shows recent BTC 5m/15m resolutions, streak check, USD reversal check, and strategy data checklist (Gamma-only spot; no backfill). - Price-to-close logic:
PYTHONPATH=backend python backend/scripts/verify_gamma_price_to_beat.py— checks that next market’sprice_to_beatis used as previous market’s close.
- Quant signal ideation and roadmap are tracked in
QUANT_SIGNALS_NOTES.md.