How I Built a Market Maker Bot on Polymarket (And What I Learned)
I've been trading on Polymarket for a while now, and at some point I got tired of manually placing orders. So I did what any developer would do - I automated it.
This post is about how I built a simple market maker bot on Polymarket, what went wrong, and what actually works.
What is Market Making Anyway?
Market making is simple. You place a buy order and a sell order at the same time. You buy at $0.45 and sell at $0.55. If both orders fill, you pocket the difference - the spread.
You're not betting on the outcome. You're just providing liquidity and collecting the spread over and over again.
On Polymarket, every market is a YES/NO token. So instead of price, you're working with probabilities. A YES token at 0.45 means the market thinks there's a 45% chance of YES.
Why Polymarket is Good for Market Making
A few reasons I chose Polymarket. They have a real order book (CLOB - Central Limit Order Book). You can place limit orders via API. Markets are liquid enough to actually get fills. The API is well documented and free to use.
Most prediction markets don't have a proper order book. Polymarket does. That's what makes bot trading possible.
How My Bot Works
It's not complicated. Here's the basic logic. Fetch the current best bid and ask from the order book. Place a buy order slightly below the best bid. Place a sell order slightly above the best ask. Wait for fills. Cancel and repost when the market moves.
That's it. The hard part is not the logic - it's the edge cases. Orders not filling. Markets resolving while you hold inventory. Gas fees eating your profit.
The Stack I Used
Node.js for the bot logic. Polymarket CLOB Client which is the official npm package. MongoDB to log all trades and track P&L. A VPS to keep the bot running 24/7. PM2 to auto-restart if it crashes.
Nothing fancy. You don't need a complex setup to get started.
Biggest Mistakes I Made
First, not cancelling orders fast enough. When the market moves, your old orders become bad orders. I learned to cancel aggressively and repost.
Second, ignoring inventory risk. If your buy orders keep filling but sell orders don't - you're stuck holding a position. That's not market making anymore, that's just buying.
Third, trading illiquid markets. Some markets on Polymarket have almost no volume. Your orders sit there forever and you get no fills. Stick to high volume markets.
Fourth, not logging everything. At first I had no idea if I was making or losing money. Log every order, every fill, every cancel. MongoDB made this easy for me.
Does It Actually Make Money?
Honestly - it depends on the market. Some days are green, some are flat. The edge is small and you need volume to make it worthwhile.
What I can say is that on active markets during big events - elections, sports, major news - the spreads widen and the bot performs well. That's when volume spikes and there are more opportunities.
What's Next
I'm working on better spread calculation based on volatility, auto market selection so the bot picks the best markets, and risk limits so it doesn't overexpose on one market.
If you're a developer and want to try this yourself, start with the official Polymarket CLOB API docs and the polymarket-clob-client npm package. It's easier to get started than you think.
Final Thoughts
Market making on prediction markets is still early. Not many people are doing it properly. If you're a developer, you have an edge just by being able to build the tools yourself.
Start simple. Get one market working. Then scale.
If you have questions or want to share what you're building, drop a comment below.
For more info about arbitrage in detail: https://github.com/casatrick/polymarket-arbitrage-bot
Comments
Post a Comment