Hey everyone,
I'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.
What it does:
- Quotes both sides of a binary market automatically
- Adjusts spreads based on order book depth and volatility
- Manages inventory risk to avoid getting stuck on the wrong side of a resolved market
- Built on top of Polymarket's CLOB API with Gnosis Safe / EOA wallet support on Polygon
The core challenge with prediction markets vs. regular markets:
Normal 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:
- Track time-to-resolution and widen spreads as resolution approaches
- Reduce inventory exposure on markets with high directional momentum
- Use FAK orders to avoid resting limit orders too long near resolution
Stack:
- Rust
- Polymarket CLOB API
- Polygon (USDC settlement)
- SQLite for order state tracking
What's next:
- Dynamic spread model based on implied volatility
- Multi-market portfolio rebalancing
- Better signal integration (news feeds, oracle data)
GitHub: https://github.com/HarrierOnChain/Prediction-Markets-Trading-Bot-Toolkits
Happy to answer questions on the architecture, risk model, or anything CLOB-related. Always looking for feedback from others building in this space.
Top comments (4)
Excellent work—this clearly shows that prediction-market making is not just standard spread capture with a different API. The combination of time-to-resolution controls, inventory-aware exposure reduction, and FAK execution addresses the real tail risk of holding the losing outcome at settlement. I especially like the decision to widen spreads as resolution approaches, although it would be interesting to see the model also account for liquidity imbalance and sudden information-driven probability jumps. Rust is also a strong choice for maintaining predictable execution and order-state management under fast CLOB updates. The planned portfolio rebalancing and oracle/news integration could make this a very valuable open-source foundation for prediction-market infrastructure.
For sure, are you by any chance developing a Polymarket trading bot as well?
🌟
I haven’t built a bot for Polymarket specifically, but I’ve played around with algo trading for other platforms, usually just to try automating my strategies and balancing risk during volatile market events. Most of my stuff has been in Python, but I’ve also dabbled with Rust for speed, kind of like what you were saying about predictable execution. What really helped me was when I could hook up my code directly into the platform’s API for real-time updates and fast order handling, especially when managing exposure gets tricky close to market resolution.
If you ever end up working with prop trading accounts or MetaTrader, there’s actually a way to get direct trading and data access using a MetaTrader prop firm API. I found this super useful for linking automated strategies with funded accounts.