Files
workspace/data/tasks/polymarket-sports-arb.md

62 lines
2.4 KiB
Markdown

# Polymarket Sports Arbitrage Scanner
**Priority:** HIGH — D J's top money-making project
**Assigned:** Glitch (build) → Hawk (review) → Jinx (QA)
**Created:** 2026-02-26
## Overview
Build a scanner that compares odds from D J's existing odds aggregation database (Postgres on VPS) against Polymarket sports market prices to find arbitrage opportunities.
## Architecture
```
[D J's VPS Postgres] ──→ Scanner ──→ [Polymarket API] ──→ Compare ──→ [Telegram Alerts]
(odds from books) (market prices) (find arb) (notify D J)
```
## Phase 1: Polymarket Sports Markets Reader (BUILD NOW)
- Fetch all active sports markets from Polymarket Gamma API
- Parse market structure: teams, outcomes, prices, liquidity, close time
- Store in local SQLite for comparison
- Telegram alerts when opportunities found
- **No DB dependency** — this phase uses only Polymarket public API
### Key APIs
- Gamma API: `https://gamma-api.polymarket.com/markets?active=true&closed=false`
- CLOB API: `https://clob.polymarket.com/` (order book depth, best bid/ask)
- Filter for sports: tags contain "Sports", "NFL", "NBA", "NHL", "MLB", "Soccer", etc.
## Phase 2: Odds DB Integration (AFTER D J provides PG access)
- Connect to D J's Postgres on VPS (read-only)
- Map book odds → implied probability
- Compare implied prob vs Polymarket price
- Flag when: `book_implied_prob > polymarket_price + fee + margin`
## Phase 3: Backtesting
- Historical odds vs Polymarket resolution
- Win rate, ROI, optimal thresholds
## Phase 4: Auto-execution (Future)
- Place bets via Polymarket CLOB API
- Position sizing, bankroll management
## Technical Notes
- Polymarket Data API is public, no auth for reads
- kch123 wallet analysis shows sports arb is proven ($9.37M P&L)
- kch123's edge: ~30-60s detection window, negligible for pre-game bets
- Reference: `data/investigations/polymarket-15min-arb.md` (different strategy but same platform)
- Existing scanner: `projects/crypto-signals/scripts/polymarket_arb_scanner.py` (15-min crypto, reuse patterns)
## Constraints
- Python (match existing infra)
- Telegram alerts (same pattern as CoinEx trader)
- Systemd timer (5-15 min interval)
- Zero AI tokens — pure Python
- Paper trade first, log all opportunities
## Deliverables
1. `projects/crypto-signals/scripts/polymarket_sports_scanner.py`
2. Systemd service + timer
3. Telegram alert integration
4. Local SQLite for market history
5. Unit tests