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!!
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.
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.
- One-Click Analysis: Just input the company name and get a detailed analysis.
- Real-Time Company News: Stay updated with the latest news related to the company.
- Comprehensive Data: Get everything from stock evolution to balance sheets.
- AI-Powered Insights: Receive detailed investment theses and recommendations.
- Multi-Source Analysis: Data is retrieved from multiple reliable sources for a well-rounded view.
- 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.
Screen.sharing.-.2023-09-16.9_21_03.AM.mp4
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.
Install all Python dependencies listed in requirements.txt
:
pip install -r requirements.txt
- Navigate to the directory containing the code.
- Run the Streamlit app:
streamlit run app.py
- Input the company name and click "Analyze".
streamlit
: For the web interfacematplotlib.pyplot
: For plotting graphsfinancial_analyst
: Custom module for the analysis
The main function that handles the Streamlit UI and invokes the financial analysis. It plots stock data and displays the investment thesis.
Contains various helper functions to fetch and analyze financial data. Here are some important functions:
Fetches the latest news for the given company using the serper.dev API.
Writes the fetched news to a specified file.
Fetches and writes historical stock data for the specified period using yfinance.
Fetches financial statements using the yahooquery library.
Calls all the data fetching functions and compiles the results.
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!