A comprehensive stock market analysis and notification system that provides real-time stock data, technical analysis, sentiment analysis, and trading recommendations.
- Real-time Stock Data: Fetch live stock data from Yahoo Finance
- Technical Analysis: Calculate RSI, MACD, moving averages, and other technical indicators
- Sentiment Analysis: Analyze news sentiment for stocks
- ML Predictions: Generate price predictions using multiple models (SARIMA, Prophet, GARCH)
- Trading Recommendations: AI-powered buy/sell/hold recommendations
- Web Dashboard: Beautiful Flask web interface
- Risk Metrics: Value at Risk (VaR), volatility analysis
- Market Regime Detection: Identify market conditions using clustering
- Python 3.8 or higher
- pip package manager
- Internet connection for stock data
-
Clone or download the project
cd "stock notify"
-
Install dependencies
pip install -r requirements.txt
-
Optional: Install additional packages for enhanced functionality
# For advanced ML features pip install prophet arch ruptures lightgbm xgboost shap # For additional data sources pip install alpha-vantage fredapi # For news sentiment pip install newsapi-python feedparser
Create a .env
file in the project root for API keys:
# News API for sentiment analysis
NEWS_API_KEY=your_news_api_key
# Alpha Vantage for additional market data
ALPHA_VANTAGE_API_KEY=your_alpha_vantage_key
# FRED API for macroeconomic data
FRED_API_KEY=your_fred_api_key
# Flask secret key
SECRET_KEY=your_secret_key
- News API: Get free API key from newsapi.org
- Alpha Vantage: Get free API key from alphavantage.co
- FRED API: Get free API key from fred.stlouisfed.org
-
Run the application
python app.py
-
Open your browser Navigate to
http://localhost:5000
-
View the dashboard
- See stock opportunities
- View technical analysis
- Check sentiment scores
- Get trading recommendations
Run the test suite to verify everything works:
python test_app.py
# Test specific functionality
python -c "from app import app; print('App loaded successfully')"
# Run with debug mode
python app.py
- Buy Opportunities: Stocks with strong buy signals
- Sell Signals: Stocks to consider selling
- Hold Recommendations: Stocks to maintain positions
- Top Gainers/Losers: Best and worst performing stocks
- Market Sentiment: Overall market sentiment score
- Prediction Accuracy: ML model performance metrics
GET /
: Main dashboardGET /api/stock/<symbol>
: Detailed analysis for specific stock
stock notify/
βββ app.py # Main Flask application
βββ requirements.txt # Python dependencies
βββ test_app.py # Test suite
βββ README.md # This file
βββ data_ingestion/ # Data fetching modules
β βββ market_data.py # Stock data fetcher
β βββ news_sentiment.py # News and sentiment analysis
βββ analysis/ # Analysis modules
β βββ market_analysis.py # Technical analysis
β βββ recommendation.py # ML recommendations
βββ templates/ # HTML templates
β βββ index.html # Main dashboard
β βββ opportunities.html # Opportunities page
β βββ ... # Other pages
βββ static/ # Static files
βββ style.css # CSS styles
- Fetches stock data from Yahoo Finance
- Collects news articles and sentiment
- Handles multiple data sources with fallbacks
- Calculates technical indicators (RSI, MACD, SMA)
- Generates price predictions using ML models
- Computes risk metrics (VaR, volatility)
- Analyzes news sentiment using TextBlob
- Processes RSS feeds for additional news
- Calculates overall sentiment scores
- Combines technical, sentiment, and ML signals
- Generates buy/sell/hold recommendations
- Provides confidence scores and reasoning
The application is designed to be robust:
- Graceful degradation: Works even if some dependencies are missing
- Fallback mechanisms: Uses alternative data sources when primary fails
- Comprehensive logging: Detailed error messages for debugging
- Data validation: Checks for empty or invalid data
-
Import Errors
pip install -r requirements.txt
-
No Stock Data
- Check internet connection
- Verify stock symbols are correct
- Try different stock symbols
-
Missing Dependencies
- Install optional packages for enhanced features
- Application works with basic dependencies
-
API Rate Limits
- Some APIs have rate limits
- Application uses caching to minimize API calls
Run with debug mode for detailed error messages:
python app.py
The application tracks these Indian stocks by default:
- RELIANCE.NS, TCS.NS, HDFCBANK.NS, INFY.NS, ICICIBANK.NS
- HINDUNILVR.NS, HDFC.NS, SBIN.NS, BAJFINANCE.NS, BHARTIARTL.NS
You can modify the STOCK_LIST
in app.py
to track different stocks.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is open source and available under the MIT License.
This application is for educational and informational purposes only. It does not constitute financial advice. Always do your own research and consult with financial professionals before making investment decisions.
If you encounter any issues:
- Check the troubleshooting section above
- Run the test suite:
python test_app.py
- Check the logs for error messages
- Verify all dependencies are installed
Happy Trading! π