DEV Community

Cover image for Good strategy, bad execution on Polymarket — need help improving my execution layer
0xTSR
0xTSR

Posted on

Good strategy, bad execution on Polymarket — need help improving my execution layer

Hi everyone,

I’m working on a Polymarket trading bot. The strategy looks decent in backtests/paper trading, but live P&L is negative. I’m fairly confident the signal isn’t the main problem — execution is. I’m looking for engineering feedback, not signals or financial advice.

Context:

Strategy: Latency Arbitrage

Markets: Bitcoin Up or Down 5m

Stack: [Node], Polymarket CLOB API, Polygon, USDC

Order type: [FOK]

Data: [polling / websocket / Gamma API / Data API]

Avg order size: [e.g. 5 SHARs]

Environment: [VPS / home server / local laptop]

Latency: [rough estimate if known]

What goes wrong live:

Expected price vs actual fill price gap is large

Partial fills leave me with bad inventory

Cancel/replace is too slow

I chase moves and get filled at worse prices

Backtest assumes fills that don’t happen live

API / gas / relayer / rate-limit errors during execution

What I’ve tried:

Limit orders instead of market orders

Smaller size

Wider price bands

Better logging

Retries and rate limiting

[anything else]

What I need help with:

How do you model realistic fill probability on Polymarket?

What’s the right order manager design for a CLOB? (quote, cancel, replace, inventory, risk)

How do you handle latency and partial fills?

How do you backtest with real order book data instead of assumed fills?

Any open-source examples or tools for Polymarket CLOB execution?

How do you measure execution quality — slippage, fill rate, adverse selection?

If you’ve built execution bots for Polymarket or similar CLOBs, I’d really appreciate pointers, code examples, docs, or a critique of my approach. I can share anonymized logs/code in the comments if that helps.

Thanks.

Top comments (0)