Sitemap
CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

I Was Paralyzed by Stock Market Uncertainty. So I Built My Own Quant Engine.

3 min readAug 29, 2025

--

For years, I dove deep into stock analysis. I read the books, studied the charts, and learned the fundamentals. I thought this knowledge would make me a better, more confident investor. It did the opposite.

Here is video form of this article if you prefer to watch video.

The more I learned, the less certain I became.

For every technical indicator suggesting a “buy,” I could find a historical chart where that exact setup failed spectacularly. For every company with stellar fundamentals, there was a story of an unforeseen event that tanked the stock. The market felt like a sea of contradictions, and I was frozen on the shore, with most of my funds sitting in cash, missing out on years of potential growth.

I knew I needed a way to trade with confidence, a method grounded in data, not just gut feelings. I needed a system that could answer two simple questions: what to trade, and when?

I looked at existing quantitative trading platforms, but they didn’t feel right.

  1. The Black Box Problem: How could I trust a system I didn’t understand, especially when my own capital was on the line?
  2. The Cost: Many platforms are expensive, with no guarantee of returns. I wasn’t keen on paying for more uncertainty.
  3. The Time Sink: I figured the time I’d spend researching and evaluating other systems was time I could spend building one myself — one that I could trust because I built it.

So, I set out to build AlphaSuite.

My first challenge was data. I needed reliable, comprehensive data without breaking the bank. Yahoo Finance was the answer, and I built a robust tool around the yfinance library to handle common issues like rate limiting and to efficiently manage millions of price records in a PostgreSQL database.

Next, I needed to find what to trade. I built a scanner that could sift through thousands of stocks, calculating everything from simple financial ratios to custom scores, helping me identify strong candidates for a watchlist.

But when to trade was the hardest part. I backtested dozens of classic, rule-based strategies — the kind you read about in popular investment books. The results were sobering. Most of them performed far worse than a simple buy-and-hold strategy on an index like the S&P 500. This was a crucial insight: active trading is hard, and it’s easy to miss out on major market gains by being on the sidelines.

This led me to a core-satellite portfolio strategy: the majority of my capital would stay in major index ETFs for the long haul, while a smaller, dedicated portion would be used for active trading with high-probability strategies.

With the rise of AI, I wondered if machine learning could give me an edge. I integrated the pybroker library and began experimenting with ML models like LightGBM. After extensive research and walk-forward testing, I developed several ML-based strategies that showed promising, consistent results on both US and Canadian stocks.

Press enter or click to view image in full size
An equity curve chart from a successful backtest, showing outperformance against a buy-and-hold benchmark.
An equity curve chart from a successful backtest, showing outperformance against a buy-and-hold benchmark. Image by author

That’s why I made AlphaSuite open-source.

It’s a complete toolkit covering the full quant pipeline: data management, analysis, scanning, and strategy backtesting with both rule-based and ML models. It’s the system I wish I had when I started.

Press enter or click to view image in full size
A screenshot of the AlphaSuite dashboard, Model Training & Tuning page
A screenshot of the AlphaSuite dashboard, Model Training & Tuning page. Image by author

If you’re a developer, an analyst, or just a curious investor who believes in data-driven decisions, I invite you to check it out on GitHub. Use it, fork it, contribute to it, and build your own confidence in the markets.

--

--

CodeX
CodeX

Published in CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Richard Shu
Richard Shu

Written by Richard Shu

Senior software developer & AI practitioner (full-stack, 20+ years) , builder of aitransformer.net, videoplus.studio and AlphaSuite.

Responses (4)