Professional sentiment analysis dashboard for retail investors
SentimentSignal is a sleek, AI-powered trading dashboard that analyzes market sentiment from news sources and generates actionable trading signals for NIFTY 50 stocks. Built with Flask, transformers (FinBERT & RoBERTa), and a premium dark-mode frontend.
- Dual-Model Approach: Combines FinBERT (financial news) and RoBERTa (social context) for accurate sentiment scoring
- Real-Time News Aggregation: Fetches historical news from Google News RSS
- Sentiment Scoring: Classifies sentiment as Positive, Neutral, or Negative with confidence metrics
- Sentiment vs Price Chart: Overlay sentiment trends on stock price movements
- Buy/Sell Signal Markers: Visual indicators for trading signals
- Time Range Selection: Analyze 1M, 3M, or 6M periods
- Strategy Comparison: AI Sentiment Strategy vs Buy & Hold
- Performance Metrics: Returns, Alpha, Max Drawdown, Win Rate
- Historical Validation: Correlate sentiment with actual price movements
- News Impact Analysis: Identify headlines that moved the market
- Sentiment Attribution: See which news drove positive/negative sentiment
- Source Tracking: Know where the signal originated
- Dark Mode First: Professional trading terminal aesthetic
- Glassmorphism Design: Modern, sleek panels with backdrop blur
- Neon Accents: Color-coded signals (Green=Buy, Red=Sell, Amber=Hold)
- Smooth Animations: Micro-interactions for premium feel
- Fully Responsive: Works on desktop, tablet, and mobile
- Python 3.8+
- pip (Python package manager)
- Modern web browser (Chrome, Firefox, Edge)
-
Clone or navigate to the project directory
cd "C:\Users\Mamta Sharma\Downloads\Sentimental"
-
Install Python dependencies
pip install -r requirements.txt
This will install:
- Flask & Flask-CORS (API server)
- transformers & torch (ML models)
- pandas, numpy (data processing)
- yfinance (stock data)
- feedparser (news aggregation)
-
Start the Flask API server
python app.py
Note: First startup will take 10-30 seconds to load ML models (FinBERT & RoBERTa). You'll see:
Loading sentiment models... Models loaded successfully! ๐ SentimentSignal API Server ๐ Server running at: http://localhost:5000 -
Open the frontend
- Open
index.htmlin your web browser - Or use a local server:
Then visit:
python -m http.server 8000
http://localhost:8000
- Open
-
Enter Stock Ticker
- Type a NIFTY 50 ticker in the search bar (e.g.,
TCS.NS,RELIANCE.NS,INFY.NS) - Use the autocomplete suggestions for common stocks
- Type a NIFTY 50 ticker in the search bar (e.g.,
-
Select Time Range
- Choose 1M, 3M, or 6M analysis period
- Default is 3 months (90 days)
-
Click "Analyze"
- The system will:
- Fetch historical news articles
- Analyze sentiment using AI models
- Generate trading signals
- Run backtesting simulation
- Display comprehensive results
- The system will:
-
Review Results
- Sentiment Overview: Current sentiment score and BUY/HOLD/SELL signal
- Chart: Sentiment trend overlayed on price movement
- Top Drivers: News headlines that influenced sentiment
- Backtest Results: Strategy performance vs benchmark
- Strategy Summary: Plain-English explanation
NIFTY 50 Examples:
TCS.NS- Tata Consultancy ServicesINFY.NS- InfosysRELIANCE.NS- Reliance IndustriesHDFCBANK.NS- HDFC BankICICIBANK.NS- ICICI BankTATASTEEL.NS- Tata SteelWIPRO.NS- WiproSBIN.NS- State Bank of India- And more...
Format: SYMBOL.NS (for NSE) or SYMBOL.BO (for BSE)
- Framework: Flask REST API
- ML Models:
- FinBERT (ProsusAI/finbert) - Financial sentiment
- RoBERTa (cardiffnlp/twitter-roberta-base-sentiment-latest) - Social nuance
- Data Sources:
- Google News RSS (news aggregation)
- Yahoo Finance (stock prices via yfinance)
- HTML: Semantic structure with accessibility
- CSS: Custom design system with CSS variables
- JavaScript: Vanilla JS with Chart.js for visualizations
- No frameworks: Pure web technologies for maximum performance
- Sentiment Scoring: Dual-model ensemble approach
- News Fetching: Historical news with date filtering
- Backtesting: Real sentiment-based trading simulation
- Signal Generation: Threshold-based BUY/HOLD/SELL logic
Health check endpoint
Response:
{
"status": "healthy",
"models_loaded": true,
"timestamp": "2026-01-23T13:00:00"
}Analyze stock sentiment and generate signals
Request:
{
"ticker": "TCS.NS",
"days": 90
}Response:
{
"ticker": "TCS.NS",
"days": 90,
"sentiment": {
"score": 0.234,
"signal": "BUY",
"confidence": 85,
"article_count": 42
},
"backtest": {
"strategy_return": 12.5,
"buyhold_return": 8.3,
"alpha": 4.2
},
"news": {
"top_positive": [...],
"top_negative": [...]
},
"chart_data": {...}
}This project addresses:
- SDG 8 - Decent Work and Economic Growth: Empowers retail investors with professional-grade tools
- SDG 10 - Reduced Inequalities: Democratizes access to sentiment analysis previously limited to institutional traders
- Issue: API shows "Loading Models..." for too long
- Solution: Ensure you have stable internet (models download on first run) and sufficient RAM (2GB+)
- Issue: "No news found for ticker"
- Solution:
- Verify ticker format (e.g.,
TCS.NSnotTCS) - Try a more popular stock
- Check internet connection
- Verify ticker format (e.g.,
- Issue: Frontend can't connect to API
- Solution:
- Ensure Flask server is running on
http://localhost:5000 - Check that Flask-CORS is installed
- Try opening frontend via
http://notfile://
- Ensure Flask server is running on
- Issue: Blank chart area
- Solution:
- Check browser console for errors
- Ensure Chart.js CDN is accessible
- Try refreshing the page
- First Analysis: 20-40 seconds (news fetching + sentiment analysis)
- Subsequent Analyses: 15-30 seconds
- Model Loading: 10-30 seconds (one-time on server start)
- Recommended: Analyze 3-month periods for balance of data and speed
- Real-time sentiment updates
- Reddit/Twitter integration
- Portfolio tracking
- Email alerts for signals
- Mobile app
- Multi-stock comparison
- Custom backtesting parameters
This project is for educational and research purposes. Not financial advice.
ML Model: FinBERT (ProsusAI), RoBERTa (Cardiff NLP)
Data Sources: Google News, Yahoo Finance
Framework: Flask, Chart.js
Design Inspiration: TradingView, Bloomberg Terminal, Zerodha Kite
For issues or questions:
- Check the Troubleshooting section
- Verify all dependencies are installed
- Ensure API server is running
- Check browser console for errors
Built with โค๏ธ for retail investors