Skip to content

A sophisticated financial analysis bot powered by OpenAI, designed to provide in-depth financial insights and recommendations based on company data.

License

Notifications You must be signed in to change notification settings

agniiva/StockAnalystAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Financial Analyst Bot

Note: If you're searching Any Stock use the TICKER SYMBOL (e.g. PATANJALI.NS) (in some cases normal names doesn't work) - I can improve on it, but who cares!!

Overview

What is AI Financial Analyst Bot?

The AI Financial Analyst Bot is an intelligent application designed to provide comprehensive financial analysis and insights for any given company. It leverages OpenAI's GPT-3.5-turbo model for analysis, yfinance for historical stock data, yahooquery for financial statements, and serper.dev for news retrieval.

Why is it Useful?

Investing in the stock market often requires hours of research, financial literacy, and keeping up with news. This bot automates these tasks by providing a one-stop solution for all your research needs. It not only provides raw data but also offers AI-powered insights to make your investment decisions more informed.

Unique Selling Points (USPs)

  1. One-Click Analysis: Just input the company name and get a detailed analysis.
  2. Real-Time Company News: Stay updated with the latest news related to the company.
  3. Comprehensive Data: Get everything from stock evolution to balance sheets.
  4. AI-Powered Insights: Receive detailed investment theses and recommendations.
  5. Multi-Source Analysis: Data is retrieved from multiple reliable sources for a well-rounded view.

🚀 Features

  • Company News Retrieval: Uses serper.dev API to fetch the latest news related to a company.
  • Historical Stock Data: Utilizes yfinance library to fetch historical stock data.
  • Financial Statements: Uses yahooquery to fetch the balance sheet, cash flow, and income statements.
  • AI-Powered Analysis: Uses OpenAI's GPT-3 model to generate in-depth financial analysis and recommendations.

Working Demo

Screen.sharing.-.2023-09-16.9_21_03.AM.mp4

Images of the analysis

image image image

Prerequisites

API Keys

You will need API keys for OpenAI and serper.dev. Add these keys in a .env file in the root directory. You can rename .env.example to .env to quickly get started.

Python Dependencies

Install all Python dependencies listed in requirements.txt:

pip install -r requirements.txt

Usage

  1. Navigate to the directory containing the code.
  2. Run the Streamlit app:
streamlit run app.py
  1. Input the company name and click "Analyze".

Code Documentation

Importing Libraries

  • streamlit: For the web interface
  • matplotlib.pyplot: For plotting graphs
  • financial_analyst: Custom module for the analysis

main()

The main function that handles the Streamlit UI and invokes the financial analysis. It plots stock data and displays the investment thesis.

financial_analyst.py

Contains various helper functions to fetch and analyze financial data. Here are some important functions:

get_company_news(company_name)

Fetches the latest news for the given company using the serper.dev API.

write_news_to_file(news, filename)

Writes the fetched news to a specified file.

get_stock_evolution(company_name, period="1y")

Fetches and writes historical stock data for the specified period using yfinance.

get_financial_statements(ticker)

Fetches financial statements using the yahooquery library.

get_data(company_name, company_ticker, period="1y", filename="investment.txt")

Calls all the data fetching functions and compiles the results.

financial_analyst(request)

Main function for financial analysis. Uses OpenAI's GPT-3 model to analyze the compiled data and generate an investment thesis.


Feel free to extend or modify the application according to your needs. Happy Investing!

About

A sophisticated financial analysis bot powered by OpenAI, designed to provide in-depth financial insights and recommendations based on company data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages