The problem
Trading (and winning) automatically sounds like a dream, or a very well-oiled sales pitch. Too good to be true. And yet some people have made it work (though their secret is never for sale, I wonder why). That was the first spark. Then came the real question: what can bots do that we can’t? Work 24/7, stay focused minute after minute, crunch numbers at a scale no human can, and never let fear or greed get in the way. So why not try? Plus, I was studying machine learning and deep learning, and there’s no better way to learn than getting your hands dirty on a real system.
What I built
A trading engine that runs 24/7 on Binance. Every minute it pulls the latest candles, computes technical features, and asks two machine-learning models two questions: how likely is this trade to hit its take-profit, and how likely is it to hit its stop-loss? From those two probabilities it decides to buy, sell or hold, then places the orders and manages the exits on its own.
It runs several “projects” at once (different models, coins and risk settings), so strategies can be compared live, side by side, instead of on paper.
How it works
- Data layer: one data manager per coin polls Binance, fills gaps and signals each new candle. It’s shared by every strategy trading that coin.
- Features: RSI, moving averages, volume, z-scores and returns, computed incrementally (only on new rows) to keep each cycle fast.
- Models: two LSTM models per strategy, one predicting take-profit, one predicting stop-loss. Three trained models (two for Bitcoin, one for Ethereum), loaded once and shared between strategies.
- Decision: a strategy controller per project combines the two probabilities with its thresholds: buy, sell or hold.
- Execution and risk: market orders, OCO orders, trailing stops, a stop-loss buffer, a cooldown before re-entry, and small fixed position sizes.
- Recovery: each strategy’s state (position, entry price, pending orders) is saved after every action, so the engine picks up exactly where it was after a crash or restart.
- Visibility: separate logs for trades, positions and failures, plus a web dashboard for live monitoring.
The engine is built in strict layers (data → features → model → strategy → orders), and no layer depends on the one above it.
Rebuilding it right
The engine works, but it taught me something about ML in production. The code that computes features existed twice: once in the live engine and once in the research notebooks used for training. Over time, two copies drift apart, and a model starts seeing slightly different data live than it saw in training. Nothing crashes. Results just quietly get worse.
So I’m re-architecting it, with the same strategy and better foundations:
- One shared core for features, used by both live trading and research. No more copies, no more drift.
- A lean live package, the only thing deployed to the server.
- Research stays local, with training data moving from CSV to Parquet.
What it taught me (and what it means for you)
This project taught me how good software gets built today: in partnership with AI. Claude Code for the actual coding, another LLM for design questions and theory, and me deciding what’s worth building and whether the result is right. Working this way, improving a codebase becomes a loop: review, rethink, rebuild, and each round leaves the code cleaner than before. The rewrite above came out of exactly that loop.
And somewhere along the way, something unexpected tends to emerge: a new way of seeing an old, “finished” project. That’s what I bring to your systems too, AI as a partner rather than a shortcut, and a human who stays accountable for every decision.
