Transform market data into actionable insights with machine learning-powered stock analysis
QuantSight is a professional-grade quantitative research platform that combines the power of machine learning, statistical analysis, and modern web technologies to help traders, analysts, and researchers make data-driven investment decisions. Whether you're backtesting trading strategies, analyzing alpha factors, or exploring market sentiment, QuantSight provides the tools you need in an intuitive, elegant interface.
- π Secure Authentication - Email/password and OAuth (Google, GitHub) with email verification
- π€ Walk-Forward ML Models - XGBoost predictions with proper out-of-sample validation
- π Portfolio Backtesting - Multi-asset strategies with various allocation methods
- π Factor Analysis - 60+ alpha factors with PCA diagnostics and IC analysis
- π° Sentiment Analysis - NLP-powered news sentiment extraction
- π Signal Diagnostics - Validate signal quality with decay analysis
- β‘ Modern UI - React + TypeScript frontend with dark mode
- π§ RESTful API - Production-ready endpoints for automation
- Supabase Account - Sign up at supabase.com
- Node.js 16+ and Python 3.9+
The project is organized into two main directories:
frontend/- React + TypeScript (Vite)backend/- Flask + Python
Terminal 1 - Backend:
cd backend
pip install -r requirements.txt
python main.pyBackend runs at http://localhost:5000
Terminal 2 - Frontend:
cd frontend
npm install
npm run devFrontend runs at http://localhost:5173
-
Set up Supabase database:
- Follow instructions in SUPABASE_SETUP.md
- Run the SQL script to create the profiles table
- Enable email authentication and OAuth providers
-
Configure environment variables:
frontend/.env:VITE_SUPABASE_URL=your_supabase_url VITE_SUPABASE_ANON_KEY=your_anon_key VITE_API_BASE_URL=http://localhost:5000
backend/.env:NEWS_API_KEY=your_news_api_key PORT=5000
-
Access the app:
- Open
http://localhost:5173 - Create an account or sign in
- Verify your email to access the platform
- Open
This project is designed to deploy on:
- Frontend: Vercel (free tier)
- Backend: Render (free tier)
See DEPLOYMENT.md for complete deployment instructions.
Quick Deploy:
- Push to GitHub
- Connect Render to deploy backend
- Connect Vercel to deploy frontend
- Update environment variables on both platforms
QuantSight uses Supabase for secure authentication:
- Email/Password: Traditional registration with email verification
- OAuth: Sign in with Google or GitHub
- Protected Routes: All app features require authentication
- User Profiles: Stores user information and preferences
See SUPABASE_SETUP.md for detailed setup instructions.
Frontend: React 18 β’ TypeScript β’ Vite β’ TailwindCSS β’ Recharts β’ Radix UI
Backend: Flask 3 β’ Python 3.9+ β’ Flask-CORS β’ XGBoost β’ pandas β’ numpy
Auth: Supabase Authentication β’ Row Level Security
Data: yfinance (market data) β’ NewsAPI (sentiment) β’ local file cache
Deployment: Vercel (Frontend) β’ Render (Backend)
QuantSight/
βββ frontend/ # React + TypeScript (β Vercel)
β βββ components/ # React components
β βββ contexts/ # Auth context
β βββ services/ # API & Supabase client
β βββ App.tsx # Main app
β βββ package.json # Frontend deps
β βββ vercel.json # Deployment config
βββ backend/ # Flask API (β Render)
β βββ core/ # Python backend logic
β β βββ adapter_api.py # REST API endpoints
β β βββ model.py # XGBoost ML models
β β βββ backtest.py # Backtesting engine
β β βββ research/ # Factor analysis, portfolios
β βββ main.py # Flask app entry
β βββ requirements.txt # Python deps
βββ DEPLOYMENT.md # Deployment guide
βββ SUPABASE_SETUP.md # Supabase setup
βββ README.md # This file
See PROJECT_STRUCTURE.md for detailed structure information. β βββ adapter_api.py # REST API endpoints β βββ model.py # XGBoost ML models β βββ backtest.py # Backtesting engine β βββ research/ # Factor analysis, portfolios, experiments βββ components/ # React frontend β βββ pages/ # 11 main pages (Dashboard, ModelLab, etc.) β βββ ui/ # Reusable UI components β βββ charts/ # Data visualizations βββ data/ # Cached market data βββ models/ # Trained ML models βββ dist/ # Production build
## π§ API Endpoints
### Main Endpoints
- `POST /api/models/train` - Train walk-forward XGBoost model
- `POST /api/portfolio/backtest` - Multi-asset portfolio backtest
- `POST /api/factors/compute` - Calculate 60+ alpha factors
- `POST /api/experiments/run` - Hyperparameter grid search
- `POST /api/signals/decay` - Signal decay analysis
- `POST /api/sentiment/analyze` - News sentiment extraction
- `GET /api/dashboard/overview` - Portfolio metrics
- `GET /api/tickers/:ticker` - Single-stock analysis
- `GET /api/risk/metrics` - Risk analytics
**Example Request:**
```bash
curl -X POST http://localhost:5000/api/models/train \
-H "Content-Type: application/json" \
-d '{"tickers": ["AAPL"], "startDate": "2015-01-01", "horizon": "1d"}'
Train a model and backtest a strategy:
# 1. Train XGBoost model
curl -X POST http://localhost:5000/api/models/train \
-H "Content-Type: application/json" \
-d '{"tickers": ["AAPL"], "startDate": "2015-01-01", "horizon": "1d"}'
# 2. Run portfolio backtest
curl -X POST http://localhost:5000/api/portfolio/backtest \
-H "Content-Type: application/json" \
-d '{
"tickers": ["AAPL", "MSFT", "GOOGL"],
"start": "2015-01-01",
"signal": "prob_up_1d",
"allocator": "equal_weight",
"rebalance": "weekly"
}'Or use the web interface - navigate to Model Lab or Portfolio Backtest pages.
Create a .env file for API keys:
NEWS_API_KEY=your_news_api_key_here # Get free key at newsapi.org
VITE_API_BASE_URL=http://localhost:5000Customize factors in core/research/factors.py or model parameters in core/model.py.
| Issue | Solution |
|---|---|
ModuleNotFoundError |
Run pip install -r requirements.txt |
Cannot find module 'react' |
Run npm install |
| Port 5000 in use | Change port in main.py or kill process |
| "Failed to fetch" errors | Ensure Flask backend is running |
| Slow model training | Reduce date range or use fewer tickers |
Production build:
npm run build
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 main:appSecurity: Enable HTTPS, set FLASK_DEBUG=False, implement rate limiting and authentication.
Contributions welcome! Fork the repo, create a feature branch, and submit a PR.
Follow PEP 8 for Python and ESLint rules for TypeScript.
MIT License - see LICENSE file for details.
Built with β€οΈ for quantitative researchers
QuantSight - See the market through a quantitative lens