Skip to content

About

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

StockPulse AI

Intelligent stock market analysis combining Deep Learning (LSTM) with Large Language Models (LLM) for data-driven investment decisions.

Build Status License Python React

🚀 Overview

StockPulse AI is a full-stack AI application that leverages cutting-edge machine learning and natural language processing to provide comprehensive stock analysis. By combining:

  • LSTM Neural Networks for temporal trend forecasting and pattern recognition
  • Large Language Models (Google Gemini) for sentiment analysis and contextual interpretation
  • Financial Data APIs for real-time market data and historical trends
  • Modern Web UI built with React for interactive data visualization

The system generates actionable investment insights with reduced human bias and faster decision-making capabilities.

✨ Key Features

🤖 Intelligent Analysis Engine

  • Dual-Model Approach: LSTM for quantitative analysis + LLM for qualitative insights
  • Real-Time Processing: Analyzes 60+ days of historical data instantly
  • Multi-Metric Evaluation: Price trends, momentum, peer comparison, valuation metrics

📊 Comprehensive Metrics

  • Alpha Score: Proprietary investment potential gauge (-100 to +100)
  • Recommendation: Buy/Hold/Sell signals with confidence levels
  • Peer Analysis: Relative valuation against industry competitors
  • Risk Assessment: Volatility metrics and trend reliability

🎨 Professional UI/UX

  • Light Minimalistic Design: Clean, accessible interface
  • Real-Time Feedback: Elegant loading states and instant results
  • Responsive Layout: Works seamlessly on desktop and mobile
  • Data Visualization: Interactive charts and intuitive displays

🔌 Seamless Integration

  • RESTful API: Query any stock ticker by company name or symbol
  • Error Handling: Graceful fallbacks and helpful error messages
  • Environment Configuration: Easy setup with environment variables

🏗️ Architecture

StockPulse AI
├── Backend (Python)
│   ├── LSTM Model Training & Inference
│   ├── LLM Integration (Google Gemini API)
│   ├── Financial Data Processing
│   ├── REST API Endpoints
│   └── Database Management
│
└── Frontend (React + Vite)
    ├── Modern UI Components
    ├── Real-time Search
    ├── Interactive Dashboard
    ├── Data Visualization
    └── Responsive Design

💻 Tech Stack

Backend

  • Python 3.8+ - Core language
  • TensorFlow/Keras - LSTM model implementation
  • Google Gemini API - LLM sentiment analysis
  • Flask/FastAPI - REST API framework
  • Pandas/NumPy - Data processing
  • yfinance - Stock market data

Frontend

  • React 18 - UI framework
  • Vite - Build tool (optimized performance)
  • Framer Motion - Smooth animations
  • Recharts - Data visualization
  • Lucide React - Professional icons
  • Axios - API communication

Deployment

  • Vercel - Frontend hosting
  • Cloud Platform - Backend deployment

📦 Installation

Prerequisites

  • Python 3.8 or higher
  • Node.js 16 or higher
  • npm or yarn package manager

Backend Setup

# Navigate to backend directory
cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Set environment variables
cp .env.example .env
# Edit .env with your configuration:
# - GEMINI_API_KEY=your_gemini_api_key
# - STOCK_DATA_API_KEY=your_api_key

# Run the server
python app.py

Frontend Setup

# Navigate to frontend directory
cd frontend

# Install dependencies
npm install

# Create environment file
cp .env.example .env
# Edit .env with your API URLs:
# VITE_API_URL=http://localhost:5000/api

# Start development server
npm run dev

# Build for production
npm run build

🎯 Usage

Via Web Application

  1. Open the Application

  2. Search for a Stock

    • Enter company name (e.g., "Apple", "Microsoft", "Tesla")
    • Or use stock ticker symbol (e.g., "AAPL", "MSFT", "TSLA")
  3. View Analysis

    • Alpha Score: Investment potential metric
    • Recommendation: Buy/Hold/Sell signal
    • Key Metrics: Price trends, momentum, valuation
    • Peer Comparison: Relative performance vs competitors
    • Insights: AI-generated analysis and context

Via API

# Analyze a stock
curl -X POST http://localhost:5000/api/analyze \
  -H "Content-Type: application/json" \
  -d '{"company_name": "Apple"}'

# Response includes:
# {
#   "ticker": "AAPL",
#   "alpha_score": 45,
#   "recommendation": "BUY",
#   "confidence": 0.87,
#   "metrics": {...},
#   "insights": "..."
# }

📈 How It Works

Data Flow

  1. Stock Ticker Lookup

    • User enters company name → System retrieves stock ticker
    • NSE/Stock exchange name resolution
  2. Historical Data Retrieval

    • Fetch 60+ days of OHLCV (Open, High, Low, Close, Volume) data
    • Calculate technical indicators (SMA, EMA, RSI, MACD)
  3. LSTM Analysis

    • Trained model predicts price trends
    • Identifies momentum and reversal patterns
    • Generates quantitative scores
  4. LLM Analysis

    • Recent news and financial headlines
    • Sentiment analysis (positive/negative/neutral)
    • Contextual interpretation of market events
    • Peer company comparison
  5. Synthesis & Recommendation

    • Combines LSTM predictions with LLM insights
    • Generates Alpha Score (-100 to +100)
    • Produces Buy/Hold/Sell recommendation
    • Provides detailed analysis report

🎨 Recent UI/UX Improvements

Latest Enhancements (2026-04-30)

  • ✅ Light Minimalistic Theme: Professional white background with blue accents (#2563eb)
  • ✅ Enhanced Loading States: Elegant spinner with smooth cubic-bezier animation
  • ✅ Improved Components: Polished cards with subtle shadows and hover effects
  • ✅ Better Typography: Optimized hierarchy using clamp() for responsive sizing
  • ✅ Mobile Responsive: Perfected all breakpoints for mobile, tablet, and desktop
  • ✅ Smooth Animations: Professional transitions with consistent timing
  • ✅ Accessibility: Better color contrast and semantic structure
  • ✅ Design System: Comprehensive CSS variables for consistency

🔐 Security & Best Practices

  • ✅ Environment variables for sensitive credentials
  • ✅ Input validation and sanitization
  • ✅ Error handling without exposing system details
  • ✅ CORS configuration for API requests
  • ✅ Rate limiting on API endpoints
  • ✅ Secure API key management

📊 Performance Metrics

  • Frontend Build: 384KB (gzipped: 124KB)
  • API Response Time: <2 seconds for analysis
  • LSTM Inference: <1 second per prediction
  • LLM Processing: <3 seconds for content generation
  • Total Analysis Time: <5 seconds end-to-end

🧪 Testing

# Run backend tests
cd backend
pytest tests/

# Run frontend tests
cd frontend
npm run test

# Build frontend
npm run build

# Check production build
npm run preview

📚 Project Structure

stockpulse/
├── backend/
│   ├── models/           # LSTM and preprocessing modules
│   ├── api/              # REST API endpoints
│   ├── data/             # Historical data and cache
│   ├── config/           # Configuration files
│   ├── requirements.txt   # Python dependencies
│   └── app.py            # Main Flask/FastAPI application
│
├── frontend/
│   ├── src/
│   │   ├── components/   # React components
│   │   ├── assets/       # Images and icons
│   │   ├── index.css     # Global styles (light theme)
│   │   ├── App.jsx       # Main application
│   │   └── main.jsx      # Entry point
│   ├── package.json      # npm dependencies
│   └── vite.config.js    # Vite configuration
│
└── README.md             # This file

🚀 Deployment

Frontend (Vercel)

# Install Vercel CLI
npm install -g vercel

# Deploy from frontend directory
cd frontend
vercel

# Set environment variables in Vercel dashboard
# - VITE_API_URL=your_backend_url

Backend (Cloud Platform)

Option 1: Google Cloud Run

# Build and deploy
gcloud run deploy stockpulse \
  --source . \
  --platform managed \
  --region us-central1

Option 2: Heroku

# Deploy to Heroku
heroku login
heroku create stockpulse-api
git push heroku main

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License.

👤 Author

Hemang Singh Sengar

🙏 Acknowledgments

  • Google Gemini API for LLM capabilities
  • TensorFlow/Keras for deep learning framework
  • React & Vite for modern web development
  • Financial Data APIs for market data access

📞 Support

For questions, issues, or suggestions:

  1. Issues: Open an issue on GitHub
  2. Discussions: Start a discussion for feature ideas
  3. Email: hemang.sengar@gmail.com
  4. Documentation: Check the docs folder

📊 Roadmap

  • Real-time portfolio tracking
  • Custom watchlists
  • Advanced charting with TradingView
  • Backtesting engine
  • Mobile app (React Native)
  • Enterprise API tier
  • Machine learning model improvements
  • Extended market coverage (Crypto, Forex)

Last Updated: April 30, 2026

Made with ❤️ by Hemang Singh Sengar

About

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages