Uncover market sentiment by leveraging AI-driven insights from aggregated financial news. This sophisticated web application provides a dynamic dashboard displaying key indicators like a custom Fear & Greed Index, the VIX, and historical trends, all powered by real-time data, intelligent analysis, and proactive VIX alert notifications.
The architecture and user experience have been completely overhauled for stability, aesthetic appeal, and deployment ease.
| Feature Area | Version 3.1 (Old) | Version 4.0 (New) |
|---|---|---|
| VIX Data Retrieval | Single point of failure (yfinance). Prone to silent failures during off-hours or API blocks. |
Multi-Source Fallback System: yfinance -> CNBC API -> Stooq. Uses 5-day lookbacks and standard User-Agents to prevent 403 errors. |
| AI Output Formatting | Raw, unformatted text blocks containing redundant system prompt data. | Rich Markdown Rendering: Uses marked.js for beautiful lists and bold text. Regex automatically strips redundant technical lines from the UI. |
| Alert System | Susceptible to broken imports; disconnected from real-time syncs. | Fully Functional & Synced: Fixed core import errors. Data flow seamlessly syncs between the scraper, JSON cache, and PostgreSQL. |
| User Interface | Basic static theme; visual components required manual refreshes to sync. | Modern & Persistent UI: Dark/Light mode toggle with localStorage persistence. Gauges and charts dynamically update colors on theme switch. |
| Deployment | Manual script execution in virtual environments. | Enterprise Docker Architecture: Single docker-compose up command orchestrates DB, Web (Gunicorn), and Scheduler containers. |
The Market Sentiment Dashboard is designed to offer a consolidated and intelligent view of the prevailing mood in the financial markets. It achieves this by:
- Aggregating: Systematically collecting news articles from a diverse range of reputable financial sources.
- Analyzing: Employing an advanced AI model (Azure DeepSeek deployed via Azure AI Services) to process the aggregated news, generating a unique Fear & Greed Index and a concise sentiment summary.
- Integrating: Fetching the latest VIX (Volatility Index) data to complement the sentiment analysis.
- Persisting: Storing historical sentiment data (Fear & Greed Index, VIX, AI summary, timestamps) within a robust PostgreSQL database for trend analysis.
- Visualizing: Presenting these insights through an intuitive Flask-powered web dashboard, featuring an F&G gauge, VIX display, interactive historical charts, and a recent activity table.
- Notifying: Proactively alerting subscribed users via email when the VIX crosses their predefined thresholds, keeping them informed of significant market volatility changes.
This tool empowers users to quickly gauge market undercurrents, supported by data-driven AI and timely alerts.
- Comprehensive News Aggregation: Gathers financial news from premier RSS feeds (e.g., Yahoo Finance, Investing.com) and the NewsAPI (sourcing from outlets like Bloomberg, Reuters, The Wall Street Journal).
- AI-Driven Sentiment Intelligence: Utilizes Azure AI Services (specifically a deployed DeepSeek model) to:
- Distill a succinct market sentiment summary from complex news data.
- Calculate a proprietary Fear & Greed Index (scaled 1-100).
- Real-time VIX Monitoring: Retrieves the most current VIX index values via
yfinance. - Persistent Historical Data: Archives all analysis results, enabling insightful trend observation and historical review.
- Dynamic & Interactive Dashboard: Offers a rich user experience with:
- A clear visual gauge for the current Fear & Greed Index.
- Line charts illustrating historical Fear & Greed and VIX trajectories.
- A sortable table detailing recent analysis records.
- PDF Export: Allows users to download a snapshot of the current dashboard view.
- Enhanced User Control: Includes 'Run Scraper', 'Run Analyzer', and 'Refresh All Data' buttons directly within the interface for simplified manual operation and data management.
- Proactive VIX Email Alerts:
- Users can subscribe to receive email notifications when the VIX surpasses a custom-defined threshold.
- Alerts include current VIX value, user's threshold, and a timestamp.
- Configurable minimum interval between alerts to prevent spam.
- Modern Web Interface: Developed with Flask, HTML5, CSS3, and JavaScript, incorporating Gauge.js and Chart.js for superior data visualization.
- Automated Data Refresh & Alert Monitoring: Includes a Python-based scheduler (
scheduler_main.py) to automate the data collection, analysis pipeline, and VIX alert checks at configurable intervals.
The application employs a layered architecture for modularity and maintainability:
- Data Ingestion Layer (
webScrape.py): Responsible for fetching raw news data and VIX values from external sources. - AI Analysis & Processing Layer (
analyze_news.py): Handles communication with the Azure AI service, parses AI responses, and prepares data for storage. - Notification Layer (
alert_monitor.py): Monitors VIX values, checks user subscriptions, and dispatches email alerts via SMTP. - Persistence Layer:
- PostgreSQL Database:
sentiment_history: Stores historical sentiment records.vix_alerts_subscriptions: Manages user subscriptions for VIX alerts (email, threshold, last alert timestamp).
- JSON Files: Used for intermediate data storage (
financial_news_agg.json) and caching the latest index values (latest_indices.json) for rapid dashboard loading.
- PostgreSQL Database:
- Presentation Layer (
appFlask.py& Frontend): The Flask application serves the web dashboard, retrieving data from the database, managing VIX alert subscriptions, and presenting it through HTML templates enhanced with CSS and JavaScript. - Scheduling Layer (
scheduler_main.py): Orchestrates the periodic execution of the data ingestion, analysis, and VIX alert monitoring scripts.
- Backend Framework: Python 3.x, Flask
- Frontend Technologies: HTML5, CSS3, JavaScript (ES6+)
- Frontend Visualization Libraries: Gauge.js, Chart.js, html2canvas, jsPDF
- Data Acquisition & Parsing:
feedparser,newsapi-python,yfinance,requests,beautifulsoup4 - Artificial Intelligence: Azure AI Services (via
azure-ai-inferenceSDK for custom deployed models like DeepSeek) - Database System: PostgreSQL
- Database Connector (Python):
psycopg2-binary - Email Notifications:
smtplib(Python's built-in SMTP library) - Task Scheduling (Python):
schedule - Environment Management:
python-dotenv(for managing API keys and secrets) - Version Control System: Git & GitHub
Follow these steps to get the Market Sentiment Dashboard running.
The easiest way to run the application is using Docker. This ensures all databases, web servers, and background schedulers boot up perfectly synced.
- Clone the Repository:
git clone https://github.com/dbogdanm/MarketSentiment cd MarketSentiment - Configure Environment Variables:
Copy the sample environment file and fill in your API keys and SMTP credentials.
cp .env.example .env
- Launch the Application:
The dashboard is now live at
docker-compose up -d
http://localhost:5000.
If you prefer running without Docker:
- Create and Activate a Python Virtual Environment:
python -m venv .venv # Windows: .\.venv\Scripts\activate # macOS/Linux: source .venv/bin/activate
- Install Dependencies:
pip install -r requirements.txt
- Database Configuration:
Ensure PostgreSQL is running locally, create a
market_sentiment_dbdatabase, and execute the SQL table creations found in theschema.sql(or see the old instructions for table schema). - Set
.envvariables (same as Docker setup).
If you are running the app locally (without Docker Compose), you need to start the components manually:
1. Launching the Web Dashboard:
python website/appFlask.py2. Automated Scheduling (Data Pipeline & Alerts): For continuous operation of the fallback APIs, AI analysis, and alert system:
python scheduler_main.py(Note: If using Docker, scheduler_main.py is already running autonomously in its own container).
- API Keys & Credentials (
.env): Primary location for NewsAPI, Azure AI/Ollama endpoints, Postgres credentials, and SMTP settings. - VIX Fallback Logic (
webScrape.py): The logic prioritizingyfinance->CNBC->Stooqcan be adjusted here, along with the 5-day lookback window. - AI Prompting (
analyze_news.py): Modify the system prompts to further tweak how the AI formats its Markdown response. - Scheduling Intervals (
scheduler_main.py): Modifyschedule.every(...).minutesto change scraping and alerting frequencies.
- Advanced Error Handling: Implement comprehensive Python
loggingfor deeper diagnostics across the Docker containers. - User Authentication: Allow users to create accounts to save personal dashboard layouts and track specific assets beyond just VIX alerts.
- Enhanced UI Data Visualization: Introduce date range selectors for historical charts and detailed sector-sentiment heatmaps.
- Asynchronous Data Fetching: Utilize
asyncioandaiohttpinwebScrape.pyto accelerate news aggregation.
- Ensure your virtual environment is activated.
- Navigate to the project root directory.
- Start the Flask development server:
(If
python website/appFlask.py
appFlask.pyis in the root, usepython appFlask.py) - Open your web browser and navigate to
http://127.0.0.1:5000(or the URL displayed in the terminal). The dashboard will allow users to subscribe/unsubscribe to VIX alerts.
We welcome contributions! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix (e.g.,
git checkout -b feature/your-feature-nameorfix/your-bug-fix). - Make your changes and commit them with clear, descriptive messages.
- Push your changes to your forked repository.
- Submit a Pull Request to the main repository, detailing the changes you've made and their purpose.
Copyright (c) 2026 DINU BOGDAN
This project is licensed under the MIT License.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project Maintainer: Dinu Bogdan-Marius
Email: bogdandinu625@gmail.com
GitHub: dbogdanm
For issues, feature requests, or support, please open an issue on the GitHub repository.