Algorithmic Trading Model
An LSTM in TensorFlow and Keras for price movement, combined with mean reversion and backtested honestly.

- Type
- Artifact
- Where
- Personal
- When
- May 2023 → Aug 2023
- Duration
- 3 mo
- Status
- Research
- Source
- GitHub
The problem
Predicting price from price alone is close to the hardest version of a forecasting problem, and it is very easy to build something that looks profitable and is actually reading the future.
What I built
An LSTM built in TensorFlow and Keras over historical series pulled from the Yahoo Finance API, combined with regression and a mean-reversion signal.
The part that mattered was the backtest — walking the model forward over held-out history rather than scoring it on data it had already seen.
Results
- Working sequence model over real historical data.
- Backtesting harness that scores on unseen history rather than training data.
- Two independent signals combined rather than one over-trusted.
Architecture
In hindsight
I did not model transaction costs or slippage. A strategy that trades often can be profitable on paper and unprofitable the moment you charge it for every trade — that omission makes the returns indicative at best, and I'd treat it as the first thing to fix.