Berke Özyaşar
Personal project

Polymarket Bots

Prediction market arbitrage bot

A Python bot that buys both sides on Polymarket when YES plus NO costs less than 1 dollar, then merges them on-chain.

This project is a bot system I built to catch price imbalances on the Polymarket prediction market. It runs on the Polygon network and is written in Python. I, Berke Özyaşar, designed and built it as a personal project.

The core idea

In Polymarket's binary markets, 1 YES share and 1 NO share can always be merged into 1 USDC.e, whatever the outcome. So when the best ask prices on both sides add up to less than 1 dollar, buying both sides together and merging the positions on-chain locks in the difference. This happens especially often in short-term 5- to 15-minute crypto “up or down” markets.

System components

  • Market discovery: finding suitable markets and token IDs through the Gamma API
  • Scanner: a module that reads the order books roughly every 2 seconds, calculates net profit after Polymarket fees and gas costs, and applies minimum spread and profit thresholds
  • Executor: a module that sends signed orders to both legs almost simultaneously
  • Merging: merging positions on-chain or holding them until resolution
  • Second strategy: a “dump & hedge” strategy that buys one side after a sudden drop, hedges with the other side once the total cost reaches an acceptable level, and cuts the loss if time runs out
  • Monitoring: Grafana dashboards

Technical approach and risks

The system uses the py-clob-client and web3.py libraries. One leg filling while the other does not, fees eating the spread, slippage and thin liquidity are real risks; that is why a kill switch, a retry mechanism for rate limits and very small test sizes are part of the system. This page is not investment advice.

For a detailed technical write-up, see the Polymarket arbitrage bot post. For similar work, see the trading bots and automation bots pages; my MetaTrader work is here.

Similar projects

All projects (35)

Planning a similar project?

Describe what you want to build in a few sentences and I will get back to you the same day.

Use ↑ ↓ to navigate, Enter to open, Esc to close