Urgent.News

What's breaking now, across thousands of outlets.

Tech

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…

You've built a Polymarket trading bot, but the live performance isn't reflecting the promising backtests and paper trading results. You're confident the strategy itself is sound, but the execution is the culprit behind the negative P&L. You're reaching out specifically for engineering guidance, not for opinions on the trading signals or financial advice.

Your strategy involves arbitrage in Bitcoin's Up or Down market within a 5-minute window. You're using Node.js, Polymarket's CLOB API, Polygon, and USDC as the currency. You're employing a FOK (Fill or Kill) order type and gathering data through polling, websockets, Gamma API, or Data API. Typically, your order size is around 5 SHARs. Your execution environment could be a VPS, home server, or even a local laptop. You've estimated the latency, though the exact figure is unknown.

The problems you're encountering in the live execution are substantial. The gap between the expected price and the actual fill price is significant, leading to partial fills that leave you with undesirable inventory. The canceling or replacing of orders is also too slow, causing you to chase price movements and end up with worse execution prices. The backtest assumes fills that don't materialize in the live environment. Moreover, there are API, gas, relayer, and rate-limiting errors that occur during execution.

You've already taken some steps to mitigate these issues. You've switched from market orders to limit orders, reduced your order size, widened your price bands, improved your logging, and implemented retries and rate limiting. You're open to more suggestions on these fronts.

What you're really seeking is help in modeling realistic fill probability on Polymarket, designing an optimal order manager for CLOB trading, handling latency and partial fills, and accurately backtesting with real order book data instead of estimated fills. You're also looking for open-source examples or tools for Polymarket CLOB execution and guidance on measuring execution quality, such as slippage, fill rate, and adverse selection.

If you've built execution bots for Polymarket or similar CLOBs, your feedback, code examples, documentation, or even a critique of your approach would be highly appreciated. You're willing to share anonymized logs or code snippets to facilitate this discussion.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

What Zig Feels Like Coming from Go: A Systems Programming Comparison

Originally published at adityarawas.in Zig has been circling the edges of backend and systems engineering conversations for a few years now, but the recent wave of "coming from X to Zig" posts signals…

  • Zig gaining traction in backend and systems engineering discussions
  • Engineers from Go background exploring Zig more seriously
  • Comparison reveals Zig's relevance alongside existing production languages

The Part of the Job You Only See by Staying

The advice you hear most often is to move every couple of years, and there are good reasons behind it. There is also a category of learning that only arrives if you are still there, and nobody talks…

  • Staying in one job reveals insights from watching decisions age and evolve.
  • Workarounds abandoned as temporary can become essential, relied upon by multiple teams.
  • Time in a role allows consulting before decisions are made, significantly altering workweek.

More from Sunday 20 September →