Market sentiment dashboard that pulls financial news, runs it through a fine-tuned DistilBERT model, and shows how sentiment tracks against price movement. Also has a backtester so you can see how trading on sentiment signals would've played out.
Works in demo mode out of the box (no API keys needed).
You'll need Python 3.9+ and Node 18+.
Backend:
cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp ../.env.example .env # optionally add a Finnhub API key
python app.pyFirst run downloads the FinBERT model (~400MB) and seeds 30 days of demo data.
Frontend:
cd frontend
npm install
npm run devDashboard runs at localhost:5173, backend at localhost:5000. Vite proxies API calls automatically.
Training your own model (optional):
cd backend
python train/train_model.pyFine-tunes DistilBERT on Financial PhraseBank (~5 min on CPU). Saves to backend/trained_model/ and gets picked up on next restart.
- Sentiment vs price chart (dual axis, shows correlation over time)
- Live news feed with color-coded sentiment scores
- Accuracy tracker — did yesterday's sentiment predict today's price direction?
- Backtester with 3 strategies: threshold, momentum, and contrarian
- Paste-a-headline analyzer for quick sentiment checks
All under /api:
GET /health— status + model infoGET /dashboard?symbol=AAPL&days=30— main dashboard payloadGET /headlines,/sentiment/trend,/prices,/accuracy— individual dataPOST /backtest— run a strategy simulationPOST /analyze— classify a single headlinePOST /fetch-now— trigger data refresh
- ML: PyTorch + HuggingFace Transformers (DistilBERT)
- Backend: Flask, SQLAlchemy, APScheduler, SQLite
- Frontend: React, TypeScript, Vite, Tailwind v4, Recharts
- Data: Finnhub API for news + prices
