DEV Community

Ankit Kumar
Ankit Kumar

Posted on

I Built a Stock Price Prediction App While Learning ML — Here's What I Learned

TL;DR: I built a full-stack stock prediction app with 7 ML algorithms, 1,001 stocks, and offline-first support. It's open source, and I'd love your feedback.

🔗 github.com/ankit02327/stock-price



How It Started

This project began from something I was personally learning: machine learning.

While taking ML courses at university, I wanted to understand how the algorithms I was studying could be combined into a complete, practical application. That led me to build Stock Price Prediction around a real-world problem instead of keeping the work inside individual coursework exercises.

The educational purpose has remained central. I want someone learning machine learning to be able to look at a real application, understand how different models are used, work with real financial data, experiment with the code, and eventually build projects of their own.


What It Actually Does

  • 7 ML algorithms: Linear Regression, Decision Tree, Random Forest, SVM (basic models) + KNN, ARIMA, Autoencoder (advanced models)
  • 1,001 stocks: 501 US + 500 Indian (936 used for training after filtering insufficient data)
  • Real-time data: US stocks via Finnhub, Indian stocks via Upstox, with permanent offline storage fallback
  • 5-year historical analysis: Interactive charts with Recharts
  • 38 technical indicators calculated from historical data
  • Currency conversion: Automatic USD/INR conversion
  • Smart training: Percentage-based predictions with confidence scoring

The Tech Stack

Layer Technology
Backend Flask 2.3.3, Python 3.8+, TensorFlow 2.20, scikit-learn, statsmodels
Frontend React 18, TypeScript, Vite, Tailwind CSS, Recharts
APIs Finnhub (US), Upstox (India), yfinance (historical)

What Makes It Different: Offline-First

The system works completely offline without any API keys. This was a deliberate design choice — I wanted anyone to be able to clone the repo and start experimenting immediately, without signing up for API keys or worrying about rate limits.

What works offline:

  • Stock info for 1,001 stocks
  • Complete 5-year historical charts (2020–2024)
  • All trained ML models
  • Full-text search
  • 38 technical indicators

What needs API keys: Live prices only.


What I Learned

  1. Machine learning is not magic. It finds patterns, but you need domain knowledge to make sense of them.

  2. Data quality is everything. Stock data is messy — splits, dividends, missing values. A robust preprocessing pipeline matters more than a fancy model.

  3. Start simple, then iterate. My first model was basic linear regression. It wasn't great, but it worked, and it gave me a foundation to build on.

  4. Open source is a two-way street. The project now has 27 contributors and 14 releases. I've learned as much from the community as from building it.


What's Next

I'm planning substantial improvements: FastAPI migration, Redis caching, PostgreSQL, Docker Compose, MLflow experiment tracking, news sentiment analysis, and a backtesting system.

The project is still growing. I see its current US and Indian market coverage as a starting point rather than the final scope.


How You Can Help

If this sounds interesting:

  • ⭐ Star the repo: github.com/ankit02327/stock-price
  • 🐛 Open an issue if you find a bug
  • 🔧 Contribute — there are "good first issue" labels for newcomers
  • 📣 Share it with anyone learning ML

Let's Connect


Thanks for reading. If you're learning ML too, I'd love to hear what you're building.


Top comments (0)