Skip to content

A comprehensive AI-powered web application for stock market analysis, technical screening, and price prediction with optimized dependencies

Notifications You must be signed in to change notification settings

HARSHGUPTA10123/stock-market-prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Here's your updated README.md file with comprehensive installation instructions based on our setup journey:

# πŸ“ˆ Stock Market Prediction & Analysis Platform

A comprehensive, AI-powered web application for stock market analysis, technical screening, and price prediction. Built specifically for the National Stock Exchange (NSE) of India, this platform provides retail investors with professional-grade tools for data-driven decision making.

## ✨ Features

### πŸ” Fundamental Analysis
- **Company Profiles**: Detailed corporate information and business overview
- **Historical Data**: 10+ years of OHLC (Open, High, Low, Close) data with interactive charts
- **Financial Metrics**: Key performance indicators and financial ratios
- **Data Export**: Download historical prices in CSV and Excel formats

### πŸ“Š Technical Analysis
- **11+ Technical Indicators**:
  - Moving Averages (SMA, EMA)
  - Relative Strength Index (RSI)
  - Moving Average Convergence Divergence (MACD)
  - Bollinger Bands
  - Stochastic Oscillator
  - Average True Range (ATR)
  - Williams %R
  - And more...

### 🎯 Technical Screener
- **Breakout Detection**: Identify stocks breaking out of consolidation patterns
- **Multi-Parameter Filtering**: Screen based on volume, price movements, and technical levels
- **Sector Analysis**: Compare stocks within the same industry
- **Custom Alerts**: Personalized screening criteria

### πŸ” Pattern Recognition
- **60+ Candlestick Patterns**:
  - Bullish Patterns: Hammer, Bullish Engulfing, Morning Star
  - Bearish Patterns: Shooting Star, Bearish Engulfing, Evening Star
  - Continuation Patterns: Flags, Pennants, Triangles
- **Real-time Scanning**: Automated pattern detection across all NSE stocks
- **Confidence Scoring**: Probability assessment with historical accuracy

### πŸ€– AI Price Forecasting
- **LSTM Neural Network**: Advanced deep learning model for time-series prediction
- **Next-Day Prediction**: Forecasts tomorrow's closing price
- **60-Day Lookback**: Analyzes past 60 days of market data
- **Proven Accuracy**: Lowest RMSE among tested models

## πŸ›  Tech Stack

### Backend & Machine Learning
- **Python 3.9+**: Core programming language
- **TensorFlow/Keras**: Deep learning framework for LSTM model
- **Scikit-learn**: Traditional machine learning algorithms
- **Pandas & NumPy**: Data manipulation and numerical computing

### Data & Analysis
- **yFinance**: Real-time and historical stock data
- **TA-Lib**: Technical analysis library
- **FinTA**: Financial technical analysis indicators
- **Plotly**: Interactive data visualization

### Frontend & Deployment
- **Streamlit**: Web application framework
- **Custom CSS**: Responsive and modern UI design
- **Plotly Charts**: Interactive and dynamic visualizations

## πŸš€ Installation & Setup

### Prerequisites
- Python 3.9 or higher
- pip (Python package manager)
- Windows/Linux/macOS

### ⚑ Quick Installation (Recommended)

1. **Clone the Repository**
   ```bash
   git clone https://github.com/HARSHGUPTA10123/stock-market-prediction.git
   cd stock-market-prediction
  1. Create Virtual Environment

    # Windows
    python -m venv stock_env
    stock_env\Scripts\activate
    
    # Linux/macOS
    python -m venv stock_env
    source stock_env/bin/activate
  2. Install Dependencies (One Command)

    pip install --upgrade pip
    pip install -r requirements.txt
  3. Run the Application

    streamlit run webapp.py
  4. Access the Application

    • Open your web browser
    • Navigate to http://localhost:8501
    • Start analyzing stocks!

πŸ”§ Detailed Installation Guide

If you encounter any issues during installation, follow these steps:

Step 1: Environment Setup

# Create and activate virtual environment
python -m venv stock_env

# Windows PowerShell
stock_env\Scripts\Activate.ps1

# Windows Command Prompt
stock_env\Scripts\activate

# Linux/macOS
source stock_env/bin/activate

Step 2: Install Dependencies

# Upgrade pip first
python -m pip install --upgrade pip

# Install all packages from requirements.txt
pip install -r requirements.txt

Step 3: Verify Installation

# Test if all packages are installed correctly
python -c "
import pandas as pd
import numpy as np
import yfinance as yf
import tensorflow as tf
import sklearn
import ta
print('βœ… All packages installed successfully!')
print(f'pandas: {pd.__version__}')
print(f'numpy: {np.__version__}')
print(f'tensorflow: {tf.__version__}')
"

πŸ› Troubleshooting Common Installation Issues

Issue 1: TA-Lib Installation Problems

Solution for Windows:

# If TA-Lib fails to install, download pre-compiled wheel:
pip install TA_Lib-0.6.7-cp311-cp311-win_amd64.whl

Issue 2: TensorFlow Compatibility

Solution:

# If numpy conflicts occur, reinstall compatible version:
pip install "numpy<1.24" --force-reinstall

Issue 3: Memory Issues

  • Close other applications during installation
  • Use --no-cache-dir flag:
pip install -r requirements.txt --no-cache-dir

Issue 4: Permission Errors (Windows)

Run PowerShell as Administrator and execute:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

πŸ“‹ Requirements Overview

The requirements.txt file includes optimized versions of:

  • Core Data Science: numpy, pandas, scipy, scikit-learn
  • Deep Learning: TensorFlow, Keras (compatible versions)
  • Financial Analysis: yfinance, TA-Lib, ta, finta
  • Visualization: matplotlib, plotly, altair
  • Web Framework: streamlit, streamlit-aggrid
  • Development: jupyter, ipython, notebook

πŸ“ˆ Model Performance

Our LSTM model outperformed traditional machine learning approaches:

Model Large-Cap (TCS) Mid-Cap (Tata Motors) Small-Cap (Trident)
Moving Average 971.40 234.64 23.10
K-Nearest Neighbors 1174.90 232.54 23.02
Linear Regression 680.51 400.30 24.51
LSTM (Our Model) 117.49 24.47 2.88

Lower RMSE values indicate better prediction accuracy

πŸ’‘ Usage Guide

Getting Started

  1. Launch the application using streamlit run webapp.py
  2. Select a stock from 1,770+ NSE listed companies
  3. Choose analysis period (default: 1 year historical data)
  4. Click "Analyze Stock" to load data and generate insights

Feature Navigation

  • Home: Overview and stock selection
  • Fundamental Analysis: Company data and financials
  • Technical Indicators: Chart-based technical analysis
  • Pattern Recognition: Candlestick pattern detection
  • Next-Day Forecasting: AI-powered price predictions

πŸ“ Project Structure

stock-market-prediction/
β”‚
β”œβ”€β”€ webapp.py                 # Main application entry point
β”œβ”€β”€ requirements.txt          # Python dependencies (optimized)
β”œβ”€β”€ symbols.csv              # NSE stock symbols database
β”‚
β”œβ”€β”€ pages/                   # Streamlit multi-page modules
β”‚   β”œβ”€β”€ 01_Fundamental_Analysis.py
β”‚   β”œβ”€β”€ 02_Technical_Indicators.py
β”‚   β”œβ”€β”€ 03_Pattern_Recognition.py
β”‚   β”œβ”€β”€ 04_Technical_Screener.py
β”‚   └── 05_Next-Day_Forecasting.py
β”‚
β”œβ”€β”€ functions.py             # Utility functions and helpers
β”œβ”€β”€ patterns.py              # Candlestick pattern definitions
β”‚
└── media/                   # Images and documentation assets
    β”œβ”€β”€ model_performance/
    └── screenshots/

πŸ”§ Configuration

Stock Data Source

  • Primary: Yahoo Finance API
  • Coverage: 1,770+ NSE listed companies
  • Historical Data: 10+ years of daily OHLC prices
  • Update Frequency: Real-time during market hours

Model Settings

  • Training Period: 5 years of historical data
  • Lookback Window: 60 days for prediction
  • Update Schedule: Model retrained periodically
  • Confidence Intervals: Provided with all predictions

πŸ†• Updates & Version Information

Current Version Features

  • βœ… Optimized dependency management - No version conflicts
  • βœ… TensorFlow 2.12.0 - Compatible with Python 3.11+
  • βœ… One-command installation - All packages install seamlessly
  • βœ… Comprehensive error handling - Better user experience

Installation Notes

  • The current requirements.txt has been thoroughly tested and resolves all dependency conflicts
  • Uses numpy 1.23.5 for TensorFlow compatibility
  • Includes all essential packages for stock market analysis
  • Removed problematic packages that caused installation issues

πŸš€ Future Enhancements

  • Real-time intraday data integration
  • Additional timeframe analysis (weekly, monthly)
  • Portfolio management features
  • Social sentiment analysis
  • Options chain analysis
  • Backtesting framework
  • Mobile application version

πŸ“Š Data Sources & Disclaimer

Data Providers

  • Primary: Yahoo Finance API
  • Exchange: National Stock Exchange (NSE) India
  • Coverage: All NSE equity segments

Important Disclaimer

⚠️ This application is for educational and research purposes only. Stock market investments are subject to market risks. The AI predictions and technical analysis should not be considered as financial advice. Always consult with qualified financial advisors before making investment decisions.

πŸ‘¨β€πŸ’» Developer

Harsh Gupta


🎯 Ready to transform your trading strategy? Clone the repository and start analyzing today! The installation process has been optimized for a seamless setup experience. πŸš€

Need Help?

If you encounter any issues during installation:

  1. Check the troubleshooting section above
  2. Ensure you're using Python 3.9+
  3. Verify your virtual environment is activated
  4. Contact via GitHub issues for support

Happy Analyzing! πŸ“ŠπŸ€–


## Key Improvements in this README:

1. **Clear Installation Steps** - Both quick and detailed options
2. **Troubleshooting Section** - Based on our actual installation journey
3. **Optimized Requirements** - Highlights the battle-tested dependency versions
4. **Verification Steps** - Commands to test the installation
5. **Common Issues Solved** - TA-Lib, TensorFlow compatibility, etc.
6. **Updated Information** - Reflects the optimized setup we achieved

About

A comprehensive AI-powered web application for stock market analysis, technical screening, and price prediction with optimized dependencies

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages