StockView is a desktop web application for real-time stock market analysis. It combines interactive data visualization, anomaly detection, news sentiment insights, and machine learningβbased price predictions into a single dashboard.
π Live Deployment:
- Frontend (Vercel) β View App
- Backend (Render) β See
DEPLOYMENT_COMPLETE_GUIDE.mdfor deployment instructions
-
Real-time Stock Data β Current price, open, high, low, and volume.
-
Interactive Charts β Zoom/pan with SMA, anomaly highlights, and prediction overlays.
-
Technical Indicators β SMA, RSI, MACD, Bollinger Bands, ATR, and more.
-
Anomaly Detection β Detects unusual price movements via Z-score.
-
Machine Learning Predictions β
- Algorithms: Linear Regression, Random Forest, XGBoost, LightGBM, CNN.
- Metrics: RΒ², MAE, RMSE, MAPE.
- Algorithm comparison dashboard.
- Model evaluation framework β Chronological backtesting across multiple symbols with automated reports and charts.
-
News & Sentiment Analysis β Headlines with Positive/Neutral/Negative labels and sentiment charts.
-
Watchlist β Add/remove stock symbols, synced with Firebase.
- React + Hooks for state management
- Recharts for interactive visualization
- TailwindCSS for UI styling
- Firebase (Cloud Firestore) for watchlist persistence
- FastAPI for REST API
- Yahoo Finance (
yfinance) for stock data - VADER Sentiment Analyzer for news sentiment
- ML Models: scikit-learn, XGBoost, LightGBM, TensorFlow (CNN)
- Technical indicators with
talibrary - Matplotlib for evaluation visualizations
StockView includes a reproducible backtesting pipeline in backend/evaluation.py that benchmarks all five forecasting models on historical data.
- Downloads OHLCV data via yfinance (same pipeline as the live API)
- Applies chronological 80/20 train/test split (no random shuffling β avoids look-ahead bias)
- Reuses shared modules (
features.py,models/training.py) used by the live API - Computes MAE, RMSE, MAPE, and RΒ² on the held-out test set
- Exports results to CSV, a summary report, and comparison charts
| Model | Description |
|---|---|
| Linear Regression | Time-index trend baseline |
| Random Forest | Ensemble on 21 engineered features |
| XGBoost | Gradient boosting on engineered features |
| LightGBM | Light gradient boosting on engineered features |
| CNN | 1D convolutional network on raw Close price sequences |
Evaluated on AAPL, MSFT, TSLA, GOOGL, AMZN with an 80/20 chronological split:
| Model | Avg MAE | Avg RMSE | Avg MAPE | Avg RΒ² |
|---|---|---|---|---|
| Random Forest | $17.60 | $20.65 | 5.13% | -1.02 |
| LightGBM | $17.49 | $20.34 | 5.17% | -1.11 |
| XGBoost | $17.68 | $20.67 | 5.21% | -1.14 |
| Linear Regression | $30.96 | $33.64 | 9.10% | -2.93 |
Per-symbol highlights:
| Symbol | Best Model | MAPE | RΒ² |
|---|---|---|---|
| TSLA | LightGBM | 1.22% | 0.92 |
| MSFT | LightGBM | 2.05% | 0.38 |
| AAPL | Linear Regression | 4.24% | 0.35 |
Full results:
evaluation_results.csvΒ· Summary:evaluation_report.txtΒ· Charts:evaluation_outputs/
Requirements: Python 3.11 (see .python-version) and pip install -r backend/requirements.txt. CNN evaluation requires tensorflow-cpu.
cd backend
# Evaluate a single symbol
python -c "from evaluation import evaluate_symbol; evaluate_symbol('AAPL')"
# Evaluate multiple symbols (default: AAPL, MSFT, TSLA, GOOGL, AMZN)
python evaluation.pyOutputs generated at project root:
evaluation_results.csv # Per-model metrics (CSV)
evaluation_report.txt # Best/worst models, averages, recommendations
evaluation_outputs/ # Actual vs predicted charts, error & performance comparisons
StockView/
βββ frontend/
β βββ src/App.jsx # React app (UI and chart logic)
β βββ ...
β
βββ backend/
β βββ main.py # FastAPI routes
β βββ config.py # Environment configuration
β βββ features.py # Technical indicators & feature engineering
β βββ data.py # yfinance data pipeline with caching
β βββ metrics.py # Chronological splits & evaluation metrics
β βββ recommendations.py # Symbol-specific model recommendations
β βββ models/ # Training & multi-step prediction
β βββ evaluation.py # Offline backtesting framework
β βββ tests/ # pytest unit tests
β βββ requirements.txt
β
βββ evaluation_results.csv # Benchmark metrics (generated by evaluation.py)
βββ evaluation_report.txt # Summary report with recommendations
βββ evaluation_outputs/ # Evaluation charts (actual vs predicted, comparisons)
βββ README.md
Replace the placeholder images above with actual screenshots of your app for a better showcase.
For complete deployment instructions, see DEPLOYMENT_COMPLETE_GUIDE.md
Quick Overview:
- Backend: Deploy to Render (see guide for details)
- Frontend: Deploy to Vercel (see guide for details)
- Firestore: Configure security rules in Firebase Console
Copy backend/.env.example to backend/.env and set:
| Variable | Required | Description |
|---|---|---|
NEWS_API_KEY |
Yes (for news) | NewsAPI key |
CORS_ORIGINS |
No | Comma-separated frontend URLs (default: *) |
On Render, set NEWS_API_KEY in the dashboard (see render.yaml).
cd backend
pip install -r requirements.txt
uvicorn main:app --reloadRuns at β http://localhost:8000
cd frontend
npm install
npm run devRuns at β http://localhost:5173
- Search for a stock symbol (e.g.,
AAPL,TSLA). - Explore real-time price charts with SMA and anomalies.
- Toggle ML predictions and model comparison.
- Check news headlines with sentiment analysis.
- Save your favorite stocks in the watchlist.
This project is for educational purposes only. Predictions and insights are not financial advice.
- Optimized for desktop browsers only (not mobile responsive).
- Requires valid API keys (
NEWS_API_KEYfor news; Firebase for watchlist). - Live ML metrics use chronological 80/20 holdout (out-of-sample).
- Symbol-specific algorithm recommendations via
/evaluation/recommendation. - GitHub Actions CI runs backend unit tests on push.
- Works best on Chrome, Edge, or Firefox.



