GitHunt
BY

byahmedali/stockmarketagent

A modern, AI-powered stock market dashboard and chat agent for real-time and historical analysis of S&P 500 stocks, built with Streamlit, LangGraph & Yahoo Finance.

Stock Market AI Agent / Dashboard

A modern, AI-powered stock market dashboard and chat agent for real-time and historical analysis of S&P 500 stocks, built with Streamlit, LangGraph & Yahoo Finance.

Demo

Features

  • Real-time and historical stock data fetching using YFinance
  • AI-powered stock analysis, chat, and recommendations
  • Interactive Streamlit dashboards for S&P 500 and individual stocks
  • Automated local data storage and updates
  • Technical indicators, financial ratios, and analyst recommendations
  • Latest news and sentiment integration

Project Structure

  • app.py — Streamlit app entry point and navigation.
  • pages/ — Chat agent, S&P 500 monitor, and symbol monitor dashboards.
    • Chat Agent: Uses deepseek-r1-distill-llama-70b LLM, equipped with a few tools around Yahoo Finance API provided by Agno as well as some custom tools.
    • S&P 500 Monitor: Uses automated logic to rank stocks with most significant changes in stock prices for a specified period. Logic flow:
      • Loading data from local files.
      • Calculating various changes such as 1h, 6h, 12h, 2d.
      • Ranking top n stock based on based on highest changes.
    • Symbol Monitor: Can be used to explore trends in a single stock.
  • data_fetcher.py — Automated data download and update logic that keeps running in background. Currently, it only fetches last 5 days of data, with 1 minute of interval during open-market times.
  • tools.py — LangChain tools for stock analysis, news, and calculating changes in stock prices.
  • S&P.json — List of S&P 500 companies and tickers.
  • data/ — Local storage for stock data (organized by symbol).

Prerequisites

  • Python 3.10
  • API keys:
    • Groq for LLM inference.
    • Serper for Google search tool.

Installation

  1. Clone this repository:

    git clone https://github.com/byahmedali/stockmarketagent.git
    cd stockmarketagent
    
  2. Create a .env file

    GROQ_API_KEY=YOUR_GROQ_API_KEY
    SERPER_API_KEY=YOUR_SERPER_API_KEY
    
  3. Set up a virtual environment

    a. Create a new virtual environment:

    py -3.10 -m venv venv
    

    b. Activate the virtual environment:

    Linux/macOS:

    source venv/bin/activate
    

    Windows:

    venv\Scripts\activate.bat
    

    c. Confirm you're using the newly created environment:

    If you see environment name (venv) at the beginning of your command prompt, it confirms that you're using the newly created virtual environment.

  4. Install required dependencies:

    pip install -r requirements.txt
    

Usage

  1. Run data_fetcher.py in background:
    python data_fetcher.py

    Note: On first launch, data fetcher will take some time.

  2. Open a new terminal in the same environment and start the Streamlit app:
    streamlit run app.py
  3. Open your browser and go to http://localhost:8501

Navigate between the Chat Agent, S&P 500 Monitor, and Symbol Monitor from the sidebar.

Running with Docker

  1. Build the Docker image:

    docker build -t stockagent .
    
  2. Run the container:

    docker run -p 8501:8501 --env-file .env stockagent
    

    Note: It is essential to provide API keys when running the docker container.

  3. Open your browser and go to http://localhost:8501

Contributing

New idea and feature contributions are always welcome!

Acknowledgments

  • This work is a part of ATS's projects catalog.
  • Yahoo Finance & Agno contributors
  • Python & LangChain community

Languages

Python99.3%Dockerfile0.7%

Contributors

MIT License
Created May 26, 2025
Updated March 10, 2026