Every trading strategy looks great in theory. Backtesting separates the viable from the wishful. Prediction markets present unique backtesting challenges: binary outcomes (yes/no), time decay as resolution approaches, and thin liquidity that means your orders can move the market. This guide shows how to pull historical data from Depthy's API and test three concrete strategies against real Polymarket trades.

We will walk through the data retrieval, implement each strategy in Python, and present honest results -- including the adjustments that bring theoretical returns back to earth. No cherry-picked numbers, no hypothetical edge that evaporates on execution.

Getting Historical Data

Depthy's backtest endpoint returns historical trade-level data for any monitored Polymarket market. You specify a market ID and a time range, and get back every recorded trade with full metadata. The endpoint supports both JSON and CSV output formats.

curl -H "Authorization: Bearer YOUR_KEY" \
  "https://depthy.io/v1/pm/backtest/trades?market=0x4c96...&from=2026-02-01T00:00:00Z&to=2026-02-15T00:00:00Z&format=json"

For CSV output, change format=csv. This is useful for loading directly into pandas or spreadsheet tools without parsing overhead.

curl -H "Authorization: Bearer YOUR_KEY" \
  "https://depthy.io/v1/pm/backtest/trades?market=0x4c96...&from=2026-02-01T00:00:00Z&to=2026-02-15T00:00:00Z&format=csv" \
  -o trades.csv

Key details about the data:

  • 137K+ historical trades available across all monitored markets
  • Up to 30 days per request -- chain multiple requests for longer backtests
  • Requires Metered, Pro, or Enterprise tier (backtest endpoints are not available on the free plan)
  • Each trade record includes: timestamp, wallet, side (BUY/SELL), outcome (Yes/No), size, and price

Setup Code

The following Python helper functions are shared across all three strategies. They handle authentication, trade retrieval, and smart wallet lookup.

import requests
import json

API_KEY = "your_key_here"
BASE = "https://depthy.io"
headers = {"Authorization": f"Bearer {API_KEY}"}

def get_trades(market_id, start, end):
    resp = requests.get(
        f"{BASE}/v1/pm/backtest/trades",
        params={"market": market_id, "from": start, "to": end},
        headers=headers
    )
    return resp.json()["trades"]

def get_smart_wallets(limit=20):
    resp = requests.get(
        f"{BASE}/v1/pm/wallets/top?limit={limit}",
        headers=headers
    )
    return {w["wallet"] for w in resp.json()["wallets"]}

Strategy 1: Buy Yes When Smart Money Buys Yes (Price 0.30-0.70)

The simplest approach: when a wallet that appears on Depthy's top-20 leaderboard buys Yes on a market, and the current price is between 30 and 70 cents, follow the trade. The price filter avoids markets where the outcome is already near-certain (above 70c) or where the smart wallet might be taking a speculative flyer on a long shot (below 30c).

def backtest_smart_money_yes(trades, smart_wallets):
    entries = []
    for t in trades:
        if (t["proxy_wallet"] in smart_wallets and
            t["side"] == "BUY" and
            t["outcome"] == "Yes" and
            0.30 <= t["price"] <= 0.70):
            entries.append(t)

    if not entries:
        return {"entries": 0, "roi": 0}

    total_cost = sum(t["price"] * t["size"] for t in entries)
    total_payout = sum(t["size"] for t in entries)  # $1/share if Yes
    roi = (total_payout - total_cost) / total_cost * 100

    return {
        "entries": len(entries),
        "avg_entry_price": total_cost / sum(t["size"] for t in entries),
        "total_cost": round(total_cost, 2),
        "potential_payout": round(total_payout, 2),
        "roi_if_yes": round(roi, 1)
    }

Results

Running this against our Feb 1-15 dataset: 23 entry points found across 8 markets. Average entry price: $0.48. If every one of those markets resolves Yes, total ROI is +108%. That is the theoretical ceiling.

Now the reality check. Not every market entered will resolve Yes. The top-20 wallets in our dataset have a collective win rate of roughly 70% on their Yes buys. Adjusting for that -- assuming 70% of entered markets resolve favorably -- the expected ROI drops to approximately +45%. Still strong, but a far cry from the raw backtest number. This gap between theoretical and adjusted returns is exactly why backtesting matters: it forces you to discount for what will actually happen, not what could happen.

Strategy 2: Buy on Volume Anomaly Below 50c

This strategy ignores wallet identity entirely and focuses on market microstructure. When hourly trade volume spikes to 3x the average and the price is below 50 cents, something is happening. Volume anomalies below 50c often indicate informed buying before a market moves -- someone knows something, and the price has not caught up yet.

def backtest_volume_anomaly(trades):
    # Simulate: find clusters of rapid buying (proxy for volume spike)
    from collections import defaultdict
    hourly = defaultdict(list)

    for t in trades:
        hour = t["timestamp"][:13]  # group by hour
        hourly[hour].append(t)

    avg_hourly = len(trades) / max(len(hourly), 1)
    entries = []

    for hour, hour_trades in hourly.items():
        if len(hour_trades) > avg_hourly * 3:  # 3x spike
            for t in hour_trades:
                if t["side"] == "BUY" and t["price"] < 0.50:
                    entries.append(t)

    if not entries:
        return {"entries": 0, "roi": 0}

    total_cost = sum(t["price"] * t["size"] for t in entries)
    total_payout = sum(t["size"] for t in entries)
    roi = (total_payout - total_cost) / total_cost * 100

    return {
        "entries": len(entries),
        "avg_entry_price": round(sum(t["price"] for t in entries) / len(entries), 3),
        "roi_if_yes": round(roi, 1)
    }

Results

This strategy generates more signals: 41 entries across the same two-week window. Average entry price is lower at $0.38, which gives a theoretical ROI of +163% if all markets resolve Yes.

The problem is noise. Volume spikes on sub-50c markets are not always informed buying. Sometimes it is retail piling into a trending topic, bots arbitraging across platforms, or simple panic buying on breaking news that turns out to be nothing. Many of these markets resolve No. Adjusted for actual resolution rates on volume-spike markets in our dataset, the expected ROI lands in the +15-25% range. More trades, lower per-trade edge, higher variance. This is a volume play, not a conviction play.

Strategy 3: Follow Top 5 Wallets on $500+ Positions

The most restrictive filter: only follow the top 5 wallets by composite score, and only when they take positions of $500 or more. The logic is straightforward -- the best wallets putting serious capital on the line is the strongest signal in our dataset. Small trades from top wallets could be hedges, tests, or noise. Large trades are intentional.

def backtest_whale_follow(trades, smart_wallets, min_size=500):
    top_5 = set(list(smart_wallets)[:5])
    entries = []

    for t in trades:
        if (t["proxy_wallet"] in top_5 and
            t["side"] == "BUY" and
            t["size"] >= min_size):
            entries.append(t)

    if not entries:
        return {"entries": 0, "roi": 0}

    total_cost = sum(t["price"] * t["size"] for t in entries)
    total_payout = sum(t["size"] for t in entries)
    roi = (total_payout - total_cost) / total_cost * 100

    return {
        "entries": len(entries),
        "total_cost": round(total_cost, 2),
        "roi_if_yes": round(roi, 1)
    }

Results

Fewest entries of any strategy: 10 trades in two weeks. Average entry price: $0.55. Theoretical ROI if all resolve Yes: +82%. Lower than both other strategies in raw terms, because the average entry price is higher -- these wallets are buying into markets they have high conviction on, which tend to already be priced above 50c.

But the adjusted numbers tell a different story. The top 5 wallets in our dataset have an approximately 85% win rate on their large positions. They do not put $500+ on a market unless they have done their homework. Adjusting for that win rate, expected ROI is approximately +55% -- the highest risk-adjusted return of the three strategies.

Strategy Comparison

Strategy Entries Avg Price ROI (if Yes) Adj. Expected ROI
Smart Money Yes 23 $0.48 +108% ~+45%
Volume Anomaly 41 $0.38 +163% ~+20%
Top 5 Whale Follow 10 $0.55 +82% ~+55%

Results based on Feb 1-15, 2026 trade data across 50 monitored Polymarket markets. Adjusted ROI accounts for historical resolution rates per strategy type.

Key Insights

Three patterns emerge from these backtests that are worth internalizing before you deploy any prediction market strategy:

  • Fewer, higher-conviction entries beat high-volume noise. The whale follow strategy generated 4x fewer trades than the volume anomaly approach, yet delivered nearly 3x the risk-adjusted return. Signal quality dominates signal quantity.
  • The top 5 wallet strategy has the best risk-adjusted returns. This is not surprising. These wallets have the longest track records and the most capital at risk. Their large positions carry genuine information about outcomes.
  • Historical data gets more valuable every day. Two weeks of backtest data is a starting point. Longer baselines -- 30, 60, 90 days -- produce more robust conclusions and expose strategies that only work in specific market conditions.
  • These are simplified backtests. Production systems must account for slippage (your buy order moves the price), timing lag (you see the signal after the smart wallet already traded), and markets that resolve No (the single largest source of loss in prediction market trading).

The gap between theoretical and adjusted ROI is the most important number in any backtest. If your strategy shows +200% theoretical and +5% adjusted, you do not have an edge -- you have a coin flip with extra steps. The strategies above survive adjustment because they are grounded in a structural advantage: following wallets with demonstrated, measurable skill.


Backtesting is not optional. It is the difference between deploying a strategy with quantified expectations and gambling on a hunch. Depthy's backtest endpoint gives you the raw material -- 137K+ trades with full metadata -- and the wallet intelligence layer tells you which trades matter. Build on both.