journal
12 June 202612 min read

I Built a Bot to Trade Crypto on Polymarket. It's Yours for Free.

The full story of my Polymarket trading bot: the price-delay edge I chased, nine versions of strategy, what the blockchain revealed about its profits, and the complete infrastructure as a free download.

Prefer to watch? The full video is on YouTube →

The idea: a three-second window into the future

This March I noticed something about Polymarket's Bitcoin up-or-down markets. These are five-minute contracts that ask one question: will BTC finish the window higher or lower than it started? The market price of YES is basically the crowd's probability estimate, updating in real time.

Except it doesn't update in real time. Polymarket settles these markets on a Chainlink price feed that refreshes about once per second. Binance, where the actual price action happens, streams around 62 updates per second. When Bitcoin moves sharply, Binance knows before Polymarket's feed does. I measured the gap: a median of 3.3 seconds.

In other words: for about three seconds, I could see the future. If Binance lurched up and Polymarket's contract was still priced off the old level, buy UP before the feed catches up. That was the whole thesis. A latency edge, the kind of thing high-frequency firms pay millions for, sitting in a niche market apparently too small for them to care about.

The build: Python, a Raspberry Pi, and an AI pair programmer

I'm not a professional developer. The entire bot was built pair-programming with Claude: a Python process on a Raspberry Pi in my living room, streaming Binance ticks, polling Polymarket's order book through their CLOB API, and firing orders when the gap between what Binance knew and what Polymarket priced got wide enough. Version 1 went live on March 15.

Version 1 had a bug and never triggered on upward moves. Version 3 traded real money for one day and lost $13 to five separate bugs. This is the part of every bot story that gets skipped: the first weeks are not about your edge, they are about discovering all the ways your code can be wrong while your money is on the line.

The first crack: my bot and reality kept different books

By version 5.1 the bot looked good. Its log said 13 wins, 4 losses, up $140.15. Then I checked the same trades on Polymarket itself: 12 wins, 5 losses, down $14.45. Same bot, same trades, two different realities.

One trade explained it. The bot had bought 1,002 tokens at one cent and booked a $156.98 win. Polymarket said that trade lost $10.02. The price feed my bot used to score itself had been stale for 173 seconds. My bot wasn't lying to me out of malice; it was grading its own homework with an answer key three minutes out of date.

I patched it, added staleness guards, and kept going. But remember this moment, because the same disease comes back later, much bigger.

The pivot: from speed to statistics

Here's the uncomfortable thing about the latency edge: it was real. Measured over hundreds of events, the bot's directional calls were right about 71% of the time. And it still couldn't make money, because the edge was thinner than the cost of acting on it. Thin order books meant my average fill came in 13.5% worse than the price on screen. More than a quarter of fills were over five cents worse. You can be right about direction and still lose on the entry, every single time.

So by version 9 the bot had quietly become a different animal. Less about reacting fast, more about pure statistics: given how far the price has already moved and how volatile the window is, what is the true probability this contract finishes UP? If the market sells that probability cheaper than the model's number minus a 4-point margin, buy. I calibrated the probability formula on 4,115 resolved market windows from May. The backtest said 96% of trades would win.

The reality check: $1,765 of profit that never existed

The bot ran live from May 1 to June 4. 716 trades. Its ledger climbed steadily to +$1,765, and for a few weeks I genuinely believed I had a profitable trading bot.

Then I did something I should have done from day one: I ignored the bot's own accounting entirely and pulled every Buy, Sell, and Redeem from the blockchain, the actual settled cash flows of the wallet. The real number was a loss of about $55.

Around $1,820 of profit was fictional. Three things created it. First, phantom fills: Polymarket's order server would answer "MATCHED" for orders that never actually settled on-chain. Roughly 90% of reported fills were phantoms, and the bot booked imaginary winners as real profit. Second, the slippage I mentioned, which the backtests never paid. Third, what I came to call the favorite trap: 318 trades bought between 80 cents and a dollar lost $1,388 combined, because at those prices a win pays pennies and a single loss costs the full stake. The wallet's true equity peaked at about $1,123 on May 12, gave back $733 in one bad day on May 16, and bled from there.

Chart comparing the bot's claimed equity curve rising to +$1,765 against the on-chain settled equity ending at minus $55
The bot's ledger vs the blockchain, May 1 to June 4.

The ending was almost comic. By June 4 the wallet held $46.93, just under the bot's $50 minimum stake. So it sat there for days, faithfully finding trades, submitting orders, getting rejected for insufficient balance, and retrying. A machine built to print money, stuck in a loop asking for $50 it didn't have.

Where it stands now

I stopped the bot. Not because the code failed, but because the honest accounting says this market, traded this way, has no edge left over after costs. The signal was real. The infrastructure worked. The economics didn't. That's the whole story, and I'd rather tell it straight than join the crowd of people on the internet whose bots are all, somehow, printing money.

What I'm left with is three months of lessons (trust settlement, not logs; backtest against the blockchain, not your own bookkeeping; an edge isn't an edge until it survives execution costs) and a complete, battle-tested piece of infrastructure that I no longer need.

Why I'm giving the Polymarket trading bot away

So I packaged it. The download below is the full bot infrastructure as a Claude skill: it walks you through wallet and API setup with py-clob-client, market discovery, order placement, decision logging, the phantom-fill detector (balance polling that catches fills the server claims but the chain denies), and the on-chain reconciliation script that exposed my fictional $1,820. One important difference from the bot in this story: the kit books a trade only after the blockchain confirms it, so its ledger cannot tell you the lie mine told me. You plug in your own strategy where mine used to be.

And nothing ties it to Bitcoin. The infrastructure works with any market on Polymarket: sports, elections, anything with an order book. Tell Claude what you want to trade and it reconfigures the bot around it. You don't need a technical background; that is exactly why it ships as a Claude skill instead of a bare repository.

To be completely clear: my strategy is not in the box, because it has been proven unprofitable, and shipping it would be selling you a map to a dry well. What you get is everything around it, the part that took three months to get right, so your first weeks can be about your idea instead of your bugs. If you do find an edge, the reconciliation script will tell you whether it's real. Mine wasn't, and I'd have wanted to know in week one.

FAQ

Does Polymarket have an API for bots? Yes. Polymarket runs a central limit order book with a public API, and the py-clob-client Python library covers auth, market data, and orders. The kit sets it all up for you.

Is a Polymarket trading bot profitable? Mine was not, and you just read exactly why. The infrastructure is free; a profitable strategy is your part of the deal. Nothing here is financial advice.

Can it trade markets other than Bitcoin? Yes. The infrastructure works with any Polymarket market. Tell Claude what you want to trade and it adapts the bot for you; no coding background needed.

What do I need to run it? Any machine that runs Python (mine was a Raspberry Pi), a Polygon wallet with USDC, and a Polymarket account. The API is free; the only real money involved is whatever you choose to trade.

Is it allowed where I live? Polymarket restricts some jurisdictions. Check their terms for your country before trading, with a bot or without one.

I write build logs like this one about every project I run: bots, AI personas, websites, the numbers included. The next ones are on the journal and the newsletter.