Skip to content

jasp-nerd/SentimentEdge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SentimentEdge

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).

Dashboard

Setup

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.py

First run downloads the FinBERT model (~400MB) and seeds 30 days of demo data.

Frontend:

cd frontend
npm install
npm run dev

Dashboard runs at localhost:5173, backend at localhost:5000. Vite proxies API calls automatically.

Training your own model (optional):

cd backend
python train/train_model.py

Fine-tunes DistilBERT on Financial PhraseBank (~5 min on CPU). Saves to backend/trained_model/ and gets picked up on next restart.

What's in here

  • 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

API

All under /api:

  • GET /health — status + model info
  • GET /dashboard?symbol=AAPL&days=30 — main dashboard payload
  • GET /headlines, /sentiment/trend, /prices, /accuracy — individual data
  • POST /backtest — run a strategy simulation
  • POST /analyze — classify a single headline
  • POST /fetch-now — trigger data refresh

Stack

  • ML: PyTorch + HuggingFace Transformers (DistilBERT)
  • Backend: Flask, SQLAlchemy, APScheduler, SQLite
  • Frontend: React, TypeScript, Vite, Tailwind v4, Recharts
  • Data: Finnhub API for news + prices

About

Market sentiment dashboard with FinBERT ML model, backtester, and React frontend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors