Skip to content

AI-powered stock analysis and investment recommendation app using CrewAI agents, Gemini LLM, DuckDuckGo Search and real-time market data. Generates comprehensive reports, news summaries, and buy/hold/sell advice.

Notifications You must be signed in to change notification settings

MukulGupta121190/CrewAi-Gemini-Stock-Analyser

Repository files navigation

CrewAI Multi Agent Stock Analyzer 📊🤖

Agentic AI Stock Analyser APP

An AI-powered stock analysis and investment recommendation app built using CrewAI Agents, Gemini LLM, DuckDuckGo Search and real-time financial data via Yahoo Finance. The application uses multi-agent AI with Gemini models to collect stock data, news, research/web scraping and perform financial analysis & generates comprehensive reports, news summaries, and buy/hold/sell advice.

🔍 Features

  • 📈 Real-time stock data, financial ratios, and historical trends
  • 📰 Latest company-specific news analysis
  • 🧠 Multi-agent reasoning using CrewAI
  • 💡 Buy/Hold/Sell recommendations based on financial insights
  • 📨 Report generation + optional email delivery
  • 🧾 Exports PDF report for LinkedIn, email, or investor presentation use

🛠️ Tech Stack

  • CrewAI – Autonomous multi-agent orchestration
  • Google Gemini (via Langchain) – LLM for reasoning and generation
  • Yahoo Finance API – Real-time financial data
  • Streamlit – Interactive web UI
  • pdfkit + markdown – PDF report generation
  • smtplib – Email dispatch functionality

🤖🤖 Agents:

  • Stock Data Collector
  • News Reader
  • Financial Analyst
  • Financial Expert

Workflow

  • Input company name or stock ticker to generate reports.
  • Fetches real-time stock data and historical prices.
  • Extract financial data from income statements, balance sheets and cash flow.
  • Summarizes recent news articles related to the stock.
  • Conducts stock market research with web scraping.
  • Generates a detailed stock analysis report in both text/markdown and PDF formats.
  • Displays the report and chain of thought reasoning in the user interface.
  • Sends the generated report via email.

Run Application:

streamlit run app.py

🚀 Demo Screenshots

Application Interface Reliance_Industries_Stock_Analysis_Report

📦 Setup Instructions

1. Clone the repository

git clone https://github.com/MukulGupta121190/CrewAi-Gemini-Stock-Analyser.git
cd CrewAi-Gemini-Stock-Analyser

2. Create a virtual environment and install dependencies

python -m venv venv
source venv/bin/activate  # or venv\Scripts\activate on Windows

pip install -r requirements.txt

3. Configure .env

LITELLM_PROVIDER=gemini
MODEL_NAME=gemini-2.0-flash-lite
GEMINI_API_KEY=your_google_gemini_api_key
GOOGLE_APPLICATION_CREDENTIALS=path_to_your_service_account.json
AGENTOPS_API_KEY=your_agentops_api_key
SENDER_EMAIL=your_email@gmail.com
EMAIL_PASSWORD=your_app_specific_password

4. Download and install wkhtmltopdf package to convert html files to pdf reports

Sudo installer -pkg /path_to_package/wkhtmltox-0.12.6-2.macos-cocoa.pkg -target /usr/local/bin

🔐 Why GOOGLE_APPLICATION_CREDENTIALS Is Required?

Gemini’s web tools and some Langchain integrations require access to Google Cloud resources (e.g., embedding, vector search). This is authenticated via a service account JSON file, pointed to by GOOGLE_APPLICATION_CREDENTIALS. You can generate this JSON from:

🛡️ CrewAI Gemini Compatibility Fix

By default, CrewAI expects an OpenAI API key even if you’re using Google Gemini. To avoid this, we apply the following temporary workaround in config.py or before initializing the Crew:

os.environ["OPENAI_API_KEY"] = "dummy-key"
os.environ["AGENTOPS_DISABLED"] = "true"

This bypasses internal validation and disables telemetry via AgentOps.

Contributions

Contributions to this project are welcome! If you have any ideas for improvements, bug fixes, or new features, feel free to submit a pull request.

Contact

For any questions or issues, please contact [mukulgupta121190@gmail.com] or feel free to reach out to me on LinkedIn.

Connect with me:

mukulgupta0991 mukulgupta121190 @mukulgupta121190 mukulgupta121190

About

AI-powered stock analysis and investment recommendation app using CrewAI agents, Gemini LLM, DuckDuckGo Search and real-time market data. Generates comprehensive reports, news summaries, and buy/hold/sell advice.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •