Skip to content

AryanMithbawkar/Stock-Market-Sentiment-Analysis-with-Historical-Stocks-Data-Combined-for-Predicting-Stock-Price-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Stock-Market-Sentiment-Analysis-with-Historical-Stocks-Data-Combined-for-Predicting-Stock-Price-Tool

MarketMind: Stock Market Sentiment Analysis & Price Prediction Platform

Python Flask Firebase License

MarketMind is a comprehensive web application that combines stock market sentiment analysis with historical data to predict stock prices for the Indian market. It leverages machine learning models including LSTM for price prediction and a fine-tuned FinBERT model for news sentiment analysis, providing users with data-driven insights for investment decisions.


πŸŽ₯ Demo Video

MarketMind Demo

Click the image above to watch the full demo or view it directly here.

Quick Demo Features:

  • User authentication and dashboard navigation
  • Real-time market movers tracking
  • Comprehensive fundamental analysis
  • News sentiment analysis with FinBERT
  • Stock price prediction using LSTM
  • Interactive charts and visualizations

πŸš€ Features

πŸ” Authentication & User Management

  • Firebase Authentication: Secure login/registration system
  • User Profiles: Personalized dashboards and preferences
  • Session Management: Secure session handling with Firebase

πŸ“ˆ Market Analysis Tools

  • Market Movers: Track top gainers, losers, and most active stocks
  • Stock Bookmarking: Save and manage favorite stocks
  • Real-time Data: Live stock prices and market updates
  • Historical Analysis: Comprehensive historical data visualization

πŸ“Š Fundamental Analysis

  • Financial Ratios: P/E, P/B, ROE, ROA, and more
  • Peer Comparison: Compare stocks within the same sector
  • Trend Analysis: Historical performance and growth metrics
  • Interactive Charts: Plotly-powered visualizations

πŸ“° News Sentiment Analysis

  • FinBERT Integration: Fine-tuned model for Indian financial news
  • Sentiment Scoring: Positive, negative, and neutral sentiment classification
  • News Aggregation: Latest market news from multiple sources
  • Impact Analysis: Correlation between news sentiment and stock movements

πŸ€– Stock Price Prediction

  • LSTM Models: Deep learning for time series forecasting
  • Multi-factor Analysis: Combines technical indicators with sentiment
  • Prediction Confidence: Model accuracy and confidence intervals
  • Backtesting: Historical prediction performance evaluation

🎨 Modern UI/UX

  • Dark/Light Mode: Toggle between themes
  • Responsive Design: Mobile-first approach
  • Interactive Elements: Smooth animations and transitions
  • Three.js Integration: 3D visualizations and effects

πŸ—οΈ Project Architecture

πŸ“¦ MarketMind/
β”œβ”€β”€ πŸ“„ app.py                    # Main Flask application
β”œβ”€β”€ πŸ“„ requirements.txt          # Python dependencies
β”œβ”€β”€ πŸ“„ Dockerfile              # Docker configuration
β”œβ”€β”€ πŸ“„ README.md               # Project documentation
β”œβ”€β”€ πŸ“ static/
β”‚   β”œβ”€β”€ πŸ“ css/
β”‚   β”‚   β”œβ”€β”€ πŸ“„ style.css       # Main stylesheet
β”‚   β”‚   β”œβ”€β”€ πŸ“„ fundamentals.css
β”‚   β”‚   β”œβ”€β”€ πŸ“„ movers.css
β”‚   β”‚   β”œβ”€β”€ πŸ“„ news.css
β”‚   β”‚   └── πŸ“„ predict.css
β”‚   β”œβ”€β”€ πŸ“ js/
β”‚   β”‚   β”œβ”€β”€ πŸ“„ firebase-config.js    # Firebase configuration
β”‚   β”‚   β”œβ”€β”€ πŸ“„ auth.js              # Authentication logic
β”‚   β”‚   β”œβ”€β”€ πŸ“„ fundamentals.js      # Fundamental analysis
β”‚   β”‚   β”œβ”€β”€ πŸ“„ movers.js           # Market movers functionality
β”‚   β”‚   β”œβ”€β”€ πŸ“„ news.js             # News and sentiment
β”‚   β”‚   β”œβ”€β”€ πŸ“„ predict.js          # Price prediction
β”‚   β”‚   └── πŸ“„ main.js             # Core functionality
β”‚   β”œβ”€β”€ πŸ“ models/
β”‚   β”‚   └── πŸ“ finbert_sentiment089/ # FinBERT model files
β”‚   β”œβ”€β”€ πŸ“ pipelines/           # ML pipeline scripts
β”‚   └── πŸ“ video/              # Demo videos
β”œβ”€β”€ πŸ“ templates/
β”‚   β”œβ”€β”€ πŸ“„ base.html           # Base template
β”‚   β”œβ”€β”€ πŸ“„ home.html           # Homepage
β”‚   β”œβ”€β”€ πŸ“„ login.html          # Authentication
β”‚   β”œβ”€β”€ πŸ“„ movers.html         # Market movers
β”‚   β”œβ”€β”€ πŸ“„ fundamentals.html   # Fundamental analysis
β”‚   β”œβ”€β”€ πŸ“„ news.html           # News sentiment
β”‚   β”œβ”€β”€ πŸ“„ predict.html        # Price prediction
β”‚   β”œβ”€β”€ πŸ“„ privacy.html        # Privacy policy
β”‚   β”œβ”€β”€ πŸ“„ terms.html          # Terms of service
β”‚   β”œβ”€β”€ πŸ“„ disclaimer.html     # Legal disclaimer
β”‚   └── πŸ“„ 404.html           # Error page

πŸ› οΈ Technology Stack

Backend

  • Flask: Web framework
  • Python 3.12+: Core language
  • Firebase Admin SDK: Backend authentication
  • Pandas & NumPy: Data manipulation
  • Scikit-learn: Machine learning utilities
  • TensorFlow/Keras: Deep learning models
  • MongoDB: NoSQL database for news and sentiment data
  • Plotly: Data visualization
  • Docker: Containerization for deployment
  • Gunicorn: WSGI server for production

Frontend

  • HTML5/CSS3: Modern web standards
  • JavaScript ES6+: Interactive functionality
  • Firebase SDK: Client-side authentication
  • Plotly.js: Interactive charts
  • Three.js: 3D visualizations
  • Bootstrap: Responsive design

Machine Learning

  • LSTM Networks: Stock price prediction
  • FinBERT: Financial sentiment analysis
  • Technical Indicators: RSI, MACD, Bollinger Bands
  • Feature Engineering: Combined sentiment-price features

Database & Storage

  • Firebase Firestore: NoSQL database
  • Firebase Storage: File storage
  • Local Storage: Browser caching

πŸ“‹ Prerequisites

  • Python 3.12 or higher
  • Flask 2.0+ for web framework
  • Firebase Project with Authentication and Firestore enabled
  • Git for version control
  • 16GB+ RAM recommended for ML models

πŸš€ Installation & Setup

1. Clone the Repository

git clone https://github.com/AryanMithbawkar/Stock-Market-Sentiment-Analysis-with-Historical-Stocks-Data-Combined-for-Predicting-Stock-Price-Tool.git
cd Stock-Market-Sentiment-Analysis-with-Historical-Stocks-Data-Combined-for-Predicting-Stock-Price-Tool

2. Create Virtual Environment

python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Firebase Configuration

  1. Create a new Firebase project at Firebase Console
  2. Enable Authentication (Email/Password)
  3. Create a Firestore database
  4. Get your Firebase config and update firebase-config.js:
const firebaseConfig = {
  apiKey: "your-api-key",
  authDomain: "your-project.firebaseapp.com",
  projectId: "your-project-id",
  storageBucket: "your-project.appspot.com",
  messagingSenderId: "123456789",
  appId: "your-app-id",
};

5. Download FinBERT Model

  1. Visit Kaggle FinBERT Model
  2. Download the model files
  3. Extract to finbert_sentiment089

6. Run the Application

python app.py

Visit https://huggingface.co/spaces/AronWolverine/MarketMindPto access the application.


🐳 Docker Deployment

Build and Run with Docker

# Build the image
docker build -t marketmind .

# Run the container
docker run -p 5000:5000 marketmind

Docker Compose (Optional)

version: "3.8"
services:
  marketmind:
    build: .
    ports:
      - "5000:5000"
    environment:
      - FLASK_ENV=production

πŸ“– Usage Guide

1. Authentication

  • Register a new account or login with existing credentials
  • Email verification may be required

2. Market Movers

  • View top gainers, losers, and most active stocks
  • Bookmark stocks for quick access
  • Click on any stock for detailed analysis

3. Fundamental Analysis

  • Search for any Indian stock by symbol
  • View comprehensive financial ratios
  • Compare with industry peers
  • Analyze historical trends

4. News Sentiment

  • Read latest market news
  • View sentiment scores for each article
  • Understand market mood and its impact

5. Price Prediction

  • Select a stock and prediction timeframe
  • View LSTM model predictions
  • Analyze prediction confidence
  • Download prediction reports

6. Newsletter Subscription

  • Subscribe to weekly market insights
  • Receive personalized stock recommendations
  • Get notified of major market events

πŸ€– Machine Learning Models

LSTM Price Prediction Model

  • Architecture: 3-layer LSTM with dropout
  • Features: OHLCV data, technical indicators, sentiment scores
  • Training: 80/20 train-test split
  • Evaluation: MAE, RMSE, MAPE metrics

FinBERT Sentiment Analysis

  • Base Model: BERT-base-uncased
  • Fine-tuning: Indian financial news dataset
  • Classes: Positive, Negative, Neutral
  • Accuracy: 89% on test set

πŸ”§ API Endpoints

Authentication

  • POST /auth/login - User login
  • POST /auth/register - User registration
  • POST /auth/logout - User logout

Data APIs

  • GET /api/movers - Market movers data
  • GET /api/fundamentals/<symbol> - Stock fundamentals
  • GET /api/news - Latest news with sentiment
  • POST /api/predict - Stock price prediction

User APIs

  • GET /api/bookmarks - User bookmarks
  • POST /api/bookmark - Add bookmark
  • DELETE /api/bookmark/<symbol> - Remove bookmark

πŸ§ͺ Testing

Run Unit Tests

python -m pytest tests/

Test Coverage

python -m pytest --cov=app tests/

Integration Tests

python -m pytest tests/integration/

πŸš€ Performance Optimization

Model Optimization

  • Model quantization for faster inference
  • Batch processing for multiple predictions
  • Caching for frequently accessed data

Frontend Optimization

  • Lazy loading for charts and images
  • Code splitting for JavaScript modules
  • Service worker for offline functionality

Backend Optimization

  • Redis caching for API responses
  • Database indexing for faster queries
  • Connection pooling for database

πŸ”’ Security Considerations

  • Authentication: Firebase security rules
  • Input Validation: Server-side validation for all inputs
  • Rate Limiting: API rate limiting to prevent abuse
  • HTTPS: SSL/TLS encryption in production
  • CORS: Proper CORS configuration

πŸ“Š Monitoring & Analytics

Application Monitoring

  • Firebase Analytics for user behavior
  • Error tracking with Sentry
  • Performance monitoring with Firebase Performance

Model Monitoring

  • Prediction accuracy tracking
  • Model drift detection
  • A/B testing for model improvements

Development Guidelines

  • Follow PEP 8 style guide
  • Write unit tests for new features
  • Update documentation for API changes
  • Use meaningful commit messages

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


⚠️ Disclaimer

This application is for educational and informational purposes only. It does not constitute financial advice, and users should conduct their own research before making investment decisions. The predictions and analysis provided should not be the sole basis for investment choices.


πŸ“ž Support & Contact


πŸ™ Acknowledgments

  • FinBERT Model: Hugging Face Transformers
  • Stock Data: Yahoo Finance API
  • News Data: Various financial news APIs
  • UI Components: Bootstrap, Plotly, Three.js
  • Hosting: Firebase Hosting

πŸ“ˆ Roadmap

Version 2.0 (Q2 2025)

  • Portfolio management features
  • Real-time alerts and notifications
  • Advanced charting tools
  • Social trading features

Version 2.1 (Q3 2025)

  • Mobile app (React Native)
  • Advanced ML models (Transformer-based)
  • Options and derivatives analysis
  • Backtesting engine

Version 3.0 (Q4 2025)

  • Multi-market support (US, UK markets)
  • Cryptocurrency analysis
  • AI-powered investment advisor
  • Enterprise features

Built with ❀️ by Aryan Mithbawkar & Ritesh Salunkhe

Β© 2025 MarketMind. All rights reserved.

About

AI-powered Indian stock market analysis and prediction tool using LSTM for price forecasting and FinBERT for news sentiment, featuring real-time data, fundamental analysis, and interactive dashboards.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published