Claude as Copilot for Live Trading
How I use Claude Code as a copilot for live trading bot development. Real-time debugging, architecture decisions, and shipping faster.
· AI
My shell history doesn't lie. 80+ cargo run invocations. 20 Claude sessions. Budget swinging from $600 down to $50 and back up. This is what AI-assisted development actually looks like when every bug costs real dollars.
What Was the Setup?
I was building a hedged-pairs trading bot for Polymarket in Rust. The idea: buy both sides of a binary market (YES + NO) when the combined price drops below $0.99, pocket the guaranteed penny. Simple math. Brutal engineering.
What Did the Debug Loop Look Like?
The workflow became a tight loop: run the bot, watch it break against live market conditions, Alt+Tab to Claude, paste the error, get a fix, apply it, restart. Rinse and repeat. The compiler was happy. The market was not.
# My actual shell history, compressed:
cargo run --bin adaptive_bot -- --auto --budget 500 --live
# Connection timeout. Fix.
cargo run --bin adaptive_bot -- --auto --budget 500 --live
# API deser error: "expected string, got integer". Fix.
cargo run --bin adaptive_bot -- --auto --budget 200 --live
# Position imbalance: YES=98, NO=177. Stuck.
claude # "help me design a mathematical protection system"
# ... 12 laws of trading later ...
cargo run --bin adaptive_bot -- --auto --budget 50 --live
# Bot too safe to trade. ЗАКОН 11 blocks everything.
What Claude Actually Did
Claude wasn't just fixing syntax. It co-designed a system of 12 mathematical trading laws — from basic imbalance checks to advanced hedging proofs. When ЗАКОН 6 started blocking one side of paired grid orders, we discovered together that the law was mathematically correct but operationally wrong. Paired orders don't change imbalance, so the single-order check was a false positive.
The real power wasn't code generation. It was having a partner who could context-switch between Rust borrow checker errors, order book math, WebSocket race conditions, and "why does the UI show profit when we're at a loss" — all in the same afternoon.
What Were the Numbers?
- 80+ bot restarts across 3 weeks
- 20 Claude debugging sessions
- 12 mathematical trading laws designed collaboratively
- 1 race condition caught (WebSocket fill before REST order ID)
- 29MB log file analyzed to find a single info!() firing 37,818 times
- Budget range: $50 — $600 (confidence correlated with bug count)