Skip to content

Stockify is a comprehensive AI-powered stock market intelligence platform that combines advanced machine learning, natural language processing, and document analysis for the complete investment research, by ensuring privacy as a core principle.

Notifications You must be signed in to change notification settings

Preveen369/Stock-Price-Prediction

Repository files navigation

πŸš€ Stockify - AI-Powered Stock Market Intelligence Platform

Python Web-UI Framework Deep-Learning Machine-Learning LLM Vector-DB Data-Source Notebook License

Stockify is a comprehensive AI-powered stock market intelligence platform that combines advanced machine learning, natural language processing, and document analysis for complete investment research. Built with privacy as a core principle, it leverages:

  • 🧠 LSTM Neural Networks for accurate 50/100/200-day price predictions
  • πŸ€– Local LLM Integration via LM Studio for on-device AI processing
  • πŸ“š RAG Technology for intelligent document analysis and Q&A
  • πŸ“Š Technical Analysis Tools for in-depth market insights

Whether you're analyzing US stocks (NASDAQ) or Indian markets (NSE), Stockify provides AI-powered recommendations, real-time data visualization, and document-based research capabilitiesβ€”all while keeping your data completely private on your local machine.


✨ Features & Pages

1. 🏠 Main Dashboard - Stock Price Predictions

Core Features:

  • βœ… LSTM Price Predictions - 50/100/200-day forecasts trained on 2012-2022 market data
  • βœ… Real-time Stock Data - Live market data with dynamic date fetching using Yahoo Finance (up to current date)
  • βœ… Historical Charts - Interactive price visualization and trend analysis
  • βœ… AI Market Insights - Automated analysis of stock performance

2. πŸ“„ Financial Report Analysis - RAG-Powered Q&A

AI RAG Features:

  • βœ… Document Q&A - Ask questions about financial PDFs in natural language
  • βœ… Source Citations - Answers grounded in actual document content
  • βœ… Local LLM Processing - Privacy-first AI analysis (no data leaves your machine)
  • βœ… Vector Embeddings - FAISS-powered semantic search for accurate retrieval

3. πŸ“ˆ Investment Summary - AI Recommendations

Investment Features:

  • βœ… BUY/HOLD/SELL Signals - Intelligent recommendations with reasoning
  • βœ… Risk Assessment - Comprehensive risk analysis and evaluation
  • βœ… Entry/Exit Points - Strategic price targets for trading
  • βœ… Streaming Responses - Real-time AI response generation

4. πŸ“‹ Stock Tickers List - Market Browse

Data Features:

  • βœ… Multi-Market Support - 1000+ NASDAQ and 1000+ NSE stocks
  • βœ… Search & Filter - Easy stock discovery and selection
  • βœ… Comprehensive Listings - Full stock metadata and information

5. πŸ“Š Technical Analysis - Indicators & Trends

Technical Features:

  • βœ… Moving Averages - 50-day, 100-day and 200-day MA calculations
  • βœ… Volatility Analysis - Price fluctuation and risk metrics
  • βœ… Trend Detection - Automated pattern recognition
  • βœ… AI Interpretation - Natural language explanations of technical data

πŸ—οΈ Architecture

Streamlit UI β†’ Services (LocalLLM, Embeddings, RAG) β†’ Utils (Stock LSTM, PDF)

Tech Stack: Streamlit β€’ Python β€’ TensorFlow/Keras β€’ LangChain β€’ FAISS β€’ LM Studio β€’ yfinance β€’ PyPDF2 β€’ Pandas β€’ NumPy β€’ Google Colab


πŸ’» Installation

Prerequisites: Python 3.8+, Google Colab, LM Studio, 8GB+ RAM

# Clone and setup
git clone https://github.com/Preveen369/Stock-Price-Prediction.git
cd Stock-Price-Prediction
python -m venv venv
venv\Scripts\activate  # Windows 

# Install dependencies
pip install -r requirements.txt
pip install -r rag_requirements.txt

# Setup LM Studio (lmstudio.ai)
# Load models: gemma-3-4b + text-embedding-nomic-embed-text-v1.5
# Start server: http://localhost:1234

# Run application
streamlit run app.py  # Opens at http://localhost:8501

βš™οΈ Configuration

  • Environment (.env): LM_STUDIO_URL, LM_STUDIO_MAX_TOKENS, LM_STUDIO_TEMPERATURE, LM_STUDIO_TIMEOUT

  • LM Studio: Load gemma-3-4b (chat) + nomic-embed-text-v1.5 (embeddings) β†’ Start server at http://localhost:1234

  • Settings: See config/llm_config.py for defaults (max_tokens: 2048, temperature: 0.3)


🚦 Usage

Quick Start Guide

# 1. Ensure LM Studio is running with models loaded
# 2. Start Stockify
streamlit run app.py

# 3. Open browser at http://localhost:8501

Workflow Examples

  • Analyze Stock: Main Dashboard β†’ Enter Symbol (AAPL) β†’ View Charts & Predictions
  • NASDAQ | NSE Stock Symbols: US (AAPL, TSLA) | India (INFY.NS, TCS.NS)
  • Technical Analysis: Technical Analysis Page β†’ View Moving Averages & Trends
  • Investment Advice: Investment Summary β†’ Risk Assessment β†’ AI Recommendations
  • Document Q&A: Financial Report β†’ Upload PDF β†’ Ask Questions β†’ Get Answers

πŸ“š API Documentation

For detailed API documentation, see API_DOCUMENTATION.md

Key Modules

Services

Core services layer that handles AI/ML operations and external integrations.

  • LocalLLMService - LM Studio integration for AI analysis
  • LMStudioEmbeddings - Text embedding generation
  • RAGPipeline - Retrieval-augmented generation pipeline

Utilities

Helper functions for data processing, calculations, and file operations.

  • stock_utils.py - Stock data fetching and analysis
  • pdf_utils.py - PDF processing and chunking

πŸ“ Project Structure

Stock-Price-Prediction/
β”œβ”€β”€ πŸ“„ app.py                            # Main dashboard application
β”œβ”€β”€ πŸ“ pages/                        # Streamlit pages
β”‚   β”œβ”€β”€ πŸ“„ Financial_Report_Analysis.py  # RAG-based PDF analysis
β”‚   β”œβ”€β”€ πŸ“„ Investment_Summary.py         # AI investment recommendations
β”‚   β”œβ”€β”€ πŸ“„ Stock_Tickers_List.py         # Browse stock symbols
β”‚   └── πŸ“„ Technical_Analysis.py         # Technical indicators analysis
β”œβ”€β”€ πŸ“ services/                     # Core services layer
β”‚   β”œβ”€β”€ πŸ“„ local_llm_service.py          # LM Studio integration
β”‚   β”œβ”€β”€ πŸ“„ embeddings_service.py         # Vector embedding generation
β”‚   └── πŸ“„ rag_pipeline.py               # RAG implementation
β”œβ”€β”€ πŸ“ utils/                        # Utility functions
β”‚   β”œβ”€β”€ πŸ“„ stock_utils.py                # Stock data and metrics
β”‚   └── πŸ“„ pdf_utils.py                  # PDF processing utilities
β”œβ”€β”€ πŸ“ config/                       # Configuration
β”‚   └── πŸ“„ llm_config.py                 # LLM settings and env vars
β”œβ”€β”€ πŸ“ models/                       # Pre-trained models
β”‚   └── πŸ“„Stock Predictions Model.keras  # LSTM neural network
β”œβ”€β”€ πŸ“ resources/                    # Static resources
β”‚   β”œβ”€β”€ πŸ“„ NASDAQ_Active_Stocks_List.csv # US stock listings
β”‚   └── πŸ“„ NSE_Active_Stocks_List.csv    # Indian stock listings
β”œβ”€β”€ πŸ“„ requirements.txt                  # Core dependencies
β”œβ”€β”€ πŸ“„ stock_market_prediction.ipynb     # LSTM model training notebook
β”œβ”€β”€ πŸ“„ stocks_list_extraction.ipynb      # Stock tickers extraction notebook
β”œβ”€β”€ πŸ“„ API_DOCUMENTATION.md              # Complete API reference
└── πŸ“„ README.md                         # This file

Module Responsibilities

Module Responsibility
app.py Main dashboard, stock selection, LSTM predictions
services/ LLM integration, embeddings, RAG pipeline
utils/ Stock data fetching, calculations, PDF processing
pages/ Individual analysis pages (UI components)
config/ Environment variables, LLM configuration
models/ Pre-trained LSTM model for predictions

🧠 Key Concepts Explained

1. LSTM (Long Short-Term Memory)

  • What: Neural network architecture for time-series prediction
  • How: Uses 100 days of historical prices to predict next 50/100/200 days
  • Framework: Built with TensorFlow/Keras for deep learning
  • Preprocessing: Scikit-learn for data scaling and normalization
  • Accuracy: Typically achieves 75-90% accuracy on test data
  • Training: Pre-trained on 2012-2022 historical data across thousands of stock patterns

2. RAG (Retrieval-Augmented Generation)

  Document β†’ Chunks β†’ Embeddings β†’ Vector Store
                                        ↓
         Question β†’ Embedding β†’ Similarity Search β†’ Retrieved Chunks
                                        ↓
                        Chunks + Question β†’ LLM β†’ Answer
  • Benefit: Accurate answers grounded in document content
  • Advantage: No hallucinations, includes source citations

3. Vector Embeddings

  • What: Numerical representations of text (384 dimensions)
  • Purpose: Enable semantic similarity search
  • Model: Nomic Embed Text v1.5
  • Use Case: Finding relevant document sections for RAG

4. Local LLM Processing

  • Privacy: All AI processing happens on your machine
  • Speed: Depends on your hardware (GPU recommended)
  • Models: Gemma 3, Mistral, Llama, etc.
  • Benefits: No API costs, full control, offline capable

πŸ”§ Key Technologies

  • LSTM: 100-day history β†’ 50/100/200-day predictions (75-90% accuracy)
  • RAG: Document chunks + embeddings + vector search β†’ cited answers
  • Embeddings: 384D vectors (Nomic v1.5)
  • Local LLM: Privacy-first AI (Gemma/Mistral/Llama)

πŸ› οΈ Troubleshooting

Common Issues and Solutions

❌ LM Studio Not Connected

Symptoms: "LM Studio Not Connected" error in sidebar,

Solutions:

  1. Verify LM Studio is running
  2. Check server URL is http://127.0.0.1:1234

❌ Slow Performance

Symptoms: Long processing times, lag

Solutions:

  1. Use smaller chunk sizes for PDFs (500 instead of 1000)
  2. Reduce top_k in RAG queries (3 instead of 4)
  3. Use lighter LLM models (4B instead of 7B)
  4. Close other applications
  5. Enable GPU acceleration in LM Studio

❌ Memory Errors

Symptoms: Out of memory, crashes

Solutions:

  1. Use quantized models (Q4 or Q5)
  2. Reduce max_tokens in config (1024 instead of 2048)

🀝 Contributing

Pull requests are welcome! Feel free to fork the repository and suggest improvements.

Steps to contribute:

# 1. Fork the repository
# 2. Create a feature branch
git checkout -b feature-name
# 3. Commit your changes
git commit -m "Add feature description"
# 4. Push to GitHub
git push origin feature-name
# 5. Open a Pull Request

πŸ“„ License

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


⚠️ Disclaimer

For educational purposes only. NOT financial advice. Past performance β‰  future results. AI predictions may be inaccurate. Consult qualified advisors. Use at your own risk. No warranties or liability.


πŸ“§ Contact

For queries or suggestions:


🌟 Show Your Support

If you like this project, please consider giving it a ⭐ on GitHub!


Built with ❀️ using DL/ML LSTM + Local AI LLMs + RAG

About

Stockify is a comprehensive AI-powered stock market intelligence platform that combines advanced machine learning, natural language processing, and document analysis for the complete investment research, by ensuring privacy as a core principle.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published