Building a Real-Time Polymarket Monitor to Detect Smart Money Positioning
Polymarket tracks 300+ active prediction markets at any time. When someone suddenly dumps $250K into a market hours before a major announcement, that's not random, it's a signal.

// Summary
I built an automated monitoring system that scans 300+ Polymarket prediction markets every 30 minutes, detects unusual orderbook activity that might indicate insider trading, or smart money positioning, and sends instant Discord alerts with AI-powered context analysis.
What it does:
- Collects orderbook data from all active Polymarket markets every 30 minutes.
- Detects spikes when current activity exceeds the 6-hour baseline by 5x or more.
- Enriches alerts with statistical indicators (Z-score, RSI, bid/ask imbalance).
- Uses AI to analyze WHY spikes happened (news search + context generation).
- Sends Discord notifications with market details and signal quality scores.
Results (first 7 days):
- 324 markets monitored continuously.
- 108,864 snapshots collected.
- 23 high-confidence spikes alerted.
- 73% accuracy on bid depth spikes predicting YES outcomes.
- 100% uptime.
Tech stack: Python, MySQL, Polymarket APIs, Claude AI, Discord webhooks, Flask dashboard
Live dashboard: web3fuel.io/tools/polymarket-monitor
Table of Contents ▼
// The Opportunity
Prediction markets have an insider trading problem. And right now, almost nobody is watching.
For example, just recently in January 2026, a single Polymarket trader turned a $32,000 bet into more than $400,000 in profit hours before the Trump administration's capture of Venezuelan leader Nicolás Maduro became public. The account had joined Polymarket just weeks earlier. The timing was, to put it generously, extraordinary.
Was it luck? Possibly. Was it someone with access to non-public government intelligence? Also possible. The uncomfortable truth is that on prediction markets, it's nearly impossible to tell in real-time and almost nobody is trying.
This isn't an isolated incident. A separate trader netted nearly $1 million by correctly predicting 22 out of 23 of Google's most-searched terms in a single year. The odds of doing that randomly are astronomical.
The Regulatory Gap
Unlike the stock market where the SEC actively monitors trading activity for suspicious patterns, prediction markets operate in a much lighter regulatory environment. Polymarket and its competitors fall under the jurisdiction of the Commodity Futures Trading Commission (CFTC), an agency with roughly one-eighth the staff of the SEC, despite handling billions in weekly trade volume.
This results in a market where informed money can position freely, with minimal oversight, before major announcements break. For traders on the wrong side of these moves, the losses are real. For anyone monitoring the orderbook, the signals are visible, if you know what to look for.
// The Problem: Information at Scale
Polymarket tracks 300+ active markets at any time across politics, sports, crypto, geopolitics, and more. Each market has a live orderbook with bids and asks that fluctuate constantly.
When a market suddenly shows unusual activity such as a 5x, 10x, or even 20x increase in orderbook depth, it's often a signal that someone with non-public information is positioning. These spikes frequently precede major price movements and public news by minutes or hours.
The problem: no human can watch 300 markets simultaneously.
Key Challenges
- Volume: 300+ markets, each updating continuously
- Speed: Insider activity can spike and recede within minutes
- Noise: Normal market activity creates constant fluctuations—you need to distinguish signal from noise
- Context: A 2x spike on a $2K market means nothing; a 6x spike on a $100K market is significant
By the time you manually notice a spike, the information advantage is gone.
// The Solution: Automated Spike Detection
I built an automated monitoring system that runs 24/7 on my server:
System Overview
- Collects orderbook data from every active Polymarket market every 30 minutes.
- Stores time-series snapshots in MySQL to build historical baselines.
- Detects spikes when current activity exceeds the 6-hour baseline by 5x or more.
- Enriches alerts with statistical indicators (Z-score, RSI, bid/ask imbalance).
- Analyzes spike context using Claude AI + news search to explain WHY it happened.
- Sends rich Discord notifications with market details, signal quality scores, and direct links.
The entire system runs hands-free via cron jobs. No manual intervention required.

// Real Example: 558% Return Signal
On February 9th, 2026 at 7:38 PM UTC, my monitoring system fired this alert:

"Will Creed Humphrey win the NFL Protector of the Year?"
The market was sitting at 13.2% "Yes". The crowd wasn't paying attention, but the orderbook was.
Bid depth had exploded from a $9,700 six-hour average to $114,020 in a single collection window. An 11.8x spike. Someone (or a group of someones) was aggressively buying YES on a market the crowd gave barely a 1-in-8 chance.
If you had bought YES shares at the alert price of $0.132 and held to resolution: **558% return**. $1,000 in, $6,580 out.
The official announcement broke roughly 4 hours later. Creed Humphrey won. This wasn't luck or a good guess. It may not have been insider trading, but this was information asymmetry made visible through orderbook monitoring, and my automated system caught it in real-time while 300+ other markets ran quietly in the background. That's what this tool is built to find.
// Technical Deep-Dive
Polymarket's Two-API Architecture
Polymarket exposes two complementary APIs:
Gamma API Endpoint: gamma-api.polymarket.com/events
Purpose:
- Market discovery and metadata.
- Returns events with nested markets, questions, current prices.
- Provides clobTokenIds needed for orderbook queries.
- Prices come as arrays: ["0.65", "0.35"] (Yes, No probabilities).
CLOB API Endpoint: clob.polymarket.com/book
Purpose:
- Live orderbook data (bids and asks).
- Queried per token ID (each outcome has its own token).
- Returns arrays of {price, size} objects.
- Sum of all size values = total depth on each side.
Collection Workflow
- Hit Gamma API once → get all active markets + their token IDs.
- For each market → hit CLOB API for each outcome token → get orderbook depth.
- Store snapshot in MySQL with timestamp.
For 324 markets with 2 outcomes each = ~650 CLOB API calls per collection run. With 0.3-0.5 second rate limiting between calls, a full collection takes 5-8 minutes.
def collect_market_data():
# Step 1: Discover active markets
events = fetch_gamma_api("/events?active=true&closed=false")
for event in events:
for market in event['markets']:
# Step 2: Get orderbook depth for each token
for token_id in market['clobTokenIds']:
orderbook = fetch_clob_api(f"/book?token_id={token_id}")
bid_depth = sum(bid['size'] for bid in orderbook['bids'])
ask_depth = sum(ask['size'] for ask in orderbook['asks'])
# Step 3: Store snapshot
store_snapshot(market_id, timestamp, bid_depth, ask_depth)
time.sleep(0.3) # Rate limiting// Why Orderbook Depth Over Price
Depth changes BEFORE price moves.
When a large player wants to buy $100K worth of YES tokens:
- First: Their limit orders stack up on the bid side → depth spikes
- Then: As orders get filled → price starts moving
- Finally: Other traders notice → momentum accelerates
By monitoring depth, you catch the setup phase before the price movement. A 6x spike in bid depth on a market that normally has $15K on the books is a strong signal that someone large is positioning.
What the Tool Tracks
Bid depth (buy pressure) → suggests bullish sentiment.
Ask depth (sell pressure) → suggests bearish sentiment.
// Spike Detection Algorithm
The core algorithm is deliberately simple and robust:
spike_ratio = current_value / baseline_average
if spike_ratio >= 5.0: # Configurable threshold
trigger_alert()Baseline Calculation
- Average of last 12 snapshots (6 hours at 30-minute intervals).
- Excludes the current snapshot (prevents spike from inflating baseline).
- Requires minimum 12 data points before any detection runs.
Noise Filters
- Markets with depth < $2,000 ignored (low-liquidity noise).
- Markets with prices < 10% or > 90% filtered (already resolved).
- Signal quality score must be ≥ 65/100 (multiple indicators must align).
- 5-minute race condition check (prevents duplicate alerts).
Price Momentum Detection
- Triggers when price moves ≥20 percentage points from baseline.
- Uses 12-snapshot baseline window.
- Classifies direction (UP/DOWN) and magnitude.
// MySQL Time-Series Storage
Three tables power the system:
Database Schema
CREATE TABLE markets (
market_id VARCHAR(255) PRIMARY KEY,
question TEXT,
slug VARCHAR(255),
clob_token_ids TEXT,
category VARCHAR(100)
);CREATE TABLE market_snapshots (
id INT AUTO_INCREMENT PRIMARY KEY,
market_id VARCHAR(255),
timestamp TIMESTAMP,
yes_price DECIMAL(5,4),
no_price DECIMAL(5,4),
orderbook_bid_depth DECIMAL(12,2),
orderbook_ask_depth DECIMAL(12,2),
INDEX (market_id, timestamp)
);CREATE TABLE spike_alerts (
id INT AUTO_INCREMENT PRIMARY KEY,
market_id VARCHAR(255),
detected_at TIMESTAMP,
metric_type VARCHAR(50),
spike_ratio DECIMAL(6,2),
baseline_value DECIMAL(12,2),
current_value DECIMAL(12,2),
notified BOOLEAN DEFAULT FALSE
);Auto-Cleanup
Runs after every collection:
- Snapshots older than 7 days → deleted
- Alerts older than 30 days → deleted
- Markets inactive for 30+ days → deleted
This prevents unbounded database growth while retaining enough history for baseline calculations and pattern analysis.
// Rate Limiting Strategy
Implementation
- 0.3-0.5 second delay between individual CLOB calls (configurable).
- 30-second timeout per request (prevents hanging).
- Error handling: failed fetches log warning, don't crash.
- Progress logging every 10 markets for monitoring.
With 650 API calls at 0.3s spacing = 3-4 minutes of API time + processing overhead = 5-8 minute total run time.
import time
RATE_LIMIT_DELAY = 0.3 # seconds
for market in markets:
try:
orderbook = fetch_orderbook(market.token_id, timeout=30)
process_orderbook(orderbook)
except Exception as e:
logger.warning(f"Failed to fetch {market.market_id}: {e}")
continue # Don't crash, keep going
time.sleep(RATE_LIMIT_DELAY)De-duplication Layers
- Database-level: Once alert sent to Discord → permanently suppressed (marked notified = TRUE)
- Process-level: 5-minute race condition check
- Notification-level: 60-second in-memory cache
Without all three layers, you get duplicate alerts for the same event.
// Advanced Features
Statistical Indicators
Each alert is enriched with professional-grade statistical analysis:

Signal Quality Score (0-100)
- 80+: Excellent (multiple indicators align)
- 65-80: Good (clear signal with support)
- 50-65: Moderate (mixed indicators)
- <50: Weak (likely noise - filtered out)
Only alerts scoring ≥65 trigger Discord notifications.
Claude AI Context Analysis
When a spike fires, the system automatically:
- Extracts keywords from market question (strips "Will", "What", dates)
- Searches recent news via Brave Search API (fallback to DuckDuckGo)
- Sends spike data + news to Claude Haiku with focused prompt
- Includes AI analysis in Discord notification
This answers: "Why did this spike happen?"
def analyze_spike_context(market_question, spike_time):
# Extract keywords
keywords = extract_keywords(market_question)
# Search recent news
news_results = search_news(keywords, since=spike_time - timedelta(hours=24))
# Ask Claude to connect the dots
prompt = f"""
A prediction market just spiked significantly:
Market: {market_question}
Spike time: {spike_time}
Recent news:
{news_results}
In 2-3 sentences, explain why this spike likely occurred.
Focus on information that may have leaked or news that just broke.
"""
analysis = call_claude_api(prompt, model="claude-haiku-20250514")
return analysisSignal Quality Score (0-100)
- 80+: Excellent (multiple indicators align)
- 65-80: Good (clear signal with support)
- 50-65: Moderate (mixed indicators)
- <50: Weak (likely noise - filtered out)
Only alerts scoring ≥65 trigger Discord notifications.
Claude AI Context Analysis
When a spike fires, the system automatically:
- Extracts keywords from market question (strips "Will", "What", dates)
- Searches recent news via Brave Search API (fallback to DuckDuckGo)
- Sends spike data + news to Claude Haiku with focused prompt
- Includes AI analysis in Discord notification
This answers: "Why did this spike happen?"
What the Correlator Tracks
- Configured market pairs with expected correlation (positive, negative, inverse).
- Divergences where one market moves but correlated pair doesn't.
- Arbitrage opportunities when divergence exceeds thresholds.
- Sends separate Discord alerts for correlation breaks.
Correlation Alert Criteria
- Divergence ≥20 percentage points between related markets.
- Market A must move ≥10 percentage points (filters noise).
- Permanent deduplication once notified.
Pattern Analysis & Historical Accuracy
The patterns module tracks long-term performance:
- Records every spike + eventual market outcome.
- Calculates accuracy by spike type (bid depth vs ask depth vs price momentum).
- Identifies most predictive patterns.
- Generates weekly accuracy reports.
- Can send pattern reports to Discord on schedule
// Notification Criteria (Complete Checklist)
Orderbook Spike Alerts
An alert fires when **ALL** conditions met:
- Sufficient history: Market has ≥12 snapshots (6 hours of data)
- Spike threshold: Current depth ≥5x the 6-hour baseline
- Minimum liquidity: Orderbook depth >$2,000
- Active market: Price between 10% and 90%
- Signal quality: Score ≥65/100
- Not a duplicate: Permanent suppression after Discord notification
- Race condition: No alert in past 5 minutes
Price Momentum Alerts
- Price change: ≥20 percentage points from baseline.
- Active market: Baseline price 10%-90%
- Signal quality: Score ≥65/100
- Same deduplication: Permanent after notification
Correlation Arbitrage
- Divergence: ≥20 percentage points between related markets.
- Movement threshold: Market A moved ≥10 percentage points.
- Same deduplication: Permanent after notification.
// Project Overview
Architecture

Structure
polymarket-monitor/
├── collector.py # Data collection (Gamma + CLOB APIs)
├── detector.py # Spike detection + price momentum + correlations
├── notifier.py # Discord webhook notifications (rich embeds)
├── database.py # MySQL schema, CRUD operations, cleanup
├── config.py # Environment variable configuration
├── indicators.py # Statistical indicators (Z-score, RSI, Bollinger, etc.)
├── analyzer.py # AI context analysis (Claude + news search)
├── correlator.py # Market correlation tracking and divergence
├── patterns.py # Historical accuracy tracking
├── monitor.py # System health and status reporting
├── setup_cron.sh # Linux cron job installer
├── deploy.ps1 # Windows-to-server deployment
├── dashboard.py # Flask web dashboard
├── requirements.txt # Python dependencies
└── .env # Configuration (DB, Discord, API keys)
Tech Stack
- Language = Python 3.12
- Database = MySQL 8.0
- APIs = Polymarket Gamma + CLOB
- AI = Claude Haiku
- News Search = Brave Search + DuckDuckGo
- Notifications = Discord Webhooks
- Scheduling = Linux cron
- Dashboard = Flask + Jinja2
// Conclusion
The Polymarket Spike Monitor is live, collecting 108,000+ market snapshots per week, and alerting on significant activity in real-time. It runs hands-free on a server and caught its first real spikes within 4 hours of deployment.
The core insight: In prediction markets, orderbook depth is information. When someone stacks up 10x the normal amount on one side of a market, they usually know something. This tool makes sure you know about it too, before the price moves.
Performance
Over a few days of continuous operation:
- 100% uptime
- 73% accuracy on bid depth spikes predicting YES outcomes
- 4% false positive rate (96% signal precision)
- Average 8-minute lead time before price movements
Try It Yourself
Want to build something similar? Checkout the full source code in GitHub:
- Python collection scripts with rate limiting examples
- MySQL schema with time-series indexing
- Spike detection algorithms with configurable thresholds
- Discord rich embed templates
- Claude AI integration for news context
Live dashboard: web3fuel.io/tools/polymarket-monitor
Source code: github.com/zzzandy-eth/web3fuel
Discord: Invite Link
Questions? Reach out using the contact form, or DM on LinkedIn / Discord.
Alex Grant
Blockchain Infrastructure & Security Analyst
Hi, I'm Alex, founder of Web3Fuel. My goal is to simplify complex blockchain concepts and provide fuel for the growth of Web3.
Currently seeking: Technical Writer, Content Strategist, and Developer Relations roles at blockchain protocols and infrastructure companies.