{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiehrf77fzwc3r5aicbetuoyyjk62j67vdhtydksavrzvntg7c7txu",
    "uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3monoj2jhuqy2"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreicvg4qfdq5zbl3i2f2552meudrnjo2jkksdmzqealzkveab6decnq"
    },
    "mimeType": "image/webp",
    "size": 77834
  },
  "path": "/harrieronchain/i-built-an-open-source-market-maker-for-prediction-markets-polymarketclob-heres-how-it-works-5aam",
  "publishedAt": "2026-06-19T15:16:29.000Z",
  "site": "https://dev.to",
  "tags": [
    "automation",
    "blockchain",
    "opensource",
    "showdev",
    "https://github.com/HarrierOnChain/Prediction-Markets-Trading-Bot-Toolkits"
  ],
  "textContent": "Hey everyone,\n\nI've been deep in prediction market infrastructure for a while and just open-sourced a market maker bot designed for CLOB-based prediction markets like Polymarket.\n\nWhat it does:\n\n  * Quotes both sides of a binary market automatically\n  * Adjusts spreads based on order book depth and volatility\n  * Manages inventory risk to avoid getting stuck on the wrong side of a resolved market\n  * Built on top of Polymarket's CLOB API with Gnosis Safe / EOA wallet support on Polygon\n\n\n\nThe core challenge with prediction markets vs. regular markets:\n\nNormal market making is about capturing spread. Prediction markets add a brutal edge case — resolution risk. If you're holding YES at 0.6 and the market resolves NO, you're not just down on the spread, you're down the full position. So the bot has to:\n\n  * Track time-to-resolution and widen spreads as resolution approaches\n  * Reduce inventory exposure on markets with high directional momentum\n  * Use FAK orders to avoid resting limit orders too long near resolution\n\n\n\nStack:\n\n  * Rust\n  * Polymarket CLOB API\n  * Polygon (USDC settlement)\n  * SQLite for order state tracking\n\n\n\nWhat's next:\n\n  * Dynamic spread model based on implied volatility\n  * Multi-market portfolio rebalancing\n  * Better signal integration (news feeds, oracle data)\n\n\n\nGitHub: https://github.com/HarrierOnChain/Prediction-Markets-Trading-Bot-Toolkits\n\nHappy to answer questions on the architecture, risk model, or anything CLOB-related. Always looking for feedback from others building in this space.",
  "title": "I built an open-source market maker for prediction markets (Polymarket/CLOB) — here's how it works"
}