How blockrunai/polymarket-agent works
This repository is a Polymarket prediction-market trading agent with a Flask monitoring dashboard and CLI. Its principal workflow is to discover active markets, gather smart-money trade signals, obtain AI analysis, size potential positions, and—when enabled—submit trades. Wallet management supports Polygon trading, while the README describes the agent’s separate Base-chain AI payments. Optional Google Cloud Storage persists market analyses and agent history. The graph follows documented or indexed dependencies; some runtime wiring is not visible in the excerpts, so uncertain links are omitted.
Main entry points: app.py Web Dashboard · agent.py Agent Coordinator · ai_analyzer.py AI Consensus · executor.py Order Execution
Components 15
User Interfaces
- Web Dashboard
app.py - Dashboard Views
templates/index.html - CLI
main.py - Agent Coordinator
src/agent.py
Market Intelligence
- Market Discovery
src/market/polymarket.py - Smart-Money Signals
src/signals/trades.py - AI Consensus
src/analysis/ai_analyzer.py
Trading Operations
- Kelly Sizing
src/utils/kelly.py - Order Execution
src/trading/executor.py - Polygon Wallet
src/trading/wallet.py
Persistence
- GCS Persistence
src/storage/gcs_storage.py
Other components
- Operator
- BlockRun AI
- Polymarket APIs
- Polygon Network
Connections 23
- Operator → Web Dashboard: monitors
app.py - Operator → CLI: runs
main.py - Web Dashboard → Dashboard Views: renders
app.py - CLI → Agent Coordinator: creates
main.py - Web Dashboard → Market Discovery: fetches markets
app.py - Web Dashboard → AI Consensus: requests analysis
app.py - Web Dashboard → Smart-Money Signals: requests signals
app.py - Web Dashboard → Order Execution: uses
app.py - Web Dashboard → Polygon Wallet: uses
app.py - Web Dashboard → GCS Persistence: persists analyses
app.py - Agent Coordinator → Market Discovery: fetches markets
src/agent.py - Agent Coordinator → Kelly Sizing: sizes opportunities
src/agent.py - Agent Coordinator → AI Consensus: analyzes markets
src/agent.py - Agent Coordinator → Order Execution: executes trades
src/agent.py - Agent Coordinator → Polygon Wallet: checks status
src/agent.py - Market Discovery → Polymarket APIs: fetches market data
src/market/polymarket.py - Smart-Money Signals → Polymarket APIs: fetches trade data
src/signals/trades.py - AI Consensus → BlockRun AI: requests model analysis
README.md - AI Consensus → Smart-Money Signals: uses signal context
- Order Execution → Polygon Wallet: uses wallet
src/trading/executor.py - Order Execution → Polymarket APIs: places orders
README.md - Polygon Wallet → Polygon Network: reads and signs
README.md - GCS Persistence → Polymarket APIs: stores market records