Backtesting infrastructure
Execution-realistic simulation, not candle replays. Empirical latency distributions, true order semantics at the delayed book, venue minimums, exact fees, and significance gates.
A Haim Labs practice
Quantitative infrastructure for Polymarket-class venues. We operate these systems in production with real capital, which is why we know exactly where they break.
Services
Execution-realistic simulation, not candle replays. Empirical latency distributions, true order semantics at the delayed book, venue minimums, exact fees, and significance gates.
Designed, built, and operated. Order management, risk limits, reconciliation, monitoring, and settlement handling included.
Including the part most teams underestimate, the data collection pipeline that feeds them. Recording, feature engineering, training, and live inference.
Venue physics
Most bots on this venue lose to the venue itself before they ever lose to another trader. The list below is not opinion. It is how the venue actually behaves, and every item has cost someone real money.
Maker orders are acknowledged in roughly 33 ms. Taker orders pass through a server-side matching delay of roughly 300-400 ms, with a long tail measured in seconds under load. The fee schedule makes taker look cheap. The clock says otherwise, and bots that pick order types off the fee table spend months wondering where the edge went.
Our approach: routing decisions are modeled on measured venue behavior, not documentation.
On this venue, fill-or-kill orders fill close to never. Fill-and-kill is the actual taker instrument. A strategy backtested on fill-or-kill assumptions meets a live venue that kills every order it sends, and nothing about the failure looks like an error.
Our approach: order semantics are taken from observed fills, then encoded in both the live system and the simulator.
Orders must clear 5 shares AND one dollar, together, not either floor alone. Small clips get rejected or distorted. Sub-minimum remainders become dust positions that cannot be exited and ride all the way to settlement. Sizing logic that ignores either floor bleeds slowly and quietly.
Our approach: sizing respects both floors and accounts for dust to resolution.
A bought position becomes sellable only after a settlement embargo of roughly 1.5 seconds. Fast-exit strategies that ignore the embargo are simulating trades that cannot exist. The backtest reports an exit. The venue reports a rejection.
Our approach: the embargo is enforced in live routing and in every backtest.
In a binary market the DOWN bid equals one minus the UP ask. The same exit can be routed as a sell on one book or as a buy on the other. One of those routes avoids the embargo and the balance locks entirely. Most bots only ever look at one side, and they pay for it on every exit.
Our approach: exits are priced across both sides of the mirror.
Order submission is geo-blocked from several major jurisdictions. Where your system legally sits determines both your compliance position and the latency floor you can reach. Retrofitting that decision after the code works is expensive.
Our approach: legal seat selection is treated as an architecture decision, made early.
Reported fill prices are fee-inclusive. Use them raw and your slippage numbers are fiction. Worse, any model trained on those prices learns from distorted targets and carries the distortion into every prediction it makes.
Our approach: every ledger entry is fee-inverted before anything downstream reads it.
Markets resolve on an oracle feed with exact tie-breaking rules, measured against an official baseline that is printed in the market question itself. That baseline is not always the live exchange price most bots watch. When the two differ, a bot trades the wrong direction with full confidence and finds out at resolution.
Our approach: the oracle feed and the question text are first-class inputs, monitored continuously.
Partial fills, cancel races that orphan positions, and phantom fills over the WebSocket feed all push internal state away from on-chain reality. Each individual gap is small. Left alone, the drift compounds until risk limits are being computed against a portfolio you do not hold.
Our approach: periodic reconciliation against the wallet as the single source of truth.
Settled winnings sit unclaimed until something claims them. A correct call that is never redeemed is capital standing still, and the tail of resolved markets only gets longer.
Our approach: claiming is an automated, monitored job with alerting, never a manual chore.
A process can report healthy while its data feed has been dead for hours or days. The process runs, the port answers, the check passes, and the data stopped. We have seen exactly this failure mode, repeatedly, and it is why we do not trust process state at all.
Our approach: every service is monitored on the freshness of its output, not on whether it is running.
Venue behavior, feed semantics, and recording formats drift over time. A backtest that spans such a boundary is comparing two different instruments and reporting the difference as alpha. The result looks like a discovery. It is a units error.
Our approach: datasets are versioned by meaning, and analyses respect era boundaries.
Real order latency has a fat tail, and the tail is where the losses live. Simulating with a single optimistic constant turns losing strategies into paper winners. The heavier the real tail, the better the fantasy looks.
Our approach: simulation draws from empirical latency distributions, tail included.
Taker semantics at the delayed book, the exit embargo, venue minimums, and missed fills all belong inside the simulator, because they are all inside the venue. A miss is not a non-event. It is a trade you attempted and did not get, and it has to be counted as one.
Our approach: the simulator enforces the venue's actual rules, and misses count as trades.
On thin edges the fee model is the difference between profit and loss. An approximate fee model is not a small error. It is a sign flip applied to exactly the trades you are least sure about. Close is not good enough.
Our approach: fees are modeled to the exact venue formula and verified against live fills.
Not trading has an expected value of exactly zero at zero risk. A strategy earns production only by beating that baseline with statistical significance, measured per day and not just pooled across the sample. Most candidates do not clear the bar. That is the point of the bar.
Our approach: significance gates are non-negotiable, and failing strategies are killed on our own evidence.
Engagement
It starts with a scoping conversation about what you trade and what you need. We agree on a fixed deliverable: a backtesting environment, a running bot, a model with its data pipeline, or all three. From there, handover with documentation, or managed operation by us.
Haim Labs is independent and is not affiliated with or endorsed by Polymarket.
Nothing on this page is financial advice. Our services are software and infrastructure consulting.