Guide

Fees and queue position in Polymarket backtests

Two assumptions quietly inflate most backtests: that trading is free, and that a signal fills the instant it fires. The backtester exposes a taker_fee and a trade_lag_seconds for exactly these, and both should be set to honest values.

What this guide covers

  • The strategy object includes taker_fee and trade_lag_seconds
  • Omitting the fee inflates high-turnover strategies the most
  • trade_lag_seconds models the delay from signal to order reaching the book
  • Book capture is at 250ms, so a one-second lag spans up to four book updates

The taker fee

Every taker order pays a fee, and the backtester applies it when taker_fee is set on the strategy. A backtest that leaves it at zero is only defensible for a strategy that never takes liquidity, which on short-horizon binaries is rare.

The fee hurts hardest where turnover is highest. A strategy that trades many times per window pays the fee many times, and a small per-trade edge can vanish entirely. Set the fee, then look at how the strategy's edge changes.

Make the fee a first-class field rather than a mental adjustment. Reasoning about a fee that lives only in your head is how it gets forgotten in the version you eventually publish.

trade_lag_seconds

The lag is the delay between your signal and your order reaching the book. Set it to at least the honest end-to-end latency of the system you would run - data fetch, decision, submission. A lag of zero silently assumes you see a price and trade at it simultaneously.

On a market that reprices in under a second, the lag decides whether the opportunity still exists. Bothered to measure it? Compare the same strategy at increasing lags: a strategy whose edge survives a two-second delay is far more robust than one that only works at zero.

Queue position and passive fills

For resting orders, the archive cannot tell you your place in the queue - that depends on arrival order relative to everyone else. A maker backtest that fills the instant the price touches your level assumes you were first in line, which is the best case and rarely true.

The conservative assumption is that you are behind the resting size and only fill if the market trades through your level. For strategies that take liquidity, queue position is irrelevant, which is one reason taker strategies are easier to backtest honestly.

Combining fee, lag and queue

The realistic plan sets all three: a nonzero taker fee, a latency that reflects your stack, and a conservative queue assumption for any resting orders. Each one alone is a modest haircut; together they routinely turn a marginal strategy from profitable to not.

That is the point of a backtest - to find the not-profitable strategies on paper rather than in the market. If a strategy survives the fee, the lag, the queue and a realistic fill model, it is worth a closer look.

Code examples

import requests

BASE = "https://api.polyorderbooks.com/v1"
HEADERS = {"X-API-Key": "your-key", "Content-Type": "application/json"}

# Does the edge survive fee and latency?
for fee, lag in ((0.0, 0), (0.002, 1), (0.002, 3)):
    body = {"strategy": {
        "market": {"coin": "xrp", "market_type": "5m"},
        "side": "yes",
        "entry": [{"type": "reference", "change": 0.001}],
        "exit": {"type": "hold_to_expiry"},
        "taker_fee": fee, "trade_lag_seconds": lag},
        "sampleSize": 100, "days": 7}
    r = requests.post(f"{BASE}/ai/backtest", headers=HEADERS, json=body)
    r.raise_for_status()
    print(fee, lag, r.json()["report"]["total_pnl"])

Free tier

The Starter plan is free, includes order books, prices, and metrics at 250ms resolution, with 3 days of history, 60 requests/min, 1,000/day, 1 free AI backtest, and 3 strategy backtests. No credit card required.

Paid data windows from $19/mo extend history to 30–120 days at higher throughput. Backtest AI add-on is +$19/mo or standalone at $29/mo.

FAQ

How do I set the taker fee?

Set taker_fee on the strategy so the backtester applies it to every taker trade. Leaving it at zero is only defensible for strategies that never take liquidity.

What should trade_lag_seconds be?

At least the honest end-to-end latency of your stack, from data fetch to order submission. Zero assumes you trade at the exact price you see.

Can the backtest tell me my queue position?

No. Queue position depends on arrival order. Assume you are behind the resting size for maker orders; taker strategies are unaffected.

How much do fee and lag change results?

Often decisively for high-turnover strategies. Run the same strategy at several fee and lag settings - if the edge only survives at zero, it is not real.