Skip to content

The Data Scientist

Out-of-sample predictive benchmark on 228,809 temporal holdout observations in 2026 comparing Market Price and LightGBM

Testing Market Efficiency on 766 Million Polymarket Trades: Backward-Join Data Engineering, LightGBM Benchmarks, and L2/L3 Order-Book Tear Sheets

THE DATA SCIENTIST // QUANTITATIVE MICROSTRUCTURE LAB BUILD: ZERO-LEAKAGE PIPELINE v2026.06

Testing Market Efficiency on 766 Million Polymarket Trades: Backward-Join Data Engineering, LightGBM Benchmarks & L2/L3 Order-Book Tear Sheets

Reproducible econometric and machine-learning specification across 491,202 resolved prediction markets, 1,401,619 point-in-time snapshots, and 1,233 historical Level-2/Level-3 order books.

AUTHORS: Dr Stylianos Kampakis (The Data Scientist & Tesseract Academy), Jiaqi Sun (UCL CS), Nikan Firoozye (UCL CS)
ON-CHAIN TAPE (SII DATASET)
766,412,707 TXS
1,019,069 metadata rows (2022-11-21..2026-05-04)
FROZEN CLEAN UNIVERSE
N = 491,202 MARKETS
1,401,619 ASOF snapshots (2022-11-21..2026-04-30)
2026 ML TEMPORAL HOLDOUT
N = 228,809 ROWS
Market 0.9563 AUC > LightGBM 0.9554 AUC
TELONEX L2/L3 ARCHIVE
N = 1,233 BOOKS
Exported 2026-06-26 | 2% fee + half-spread

Binary prediction markets map verifiable terminal events y_m ∈ {0, 1} onto continuous prices p_{m,t} ∈ [0, 1]. Yet nearly every public Polymarket API notebook or Polymarket trading bot repository fails out-of-sample due to three methodological bugs: (1) terminal volume leakage (stratifying historical snapshots by lifetime volume rather than point-in-time pre-cutoff volume V_{m,h}), (2) equal-count micro-market weighting (treating a $37 sports prop identically to a $50M macroeconomic contract), and (3) mid-price execution assumptions that ignore Level-2/Level-3 order-book depth, half-spreads, and Polymarket’s 2% fee assumption.

01 // Point-in-Time Pipeline & Backward ASOF Join Specification

From the Hugging Face SII Polymarket Dataset (766,412,707 reconstructed OrderFilled transactions and 1,019,069 metadata records, 21 Nov 2022 – 4 May 2026), we freeze N = 491,202 cleanly resolved standard markets created between 21 Nov 2022 and 30 Apr 2026 and construct 1,401,619 backward-joined snapshots across seven horizons:

pipeline/01_backward_asof_snapshots.sql DuckDB / Point-in-Time Specification
-- Zero-Leakage Universe Freeze & Backward ASOF Join (tau <= t_{c,m} - h)
WITH clean_markets AS (
    SELECT market_id, category, created_at, close_ts AS t_c, terminal_outcome AS y
    FROM sii_polymarket_metadata
    WHERE created_at BETWEEN TIMESTAMP '2022-11-21' AND TIMESTAMP '2026-04-30'
      AND is_standard_event = TRUE          -- Exclude mechanical Up/Down tick series
      AND terminal_settlement_price >= 0.95 -- Clean binary resolution
      AND total_volume_usd > 0 AND created_at < close_ts
),
horizon_grid AS (
    SELECT m.*, h.h_label, (m.t_c - h.h_interval) AS cutoff_ts
    FROM clean_markets m
    CROSS JOIN (VALUES
      ('T-30d', INTERVAL '30 days'), ('T-14d', INTERVAL '14 days'),
      ('T-7d',  INTERVAL '7 days'),  ('T-72h', INTERVAL '72 hours'),
      ('T-24h', INTERVAL '24 hours'),('T-6h',  INTERVAL '6 hours'),
      ('T-1h',  INTERVAL '1 hour')
    ) AS h(h_label, h_interval)
    WHERE m.created_at <= (m.t_c - h.h_interval)
)
SELECT
    g.market_id, g.h_label, g.y,
    last_tx.price AS p_mh,
    (EXTRACT(EPOCH FROM (g.cutoff_ts - last_tx.trade_ts)) <= 48 * 3600) AS is_fresh_48h,
    SUM(pit_tx.usd_notional) AS V_mh -- Strictly known-at-time pre-cutoff volume
FROM horizon_grid g
ASOF JOIN sii_order_filled_trades last_tx
  ON g.market_id = last_tx.market_id AND last_tx.trade_ts <= g.cutoff_ts
LEFT JOIN sii_order_filled_trades pit_tx
  ON g.market_id = pit_tx.market_id  AND pit_tx.trade_ts  <= g.cutoff_ts
GROUP BY ALL;
Daily live-market counts on Polymarket from metadata records on a logarithmic scale
[FIG_01] Daily active market counts on Polymarket (log scale, ~27/day in 2020 to >41,000/day in 2026; ~96% of listings created in 2025–2026).

02 // Tier 1: Murphy (1973) Brier Decomposition & Freshness-Controlled Volume Quartiles

ECE = Σb=1..B (nb / N) |ȳb − p̄b|   |   BS = (1/N)Σ nb(p̄b − ȳb)2 [Reliability] − (1/N)Σ nb(ȳb − ȳ)2 [Resolution] + ȳ(1 − ȳ)   |   BSS = 1 − BS / BSbase

Aggregate BSS across all seven horizons ranges from 0.54 to 0.73. Stratified by contract lifespan at T-24h (N = 429,184 total observations across four duration cohorts), discrimination rises monotonically: 0.28 for ≤ 2d (N = 129,582), 0.50 for 2–7d (N = 142,819), 0.69 for 7–30d (N = 110,424), and 0.91 for > 30d (N = 46,359).

Brier score decomposition into reliability and resolution components at T-24h grouped by market duration
[FIG_02] Murphy (1973) Brier decomposition into Reliability and Resolution at T-24h by market duration.

When stratified by pre-cutoff cumulative volume quartiles V_{m,h} at T-7d, bottom-quartile markets exhibit ECE > 3.0 pp versus < 1.0 pp in the top quartile. Enforcing the 48-hour freshness filter (is_fresh_48h = TRUE) narrows the thin-minus-thick quartile spread only from 2.33 pp to 2.01 pp (86% survival).

Expected Calibration Error by pre-cutoff volume quartile across observation horizons
[FIG_03] Expected Calibration Error (ECE) by pre-cutoff volume quartile across observation horizons.

03 // Timestamp Confounding: Administrative vs. Event-Anchored Clocks (N = 20,725)

To test whether the apparent decline in core ECE along the official countdown clock reflects real-time price discovery or post-outcome settlement lag, we re-anchor a balanced panel of N = 20,725 markets to three alternative clocks:

[TABLE_01] Core ECE (pp) on Fixed Balanced Panel (N = 20,725) Across Clock Specifications
Clock Specification T-30d T-7d T-1h Econometric Trajectory
Administrative Close \(t_c\) 1.11 pp 0.88 pp 0.39 pp Confounded monotonic decay (settlement lag)
Winner-Crossing (p ≥ 0.80) 2.40 pp 2.55 pp 2.87 pp Flat / slight reversal
Band-Exit ([0.30, 0.70] exit) 2.45 pp 2.51 pp 2.82 pp Outcome-independent; flat trajectory
Last-Material-Move (|Δp| > 15 pp) 3.02 pp 3.84 pp 5.20 pp Outcome-independent; substantial reversal
Core ECE under administrative vs. winner-crossing clocks for changing vs. fixed market universes
[FIG_04] Core ECE under administrative vs. event-anchored clocks (N = 20,725 fixed panel).

04 // Cross-Sectional Weighting: Count-Weighted vs. Volume-Weighted Gaps at T-7d

[TABLE_02] T-7d Calibration Gaps: Equal-Count vs. Pre-Cutoff Dollar Volume Weighting
Price Bin (T-7d) Count-Weighted (Δ_count) 95% Bootstrap CI Volume-Weighted (Δ_vol) Microstructure Driver
[0.05, 0.10] +3.4 pp [+2.7, +4.2] pp +1.1 pp Attenuated by 68% under volume weighting
[0.70, 0.80] -3.4 pp [-4.5, -2.3] pp +2.8 pp Sign flip (− to +)
[0.80, 0.90] -6.6 pp [-8.4, -5.0] pp +9.0 pp Sign flip (− to +)
[0.90, 0.95] -12.3 pp [-14.6, -10.2] pp +6.3 pp Driven by thin sports props ($37 median volume; -6.90 pp gap)
≥ 0.95 -1.3 pp [-1.9, -0.7] pp +0.2 pp Near-zero calibration error
Realised frequency minus price for T-7d favourites across categories
[FIG_05] Category breakdown of T-7d favourites (p ∈ [0.80, 0.95)). Sports exhibits a -6.90 pp gap at $37 median volume.

05 // Tier 2: Out-of-Sample LightGBM Benchmark (2026 Holdout, N = 228,809)

Trained strictly on pre-2026 observations using known-at-time price levels, historical trajectory features, staleness s_{m,h}, pre-cutoff volume V_{m,h}, and category encodings, out-of-sample LightGBM achieves 0.9554 ROC-AUC and 0.07784 Brier Score (0.59 pp scalar ECE), failing to beat the raw contemporaneous market price (0.9563 ROC-AUC, 0.07710 Brier Score, 0.72 pp scalar ECE).

Out-of-sample predictive benchmark on 228,809 temporal holdout observations in 2026
[FIG_06] Out-of-sample predictive benchmark on N = 228,809 temporal holdout observations (2026).

06 // Tier 3: L2/L3 Order-Book Execution Tear Sheet (Telonex Archive, N = 1,233)

On the 2025–2026 broad-tape holdout, equal-stake mid-price proxies return +25.0% (fade-favourite) and +20.6% (back-longshot), but pre-entry liquidity weighting collapses them to -50.7% and -25.5%. Across 1,233 historical Level-2/Level-3 order books (Telonex Export, 26 June 2026), deducting half-spreads and Polymarket’s 2% fee assumption yields negative out-of-sample returns across all active taker strategy families:

[TABLE_03] Out-of-Sample L2/L3 Taker Backtest Tear Sheet (Post-2% Fee & Half-Spread)
Book Depth Strategy Family Holdout Trades (N) In-Sample OOS Net Return Quant Diagnostic Flag
25-Level Depth Thin-Book Favourite 30 +100.0% [OVERFIT] -50.2% [LOW SAMPLE BOUNDARY N=30]
25-Level Depth Order-Book Imbalance 209 Positive -19.3% [STATISTICALLY RELIABLE N=209]
25-Level Depth Wide-Spread Reversal 146 Positive -19.7% [STATISTICALLY RELIABLE N=146]
Full-Book Depth Thin-Book Favourite 32 +100.0% [OVERFIT] -53.4% [LOW SAMPLE BOUNDARY N=32]
Full-Book Depth Order-Book Imbalance 203 Positive -14.6% [STATISTICALLY RELIABLE N=203]
Full-Book Depth Wide-Spread Reversal 140 Positive -16.1% [STATISTICALLY RELIABLE N=140]

In a hypothetical sensitivity analysis of passive market making (using conservative fill and adverse-selection buffers across the 1,233 order books), net returns drop from +11.93% ($10 cap) and +1.27% ($15 cap) to -4.94% ($20 cap) and -24.43% ($100 cap) due to adverse selection on large fills.

Passive market-maker return on deployed capital across capital caps per market under conservative fill assumptions
[FIG_07] Hypothetical sensitivity analysis of passive market-maker returns across per-market capital caps.

07 // Technical FAQ: Polymarket API, LightGBM & L2/L3 Backtests

1. How do you prevent look-ahead bias when backtesting Polymarket API or on-chain data?

Construct snapshots via strict backward ASOF JOIN queries (τ ≤ t_{c,m} - h) for both trade prices p_{m,h} and cumulative pre-cutoff volume V_{m,h}. Across 766,412,707 trades (Hugging Face SII Polymarket Dataset, 21 Nov 2022 – 4 May 2026), this yielded N = 491,202 cleanly resolved markets and 1,401,619 leak-free snapshots.

2. Can a LightGBM or Polymarket AI model beat the raw market price out-of-sample?

On our 228,809-observation temporal holdout in 2026, a leakage-safe LightGBM model achieved 0.9554 ROC-AUC and 0.07784 Brier Score, trailing the raw contemporaneous market price (0.9563 ROC-AUC, 0.07710 Brier Score).

3. Why do Polymarket trading bots lose money on Level-2/Level-3 order books?

Apparent statistical anomalies reside in thin contracts (e.g., sports markets with a $37 median volume). Across 1,233 historical L2/L3 order books (Telonex Export, 26 June 2026), deducting half-spreads and a 2% fee assumption caused all active taker strategies to lose between -14.6% and -53.4% out-of-sample.

4. What does the passive market-making sensitivity analysis show?

Under a hypothetical fill and adverse-selection model on the 1,233 Telonex order books, passive liquidity provision returns +11.93% at a $10/market cap and +1.27% at $15, but turns negative at $20 (-4.94%) and $100 (-24.43%).

5. Why does the favourite–longshot gap flip sign under volume weighting?

At T-7d, equal-count weighting produces a -12.3 pp gap in [0.90, 0.95] favourites because thousands of micro-stakes sports contracts ($37 median volume) receive equal weight. Weighting by pre-cutoff dollar volume V_{m,h} reverses the gap to +6.3 pp.

Executive Advisory • Tesseract Consulting

Enterprise AI Strategy & Implementation Discovery Call

Scope practical AI workflows, human-in-the-loop governance, and measurable delivery milestones with Tesseract Consulting.