Every quant’s journey starts the same way: “What if I could predict the market?” Most quit after their first linear regression spits out noise. I didn’t quit — I built GodFin, an LSTM-based trading bot that generates alpha over buy-and-hold on 67% of tested tickers. Here’s the honest story of what worked, what didn’t, and what I learned.
What Is GodFin?
GodFin is a Python-based algorithmic trading system I built from scratch. It uses deep learning to generate daily buy/sell/hold signals for individual equities. The core idea: markets have short-term sequential patterns that a well-tuned recurrent neural network can exploit — not perfectly, not always, but often enough to beat passive holding.
Important disclaimer upfront: GodFin runs on paper trading only. Every result I share here is from simulated execution, not live capital. I’m not here to sell you a dream — I’m here to show you what’s technically possible and where the walls are.
The Architecture: LSTM + Attention
The model stack is straightforward but deliberate:
Input Features (OHLCV + technicals, ~40 features)
→ Normalization Layer
→ LSTM (2 layers, 128 hidden units)
→ Multi-Head Self-Attention
→ Dense → Dropout → Dense
→ 3-class output (Buy / Hold / Sell)
Why LSTM over Transformer-only? For daily-frequency equity data, you typically have 500–1000 training samples per ticker after walk-forward splits. Transformers are data-hungry. LSTMs handle small sequential datasets more gracefully, and the attention layer on top lets the model weight which timesteps matter most for the current prediction.
Features include standard technicals (RSI, MACD, Bollinger width, ATR) plus some custom ones: volume regime z-scores, rolling volatility ratios, and a momentum divergence signal. Nothing exotic — the alpha comes from the model learning interactions between these features over time, not from any single magic indicator.
Walk-Forward Validation: The Only Backtest That Matters
If you’re backtesting with a random train/test split on time series data, stop. You’re leaking future information.
GodFin uses strict walk-forward validation: train on months 1–6, validate on month 7, retrain on months 1–7, validate on month 8, and so on. The model never sees future data during training. Period.
Here are the alpha results (model return minus buy-and-hold return) across four tickers over the same validation window:
| Ticker | Model Return | Buy-and-Hold | Alpha |
|---|---|---|---|
| CZR | +32.14% | +6.65% | +25.49% |
| COIN | +24.87% | +5.45% | +19.42% |
| HOOD | +18.22% | +5.13% | +13.09% |
| PLTR | -8.41% | +11.37% | -19.78% |
Three out of four tickers showed meaningful positive alpha. That’s the 67% headline number — and yes, I’m counting honestly. PLTR was a loss.
What Went Wrong With PLTR
PLTR’s price action during the test window was dominated by a sentiment-driven rally tied to government contract news. The model’s technical features had no way to capture that. It kept generating sell signals into a momentum rip, got stopped out repeatedly, and underperformed badly.
Lesson: LSTM models trained on price/volume technicals are fundamentally blind to narrative-driven moves. If I were to improve this, I’d need to integrate NLP sentiment signals from news or social media — a meaningful infrastructure addition, not a quick fix.
This is exactly the kind of result you need to be honest about. Cherry-picking the three winners and hiding PLTR would make great marketing. It would also be dishonest. Every model has failure modes. Know yours.
The Subprocess Isolation RAM Fix
Here’s a war story that has nothing to do with ML theory and everything to do with production engineering.
GodFin trains separate models per ticker. Initially, I ran all training sequentially in a single Python process. After 5-6 tickers, RAM usage ballooned past 12GB. PyTorch doesn’t release GPU/CPU memory cleanly between training runs in the same process — torch.cuda.empty_cache() helps but doesn’t fully solve it, and on CPU-only workloads (my setup), there’s no equivalent.
The fix: subprocess isolation. Each ticker’s training runs in its own subprocess.Popen child process. When the child exits, the OS reclaims all memory. Clean. Simple. Brutal.
import subprocess, json, sys
def train_ticker(ticker: str, config_path: str) -> dict:
result = subprocess.run(
[sys.executable, "train_single.py", "--ticker", ticker, "--config", config_path],
capture_output=True, text=True, timeout=600
)
if result.returncode != 0:
raise RuntimeError(f"{ticker} training failed: {result.stderr[-500:]}")
return json.loads(result.stdout)
RAM usage went from “crashes after 6 tickers” to “stable at ~3GB for 20+ tickers.” This isn’t a novel technique — it’s standard practice in ML pipelines — but it’s the kind of thing that takes you hours to debug when you don’t know to look for it.
Key Takeaways
1. Walk-forward or nothing. Any other validation scheme on time series is self-deception. If your backtest looks too good, it probably is.
2. Per-ticker models beat universal models (at this scale). Each equity has its own volatility regime and feature relationships. A single model across all tickers diluted signal quality significantly in my tests.
3. Attention over raw LSTM matters. The attention layer improved validation accuracy by ~4% on average. It lets the model focus on specific lookback periods rather than treating all 60 timesteps equally.
4. Infrastructure is half the battle. The subprocess RAM fix, proper logging, and automated walk-forward pipelines took as much engineering time as the model itself. If your ML code works in a notebook but not in production, you don’t have a trading system — you have a demo.
5. Be honest about failures. PLTR lost. The model isn’t omniscient. Publishing only your wins is how you end up as a cautionary tale on r/algotrading.
What’s Next
I’m building GodFin into a platform where users can track these signals in real time — still paper trading, still transparent about what the model can and can’t do. If you’re interested in following along as I scale this from 4 tickers to 50+ and add sentiment integration, join the waitlist at godfinapp.com.
No promises of returns. No “guaranteed alpha.” Just an honest, open-source-minded approach to algorithmic trading with deep learning.
All results shown are from paper trading simulations. Past simulated performance does not guarantee future results. This is not financial advice.