DEV Community

FatherSon
FatherSon

Posted on

I Cloned a Polymarket Market-Making Bot and Ran It: Here’s What I Learned

Market making on Polymarket sounds like an easy way to earn passive rewards + spreads. One developer forked an open-source bot, enhanced it, and ran it in production. The results were eye-opening.

The Setup

The bot’s goal: provide liquidity on both YES and NO sides to capture:

  • The bid-ask spread
  • Polymarket’s liquidity maker rewards

Core Reward Formula (from Polymarket docs):

S = ((v - s) / v)² * b
Enter fullscreen mode Exit fullscreen mode
  • v = max allowed spread
  • s = distance from mid-price
  • b = in-game multiplier

The closer your quotes stay to the mid, the higher the reward.

Key Bot Components

  1. Market Discovery

    Scrapes all active markets via API → calculates volatility/rewards → ranks and selects high-potential ones (stored in Google Sheets).

  2. Automated Execution

    • WebSocket for real-time price & order book updates
    • Local order book state
    • Places two-sided limit orders
    • Monitors and cancels/replaces when price moves beyond thresholds
  3. Position & Capital Management

    • Auto-merges balanced YES + NO positions back to USDC (no slippage)
    • Dynamic position sizing with limits
  4. Risk Management

    • Stop-loss based on PnL, spread, and volatility
    • Take-profit logic
    • Real-time inventory tracking to avoid directional blowups

Hard-Earned Lessons

  • Low-volatility markets are king — easy to hedge and offload risk. Volatile markets can wipe out weeks of rewards in minutes.
  • Directional risk is the #1 P&L killer — even passive market making has significant inventory risk.
  • Real-time inventory tracking is non-negotiable — without accurate net position snapshots, the bot kept doubling down on losing sides.
  • Execution & operations matter as much as strategy — small bugs and misconfigurations destroyed the theoretical edge.
  • Manual piloting first — understand adverse selection and slippage before going full auto.

Final Result: The bot generated maker rewards and some spread income, but net profit was negative after accounting for bugs, testing losses, and directional hits.

Takeaways for Developers

  • Market making on Polymarket is viable but operationally heavy.
  • Focus relentlessly on risk management and inventory control.
  • Invest in logging, observability, and AI-assisted debugging (worth every dollar).
  • Start simple, test manually, then automate.

This experiment beautifully demonstrates a core truth in DeFi and prediction markets: the strategy is only 30% of success — robust infrastructure and risk discipline are the other 70%.

Even without net profit, the learning experience was extremely valuable. The repo is public for anyone who wants to experiment.


If you have more questions, please feel free to contact me at any time: https://t.me/FatherSon97


Tags: #Polymarket #MarketMaking #TradingBots #PredictionMarkets #DeFi #Web3 #QuantitativeTrading #LiquidityProvision #Fintech

Top comments (0)