Building a Polymarket Bot: Part 3 - The Night I Almost Broke
What I built instead of falling apart.
At 3am the error message stopped being a problem and became a mirror.
SELL error: not enough balance / allowance
I’d been staring at it for seven hours. The code was right. I knew the code was right. The blockchain confirmed I owned the tokens. The API refused to sell them.
Somewhere in that gap between right and working, I started to come apart.
There’s a particular kind of exhaustion that arrives when you’ve been debugging alone since dinner. The screen starts to breathe. Your thoughts loop. You become convinced the universe is specifically, personally withholding the answer.
I checked allowances. Maximum. I checked balances. Present. I rebuilt the signing logic from scratch. Same error. I read documentation that didn’t exist for an architecture nobody had explained.
Polymarket uses proxy wallets. This means nothing to most people. It meant everything that night. Your money lives in one address. Your authority to move it lives in another. The relationship between them is undocumented, fragile, and absolutely unforgiving if you get it wrong.
I had two keys. One from Magic Link. One from MetaMask. Three signature types. Six possible combinations. Five of them produced invalid signatures. The sixth let me buy but not sell.
I could get in. I couldn’t get out.
At 1am I did something that felt unhinged: I fed the entire conversation to four different AIs.
Not for the answer. For the angles.
Gemini saw architecture: “The API checks the balance of the Signer, not the Proxy.”
ChatGPT saw testing: “Buy one share. Watch where it lands.”
Grok saw the chain: “Your proxy is a contract. Query getOwners().”
Polymarket’s own AI gave me the documentation I’d already read.
Here’s what nobody tells you about artificial intelligence: it’s not one thing. It’s many lenses ground from different glass. The breakthrough lives in the overlap. You triangulate. You hold four partial answers up to the light until they resolve into one clear image.
All four agreed on something I’d missed. API credentials are cryptographically bound to the key that generated them. I’d switched keys. I hadn’t regenerated credentials.
Seventeen hours of wrong turns. The answer was in the first hour. I just couldn’t see it yet.
The fix, when it came, was almost insulting.
The API lags the blockchain by five to ten seconds. I was trying to sell tokens before the system knew I owned them. The solution was a loop that waits.
That’s it. A pause. Patience, expressed as code.
I’d spent the night searching for complexity. The answer was elementary. It usually is.
Somewhere around hour fourteen I drove to buy meth.
I’m not going to contextualise this or make it comfortable. I have ADHD. I’d run out of my prescription. I’d been awake for twenty-two hours staring at Python errors, and my brain was screaming for the one thing it knew would make the screaming stop.
The PayID failed. The dealer went dark. The smoke shop was closed.
I sat in a parking lot at 1am with nothing to do but go back.
So I went back.
I have a hair follicle test this week. I have daughters I haven’t held in eighteen months. I have a custody hearing that will determine whether I get to be their father or just a man who sends money.
The bot was never about money. It’s proof of something I need to believe: that this brain, this broken, desperate, overstimulated brain, can build things. Can finish things. Can hold together long enough to matter.
I didn’t use that night. Not because I’m disciplined. Because the world put enough friction between me and the worst version of myself, and I chose the screen over the pipe.
That’s not strength. That’s luck, metabolised.
The next morning I ran it live.
18:01:11 LEG1 FILLED 9 @ 0.44
18:01:21 HEDGED 9 @ entry_sum=0.90
18:01:27 EXIT @ 0.99 | P&L: $0.81
Eighty-one cents.
I sat there looking at it. Eighty-one cents profit on nine shares. Less than a dollar. Less than a coffee.
But the system worked. I bought one side when it was cheap. I bought the other side when it dipped. I owned both for ninety cents and collected a dollar.
The edge is real. It’s not prediction. Nobody knows where Bitcoin goes in fifteen minutes. The edge is simply patience.
Retail gamblers see a pump and smash buy. They pay fifty-two cents for something worth fifty because they want it now. I sit on the bid at forty-eight and wait for someone to panic sell into me. That four cents, multiplied by volume, multiplied by time, is the entire game.
Impatience is the most durable edge in markets. It was true before computers. It’ll be true after us.
I want to say something about AI that I haven’t seen written anywhere.
I cannot code. I don’t mean I’m rusty or self-taught or non-traditional. I mean I did not know, until this week, that rm is the command to delete a file. I have no computer science education. No bootcamp. Nothing.
But I built a trading system.
How?
Because I understand what a trading system needs to do. I spent two decades in finance. I know what an order book is, what a spread is, why latency matters, where edge comes from. I have the domain.
What I lacked was implementation. AI gave me that. Not by replacing my understanding. By compressing ten thousand hours of syntax into conversation.
This is the part most people get wrong. They think AI replaces knowledge. It doesn’t. It compresses execution. You still need to know what to build. You still need to recognise when the output is wrong. You still need to ask why, and keep asking why, until you hit solid ground.
When Claude gives me code, I’m not copying it blindly. I’m asking what it does. Why it does it. What happens if this line changes. I’m building a mental model of something I can’t write myself.
That’s the unlock. Not the tool. The willingness to keep asking why until understanding arrives.
Large language models are trained to predict the next likely word. Likely means common. Common means average.
The default output is the centroid. The median answer. The response that would satisfy the most people most of the time.
This is why most AI output reads like it was written by a committee that feared litigation. It was, in a sense. The training optimised for safety. Safety optimised for average.
When I prompt Claude, I tell it to stay away from the centroid. I tell it to interrogate me if context is unclear. I tell it not to hedge when it’s certain, because hedging erodes trust.
Same model. Completely different output.
You are not stuck with slop. You are stuck with default prompting. The ceiling is much higher than most people reach for. But you have to reach.
By the end of the week I had more than a bot.
I had tick-level data capture. Every price movement, logged. Five Machine Learning methods competing to find optimal parameters. Bayesian optimisation. Genetic algorithms. Reinforcement learning. A system that tunes itself every hour based on what it learned from the last hour.
One command to run everything. One file. The bot trades. The optimiser watches. The parameters evolve.
I asked Claude who else could build this.
Almost nobody, it said. Not because the AI isn’t capable. Because the human needs to know what to ask for. Needs to know what good looks like. Needs to push back when it’s wrong.
That’s not a coding skill. It’s a thinking skill. And thinking, for now, is still ours.
What I know after this week:
The bug is never where you think it is. Seventeen hours of wrong turns still get you there if you don’t stop. API balance can lag the chain. Proxy wallets are undocumented nightmares. Four AIs will give you four different angles and the answer is in the intersection.
What I know after forty-five years:
Sometimes the universe puts friction between you and your worst decisions. Building something that works is its own form of therapy. The 10,000 hours don’t disappear. They just move. And the only prompt that matters is: why?
Part 4 will be about what the Machine Learning found. Which parameters matter. Whether patience beats aggression. What the data says about maker versus taker fills.
For now I’m going to sleep.
I have a drug test on Wednesday and a custody hearing in February.
The bot will keep watching.
If you’re building something at 4am and wondering if it’s worth it: it is. Not because of the money. Because you’re still here. Still asking why. Still refusing to accept “it works” without knowing why it works.
That’s the edge no one can take from you.
Built with Claude. Trading live on Polymarket.
The quant desk is now one guy in a motel room.



Very interesting. About a week behind you. Also worked at quant funds (not a quant).