A real-time financial news analysis platform that tracks global financial institutions and their impact on Indian markets using AI-powered sentiment analysis.
- Real-time News Aggregation: Fetches latest news from RSS feeds and AI-powered search
- Sentiment Analysis: Multi-layered sentiment analysis using VADER, TextBlob, and keyword matching
- Impact Scoring: Calculates institution impact scores based on multiple factors
- Interactive Dashboard: Beautiful, responsive UI with real-time charts
- AI Chatbot: Ask questions about institutions, trends, and market sentiment
- WebSocket Updates: Live data updates without page refresh
Backend:
- Python 3.9+
- Flask & Flask-SocketIO
- SQLite
- Anthropic Claude AI
- NLTK, TextBlob, VADER
Frontend:
- HTML5, CSS3, JavaScript (ES6+)
- Chart.js
- Socket.IO Client
- Python 3.9 or higher
- Anthropic API Key (Get one here)
- Windows/Linux/macOS
cd financial-news-botWindows:
python -m venv venv
venv\Scripts\activateLinux/macOS:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtRun Python and execute:
python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords'); nltk.download('vader_lexicon')"- Copy
.env.exampleto.env:
copy .env.example .env # Windows
cp .env.example .env # Linux/macOS- Edit
.envand add your Anthropic API key:
ANTHROPIC_API_KEY=sk-ant-your-actual-key-here
SECRET_KEY=your-secret-key-change-this- Generate a secure secret key (optional but recommended):
python -c "import secrets; print(secrets.token_hex(32))"The application will auto-create these, but you can create them manually:
mkdir data logspython run.pycd backend
python app.py============================================================
FINANCIAL NEWS IMPACT ANALYZER
============================================================
๐ Server starting...
๐ URL: http://127.0.0.1:5000
๐ง Environment: development
๐ Debug Mode: True
โฐ Auto-refresh interval: 1800 seconds
๐ก Open your browser and navigate to: http://localhost:5000
============================================================
Performing initial news fetch...
==================================================
Starting news analysis at 2024-12-25 10:30:00
==================================================
...
Open your browser and navigate to:
http://localhost:5000
Or:
http://127.0.0.1:5000
- The app automatically fetches news on startup
- Wait 30-60 seconds for initial data processing
- See market summary and key statistics
- View impact score charts
- Check institution rankings table
- Click "Refresh Data" button for latest news
- Enable "Auto-Refresh" for automatic updates every 5 minutes
- Use the AI chatbot to ask about:
- Specific institutions: "Tell me about JPMorgan"
- Top performers: "Show me the top institutions"
- Sentiment: "Which institutions are positive?"
- India focus: "Which institutions focus on India?"
- Overview: "Give me a summary"
Edit .env file to customize:
# API Configuration
ANTHROPIC_API_KEY=your-key-here
# Server Settings
HOST=127.0.0.1 # Use 0.0.0.0 for network access
PORT=5000
# Refresh Intervals
NEWS_REFRESH_INTERVAL=1800 # 30 minutes (in seconds)
QUICK_REFRESH_INTERVAL=300 # 5 minutes
# Logging
LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERRORfinancial-news-bot/
โโโ backend/
โ โโโ __init__.py
โ โโโ app.py # Main Flask application
โ โโโ config.py # Configuration
โ โโโ database.py # Database operations
โ โโโ news_scraper.py # News fetching
โ โโโ sentiment_analyzer.py # Sentiment analysis
โ โโโ impact_calculator.py # Impact scoring
โโโ frontend/
โ โโโ index.html # Main HTML
โ โโโ css/
โ โ โโโ style.css # Styles
โ โโโ js/
โ โโโ main.js # Main logic
โ โโโ chart.js # Charts
โ โโโ websocket.js # WebSocket
โโโ data/ # Database storage
โโโ logs/ # Log files
โโโ venv/ # Virtual environment
โโโ .env # Environment variables
โโโ .env.example # Environment template
โโโ requirements.txt # Dependencies
โโโ run.py # Entry point
โโโ README.md # readme.md file -- these file
Solution: Make sure you've set your API key in the .env file
Solution:
pip install -r requirements.txtSolution: Change PORT in .env file:
PORT=8000Solution:
# Delete the database and restart
rm data/news_cache.db
python run.pySolution:
import nltk
nltk.download('all')Solution: Change HOST in .env:
HOST=0.0.0.0Then access via: http://YOUR_IP:5000
Get latest news analysis (cached for 5 minutes)
Force refresh news data
Get system status
Send message to AI chatbot
Health check endpoint
- Change SECRET_KEY to a secure random value
- Restrict CORS origins in
app.py - Use HTTPS with proper SSL certificates
- Set DEBUG=False in production
- Use environment variables for all secrets
- Implement rate limiting on API endpoints
- Add authentication for admin features
pip install gunicorn
gunicorn --worker-class eventlet -w 1 --bind 0.0.0.0:5000 backend.app:appCreate Dockerfile:
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "run.py"]Build and run:
docker build -t financial-news-bot .
docker run -p 5000:5000 --env-file .env financial-news-botThis project is for educational purposes.
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
For issues and questions:
- Check the troubleshooting section
- Review logs in
logs/app.log - Check console output for errors
- Add more news sources
- Implement user authentication
- Add historical data visualization
- Email alerts for significant changes
- Mobile app
- Multi-language support
This tool is for informational purposes only. Not financial advice. Always do your own research before making investment decisions.
Made by โค๏ธ Om Kapale