โ† Back to Dashboard

Polymarket Earnings Trading Bot

A comprehensive data tracker and automated trading system for Polymarket prediction markets, focused on earnings trading strategy via IBKR.

Features

Documentation

Document Purpose
docs/AGENT_HANDOFF.md Onboarding for new agents/operators โ€” full doc index, deploy, rules, code map. ยง11 has the current state + ranked outstanding work.
docs/STRATEGY_PLAYBOOK.md Forward-looking source of truth for strategy improvements: ranked Action Queue, verified findings (mechanism + bias check), retracted findings (so they don't get re-suggested), implementation notes per rule. Mirrors the dashboard ๐ŸŽฏ Action Queue tab.
docs/STRATEGY_AUDIT_v3.md Audit trail โ€” every hypothesis tested, audit-process learnings, ยง10 Apr 25 retraction of Finding A via the comprehensive simulator.
docs/FINDINGS.md Canonical narrative for every numbered finding (per .cursor/memory.md ยงJ). For the live production baseline, see newest DEPLOYED entries in FINDINGS and docs/AGENT_HANDOFF.md ยง11 (do not use a frozen "Latest: #N" pointer โ€” drift class C7). Headline weeks (history): #227 (Apr 21โ€“22 learning loop), #228 (Apr 25 Finding-A retraction), #240 (Apr 26 equity 1m bars infrastructure), #250-#261 (Apr 27 Database Integrity Audit + dashboard rebuild), #262-#274 (Apr 27 evening โ€” dashboard 500 chain + rigorous re-audit).
docs/DATABASE_AUDIT_2026_04_27.md Frozen baseline of the Apr 27 audit + post-audit appendix listing what shipped (Phase 1-6 outcomes + tonight's findings #267-#274).
docs/DATA_ARCHITECTURE.md DB tables, collectors, retention. v1.6 (Apr 27, post-audit).
docs/DATA_INTEGRITY.md Integrity monitor architecture (replaces v2/v3 watchdogs Apr 27). Rule count is live via GET /api/integrity โ†’ summary.total (src/data_tracker/integrity_monitor.py; was 37 post-#291 May 10, 2026). Volume gate default $1,000 (Config.SIGNAL_MIN_VOLUME_TOTAL, Finding #311).
docs/STRATEGY.md Long-form trading rules, position sizing, schedules, exchange semantics.
docs/OPERATIONS.md Deployment, infrastructure, services, backfill, simulator/report regeneration.
docs/API_REFERENCE.md Polymarket API reference (gamma-api, data-api, clob, WSS)
src/ibkr/IBKR_INTEGRATION_SPEC.md IBKR integration details

GitHub + CI Flow

Repo: https://github.com/eumarius/earnings-trading-bot-.git

Flow: local machine โ†’ GitHub โ†’ server Deploy: [hidden]/deploy/deploy_from_github.sh

CI checks: scripts/verify_retry_backoff_and_block.py runs on every push/PR
Alerts: Telegram on failure (configured via GitHub Actions secrets)

Quick Start

Dashboard

http://[hidden]:8080

Check Server Status

ssh root@[hidden]
ps aux | grep -E 'gamma_collector|backfill|uvicorn' | grep -v grep

Local Development

cd /Users/marius/projects/polymarket-bot
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt -c constraints.txt  # prod versions (#473)
cp .env.example .env  # Configure DATABASE_URL

Key Configuration

# .env file
DATABASE_URL=postgresql+pg8000://user:[REDACTED]@host:25060/defaultdb
# DOME_API_KEY removed Finding #289 (Dome EOL Apr 28, 2026). All consumers migrated to data-api.polymarket.com.

Strategy Summary

Live state (Apr 25, 2026): 109 closed trades, +$61 net P&L, 33 % win rate. Direction is correct 83 % of the time; the leak is in the stop-loss conversion. See docs/STRATEGY_PLAYBOOK.md ยง1 for the current verdict and ยง2 for the ranked action queue (mirrored in the dashboard ๐ŸŽฏ Action Queue tab).

Original projections (kept for reference):

Phase Capital Leverage Expected ROI
Phase 1 $25,000 2x +50.6%/season
Phase 2 $110,000 6x +166.2%/season

Core rules (current): - Conviction โ‰ฅ70 % โ†’ Trade ยท โ‰ฅ90 % LONG โ†’ SKIP (Mar 9, Finding #202) - Beat โ‰ฅ70 % โ†’ LONG | Miss โ‰ฅ70 % โ†’ SHORT - BMO > AMC priority ยท BMO exit at 10:32 AM ET (extended hold) - Volume gate $2K cumulative (max(DB, Gamma) โ€” Finding #282, Apr 30 2026; previously "DB else Gamma" per Findings #222-#226) - All stops use STOP-LIMIT with 2 % buffer (Finding #179) - Up next: skip LONGs in downtrend, drift filter, Mid-cap conviction tightening โ€” see Action Queue.

See docs/STRATEGY.md for the long-form rules and docs/STRATEGY_PLAYBOOK.md for the operational forward plan.

Project Structure

polymarket-bot/
โ”œโ”€โ”€ docs/                      # Documentation
โ”‚   โ”œโ”€โ”€ STRATEGY.md           # Trading strategy
โ”‚   โ”œโ”€โ”€ OPERATIONS.md         # Deployment & operations
โ”‚   โ”œโ”€โ”€ API_REFERENCE.md      # API reference
โ”‚   โ””โ”€โ”€ archive/              # Old documentation
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ earnings/             # Trading automation
โ”‚   โ”œโ”€โ”€ data_tracker/         # Data collection
โ”‚   โ”‚   โ””โ”€โ”€ collectors/       # gamma_collector, backfill scripts
โ”‚   โ””โ”€โ”€ ibkr/                 # IBKR integration
โ”œโ”€โ”€ earnings_dashboard/       # Web dashboard
โ”œโ”€โ”€ archive/PROJECT_STATUS.md # Historical snapshot (archived)
โ”œโ”€โ”€ constraints.txt           # Full prod venv freeze (install constraints)
โ””โ”€โ”€ requirements.txt          # Dependencies, pinned to prod (#473)

Current Status (Apr 25, 2026)

Component Status
Earnings trader (live) โœ… earnings-trader.service active โ€” IBKR Live Gateway, ~$2,440 trading capital
Data Collection โœ… polymarket-collector.service (markets + orderbooks every 60s)
Outcome resolver โœ… polymarket-resolver.timer daily 06:00 ET (Finding #227)
Database โœ… PostgreSQL + TimescaleDB on DigitalOcean
Dashboard โœ… Live at http://[hidden]:8080 (๐Ÿ“ˆ Strategy Analysis tab = forward plan; ๐ŸŽฏ Action Queue at top of that tab)
Strategy work ๐Ÿ“‹ Apr 25: Finding #228 retracted v3 Finding A; ranked queue in docs/STRATEGY_PLAYBOOK.md ยง2

โš ๏ธ Disclaimer

This bot is for educational purposes. Trading involves risk. Always:

License

MIT