A complete sentiment analysis toolkit combining Google News RSS aggregation with FinBERT (finance-tuned transformer) for real-time market sentiment tracking.
- Fetch latest 10 Google News items per query
- Multi-locale support (US, GB, CA, IN) with query variants
- Per-article sentiment analysis with FinBERT or VADER
- Aggregated summary across all queries and articles
- Focused on INTC/Intel stock queries
- Flask-based REST API
- Modern, responsive web interface
- Real-time FinBERT sentiment analysis
- Displays:
- Primary sentiment label (Positive/Neutral/Negative)
- Probability scores with visual progress bars
- Compound score for quick reference
- Handles long texts with automatic truncation (max 512 tokens)
- Clone and setup:
git clone https://github.com/RachGranville/sentimentstrading.git
cd sentimentstrading
python -m venv .venv
.venv\Scripts\activate # On Windows
source .venv/bin/activate # On macOS/Linux- Install dependencies:
pip install -r requirements.txtjupyter notebook test.ipynb- Edit
querieslist (line ~12 in the code cell) - Choose
method = "finbert"or"vader" - Run the Google News cell to analyze 100+ articles (10 per query)
- View aggregated sentiment summary
python app.pyThen open http://127.0.0.1:5000 in your browser and:
- Type or paste text
- Click "Analyze Sentiment" (or press Enter)
- See instant FinBERT results
NewsSentimentScanner/
├── app.py # Flask web app
├── test.ipynb # Jupyter notebook for batch analysis
├── sentiment_analysis.py # Utility functions
├── requirements.txt # Python dependencies
├── templates/
│ └── index.html # Web UI
└── README.md
- FinBERT: Financial sentiment analysis (yiyanghkust/finbert-tone)
- VADER: Alternative sentiment analyzer (nltk)
- feedparser: Google News RSS parsing
- Flask: Web framework
- Transformers: HuggingFace model pipeline
Positive: Probability of positive sentiment (0.0–1.0)Neutral: Probability of neutral sentiment (0.0–1.0)Negative: Probability of negative sentiment (0.0–1.0)Compound: Pseudo-compound score = Positive − Negative (−1.0 to 1.0)
- Positive: Highest probability is Positive class
- Neutral: Highest probability is Neutral class
- Negative: Highest probability is Negative class
- First FinBERT run downloads the model (~500 MB)
- Long texts automatically truncated to 512 tokens (BERT limit)
- Google News RSS queries fetch up to 10 articles with multi-locale fallbacks
- Flask runs in debug mode; use WSGI server for production
MIT