Data Engineering
FastAPI
Trading
Polymarket
Architecture

Polymarket Copy Trading: A Technical Rabbit Hole

June 4, 2025
14 min read
Intermediate
Polymarket Copy Trading: A Technical Rabbit Hole
TL;DR

This is the story of how I went from crawling Polymarket wallets to find traders worth following, to discovering third-party sites had already done the hard work, to realizing updown markets were uniquely suited for copy trading, to building a paper engine with realistic delays and fees, to comparing two real strategies that changed how I think about win rates—and finally building a quant simulator to understand why a bot with 52% win rate outperformed a human with 72%.

1. Building a Crawler to Find Polymarket Traders

Polymarket is a prediction market where you can bet on anything — elections, Bitcoin, sports, whether GTA VI ships before 2027. I'd been watching from the sidelines, and I had a simple question:

Can you find traders who consistently win, and learn from what they're doing?

I didn't want to become a whale. I just wanted to understand the game. So I started writing code to pull wallet data from Polymarket's public APIs.

The API Landscape

Before you can analyze anything, you need data. Polymarket exposes several APIs, each with different trade-offs:

Gamma API

Public, no auth. Returns market metadata (titles, categories, outcome prices, resolution status). Great for discovering what markets exist. Limited — no trade-level data.

CLOB API

The "real" exchange API — order books, depth, historical trades. Requires authentication. The most complete data source, but the auth barrier makes it impractical for casual exploration.

Polymarket Data API

The sweet spot. Public, no auth. Returns trade history filtered by wallet address (?user=0x...) or market. This became the backbone of everything.

RPC

Raw on-chain data via JSON-RPC. Unreliable for trading analysis — parsing event logs is slow and unstructured. Used briefly for on-chain verification then abandoned.

Falcon API

Third-party aggregator (narrative.agent.heisenberg.so) wrapping Polymarket data with AI-categorized trade feeds. Polls every 15 seconds. Excellent for timeliness — crucial when copy-trading in near-real-time.

Binance API

Public price feeds for crypto assets. Used for real-time price context. Challenge: Polymarket outcomes resolve to binary yes/no, while Binance prices are continuous. Synchronizing the two requires careful timestamp alignment and is never perfectly accurate.

From Market-Centric to Wallet-Centric

The first version of the crawler fetched trades by top markets. This gave me about 3 trades per wallet — completely useless for profiling. Then I realized the Data API supports filtering by ?user=0x...:

crawler-strategy
Market-centric:  GET /markets → 1000 markets → 3 trades/wallet → useless
Wallet-centric: GET /trades?user=0x... → 600+ trades/wallet → actual profiles

This one change took the average from 4 to 604 trades per wallet.

Recursive Discovery

Polymarket trades include a proxyWallet field — the counterparty on each trade. When you pull trades for wallet A, you see every wallet it traded against. So I built a recursive discovery loop:

  1. Seed 5 known wallets
  2. Crawl their trades → discover co-traders
  3. Insert discovered wallets into the queue
  4. Crawl the new wallets → discover more co-traders
  5. Repeat
From 5 seeds to 37 wallets

Starting from 5 seed wallets, the first full crawl cycle discovered 37 active wallets. Some were whales with $100K+ volume. Others were clearly bots — trading the same pattern every 5 minutes. And some were just regular traders who happened to be good at one specific market type.

I also experimented with a scoring system to rank wallets — composite metrics for volume, win rate, diversity, activity, recency. It worked, but it was slow, limited, and blind compared to what I found next.

2. Using Existing Tools to Find Better Traders Faster

Around this time I discovered Polymarket Analysis and PolyBuild — platforms that already scrape and categorize Polymarket wallets with far better data than my crawler could produce. Instead of reinventing discovery, I could use these to find specialized traders directly.

From Crawling to Curating

The crawler was useful for understanding the data pipeline, but the real value came from curation. Third-party sites had already solved wallet discovery — I could skip straight to evaluation and execution.

This is where the project shifted from building a crawler to finding the right traders to copy. And the most interesting category I found was traders focused on crypto updown markets.

PolyBuild provides wallet categorization and ranking — here you can see traders sorted by win rate, trade volume, and activity:

PolyBuild interface showing wallet categorization and ranking

Polymarket Analytics offers a broader discovery dashboard with market insights and trader performance metrics:

Polymarket Analytics dashboard for trader discovery

3. Why General Markets Locked My Bankroll — and How Updown Markets Fixed It

Here's an example of an updown market — a short-term binary prediction with a countdown timer:

Polymarket updown market — "Bitcoin above $85K in 15 minutes" with Yes/No buttons and countdown timer

When I started copying traders, I didn't discriminate by market type. If a trader was active in F1 championship markets, I copied them. Tennis match outcomes, same thing. Political events, presidential elections — I followed their positions there too.

The trades were often profitable. The problem was something else.

The Capital Trap

A typical Polymarket market resolves when the event happens. An F1 race is this weekend. A tennis match is tomorrow. A political outcome could take months. Your money is locked until resolution — even if the position is winning, you can't use that capital for anything else.

I had positive PnL on paper, but my available bankroll was near zero. Positions were sitting in unresolved markets, waiting days or weeks to settle. I couldn't compound, couldn't chase new opportunities, couldn't even test other strategies.

This is when I noticed a specific category of traders who had the opposite problem: they traded crypto updown markets — markets like "Bitcoin above $85K in 15 minutes" — and their bankroll was never stuck.

The Updown Insight

Updown markets resolve every 15 or 5 minutes. This completely changes the dynamics:

  • Bankroll recycles fast: you get your capital back after each resolution
  • No long position lock: you never have to wait days for an exit
  • Compounding potential: a 15-minute cycle means up to 96 trades per day
  • Copy trading actually works: when a target wallet trades an updown market, you can enter immediately and exit at the same resolution

The specialized updown traders I found via Polymarket Analysis were executing 50–100 trades per day. Their volume was high, their resolution accuracy was good — and most importantly, their capital was always turning over. No waiting. No locking.

4. Building a Paper Trading Engine With Realistic Conditions

Falcon API
Real-time trade signals
CLOB API
Order book + trades
Gamma API
Market metadata
Engine
Filter trades - safety rules
Executor
Polymarket SDK — simulated fills
Backend
Postgre - FastAPI
Frontend
React - TypeScript
System Architecture: data sources, engine, and executor

The engine needed to poll trades in real-time, filter by safety rules, execute simulated fills, and track everything in PostgreSQL. I wanted one thing to be realistic from the start:

Simulating Real Delay

When the engine detects a target wallet placing a trade, it doesn't just copy the buy price from the detection event. It looks up the market price independently after a configurable delay — simulating the real latency between detection, transaction submission, and block confirmation. This means the simulated fill price is always slightly worse than the target's, which is exactly what happens in reality.

Safety Strategies

The first version had no guardrails. The second one learned quickly:

1

One Trade Per Market

Never enter a second position on a market you're already trading. Prevents double-exposure on the same outcome.
2

Definitive Position Sizing

Each trade gets a fixed percentage of the available bankroll. No variable sizing based on confidence — that comes later in the analysis phase.
3

Max Percentage per Wallet

No single wallet's trades can consume more than a configurable % of total capital. If one wallet is hyperactive, it can't dominate the portfolio.
4

Budget Hard Cap

The engine enforces a strict budget. If capital is exhausted, no new trades until positions resolve and free up funds.

Friction Simulation: Fees, Slippage, Gas

Paper trading is easy when you ignore costs. Real Polymarket trading has friction:

Polygon Gas Fees (MATIC)

Polymarket runs on Polygon, meaning every trade requires a gas fee in MATIC. The simulator deducts a configurable cost per transaction (~0.01–0.05 MATIC depending on network congestion). For a strategy executing 50+ trades per day, gas alone can eat 5–10% of your bankroll monthly.

Slippage from Realistic Fills

Because the engine uses post-detection pricing instead of the target's execution price, slippage is built into every fill. I also added a configurable slippage multiplier (0.1–0.5%) to account for edge cases. Over hundreds of trades, this compounds significantly.

Opportunity Cost of Blocked Capital

Every dollar in an unresolved position can't be deployed elsewhere. In updown markets this is minimal (15-min cycles), but for longer-duration positions it becomes the dominant friction.

5. Comparing a 72% Win Rate Human Against a 52% Bot

I started the paper engine with $100 and began tracking two very different targets:

paper-trading-results
Target A: Human trader
Win rate:  72%  |  Trades:  177  |  PnL:  +$304

Target B: Trading bot
Win rate:  52%  |  Trades: 3339  |  PnL:  +$902

The bot had a 52% win rate — barely above a coin flip. But it made 3x more money than the human with 72%.

Here are the results from the Strategizer dashboard for each target:

Target A — the human trader showed strong individual picks but limited volume:

Strategizer dashboard showing human trader results: 72% win rate, 177 trades, +$304 PnL

Target B — the trading bot made up for its lower accuracy with sheer frequency:

Strategizer dashboard showing bot results: 52% win rate, 3339 trades, +$902 PnL

This was the moment I realized win rate alone doesn't tell you much. The bot traded 19x more frequently, giving it more opportunities to compound. Its lower win rate was compensated by volume — sheer frequency of trades with a small but consistent edge.

What This Means

A trader with 72% win rate making 10 trades has less impact than a bot with 52% making 1,000. Position sizing, trade frequency, bankroll management, and drawdown resilience matter as much — sometimes more — than the percentage of winning bets.

This comparison pushed me from building a copy engine into building a quantitative framework to understand what actually drives PnL.

6. From Copying to Understanding: Simulating Kelly, Risk of Ruin, and Drawdown

I had two real data points from the engine. But I couldn't answer the obvious question: which strategy would survive longer? What if I ran them both for 10,000 trades? What if the market conditions changed?

The Variables I Wanted to Explore

  • Win rate — percentage of trades that resolve correctly
  • Position sizing — what % of bankroll per trade?
  • Estimated value per trade — (winRate × avgWin) – (lossRate × avgLoss)
  • Kelly Criterion — f* = (b·p – q) / b — what fraction of capital maximizes long-term growth?
  • Risk of Ruin — R = ((1 – edge)/(1 + edge))^n — the probability of going to zero
  • Initial bankroll — how much capital do you need to survive the inevitable losing streak?
  • Max drawdown — how painful is the ride?

The Strategizer

I built a 9-page React application to simulate and compare these variables:

Kelly Criterion

Computes optimal sizing based on win rate and risk/reward ratio. Zero-clamped. The formula that separates gambling from investing — and the one that explained why the bot's 52% was sustainable.

Monte Carlo Simulation

5,000 random walks per configuration. Supports fixed, full-Kelly, half-Kelly, and quarter-Kelly sizing. Shows you the range of outcomes, not just the average.

Risk of Ruin Dashboard

Visualizes the probability of portfolio depletion as a function of edge, bankroll, and position size. A useful reality check when you're designing a strategy.

Strategy Compare

Side-by-side comparison of 2–3 strategy configurations across 13 metrics. Overlaid equity curves, drawdown charts, and color-coded best-value highlighting. This is where the 72% human and 52% bot finally made sense.

src/lib/calculations.ts
// Kelly Criterion — what fraction of capital to risk?
export function calcKelly(winRate: number, avgWin: number, avgLoss: number): number {
if (avgLoss === 0) return 0;
const b = avgWin / avgLoss;       // odds ratio
const f = (b * winRate - (1 - winRate)) / b;
return Math.max(0, f);
}

// Risk of Ruin — probability of going to zero
export function calcRiskOfRuin(capital: number, avgWin: number, avgLoss: number,
                             winRate: number, riskPerTrade: number): number {
if (avgLoss === 0) return 0;
const edge = 2 * winRate - 1;
if (edge <= 0) return 1;          // negative edge → certain ruin
const n = (capital * riskPerTrade) / avgLoss;
return Math.pow((1 - edge) / (1 + edge), n);
}

What the Numbers Said

Plugging the two real strategies into the simulator confirmed what the raw data suggested:

Volume Compensates for Edge

The bot's 52% win rate looked weak in isolation, but its massive trade count (3339 vs 177) meant it had 19x more opportunities to compound. Even a tiny edge per trade, repeated hundreds of times, outperforms a large edge used sparingly — provided you survive the variance.

Bankroll Is Your Shock Absorber

The Risk of Ruin formula showed that a small bankroll dramatically increases your probability of ruin even with a positive edge. The human trader's 72% win rate looked safe — until the simulator showed that a single bad streak with 177 trades could erase them. The bot's 3339 trades gave it statistical smoothing.

There Is No Perfect Answer

After dozens of simulation runs comparing sizing strategies, Kelly fractions, and bankroll scenarios, I realized there's no universal optimum. The best configuration depends on your risk tolerance, the specific trader's edge profile, and market conditions. The simulator doesn't give you answers — it gives you a framework to ask better questions.

7. What's Left: From Paper Trading to Real Execution

The crawler finds wallets. The engine copies them with realistic delays and fees. The strategizer analyzes whether the strategy makes mathematical sense. But there's still a gap between simulation and reality:

What's Left

  • Connect a real Polymarket wallet — the paper engine simulates everything except actual execution. Real fees, real gas, real slippage on mainnet.
  • Monitor trader performance drift — a wallet that was profitable last month might not be next month. Performance decay is the norm, not the exception.
  • Find consistently good traders to follow — the discovery tools exist, but "good" is contextual. A trader who excels at sports markets might be terrible at crypto updowns. I'd like to open this up: if you know wallets worth tracking, or you're building something similar, I'm genuinely interested.

Regulatory Disclaimer

Polymarket & French Regulation

Polymarket is not licensed or regulated by the Autorité Nationale des Jeux (ANJ) in France. Accessing the platform from French territory may be restricted. Prediction market trading carries financial risk — never deploy capital you're not prepared to lose. This project is a technical exploration, not financial advice.

What I'm Actually Looking For

I built a set of tools to explore a curiosity, and along the way I learned that 72% win rate can be less valuable than 52% — if the 52% comes with volume, discipline, and bankroll management.

The system has gaps, the analysis has blind spots, and I'd love to hear from people who know more about this space than I do. If you're tracking Polymarket wallets, building copy strategies, or have opinions on Kelly fractions for prediction markets — I'd love to compare notes.

TL;DR

I started with a crawler, found better discovery tools already existed, built a paper engine with realistic delay simulation, and ended up comparing a 52% win rate bot that outperformed a 72% human by 3x. That led me down a quantitative exploration of Kelly Criterion, Risk of Ruin, Monte Carlo, max drawdown, and position sizing. I still don't have a perfect formula. But I have a much better understanding of what questions to ask.

Written by Ayman Ben Hajjaj

Data Engineer & Project Manager