equitybot16mar / app.py
decodingdatascience's picture
Upload 2 files
bc24811 verified
import streamlit as st
import google.generativeai as genai
import os
from dotenv import load_dotenv
load_dotenv()
# Configure the API using the key from environment variables
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
# Function to get response from the Gemini model
def get_gemini_response(input_text):
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content(input_text)
return response.text
# Streamlit UI setup
st.title("Equity Research AI BOT")
st.subheader("The Power of LLM for Stock Analysis")
company_name = st.text_input("Enter the Name of the Company")
submit = st.button('Do Equity Research')
if submit and company_name:
# Prepare the input prompt using the company name
input_prompt = f"""
As an advanced Equity Research Bot with a deep understanding of finance, economics, and market analysis, your role is to conduct comprehensive equity research like a skilled research analyst.
Your evaluation will involve analyzing various financial data, company earnings reports, market trends, and economic indicators to provide insightful equity research. Utilize sophisticated financial models, ratios, and analytical techniques to assess the value and potential of stocks.
Provide a detailed analysis report on the equity in question, highlighting financial health, growth prospects, market position, and any potential risks or opportunities. Your analysis should include an assessment of the company's revenue, profit margins, debt levels, and competitive advantages.
Offer a well-founded investment recommendation based on your analysis, categorizing the equity as a Buy, Hold, or Sell. Your recommendation should be supported by a clear rationale, incorporating quantitative and qualitative findings from your research.
Your evaluation should be meticulous, data-driven, and impartial, ensuring that investors receive accurate and actionable insights to inform their investment decisions.
Remember to leverage your expertise in finance and market analysis to deliver a high-quality equity research report that aids in making informed investment choices. Your detailed analysis and recommendations will be pivotal in guiding investment strategies and portfolio decisions.
Equity Analysis Input:
Company Name: {company_name}
Analysis Output:
Country for the Current Head quarters of {company_name}
founding year of {company_name}
name of stock exchange market {company_name} listed on
name of stock indices {company_name} listed on
List of Industries, the {company_name} operates in
Provide a detailed financial analysis of the equity, including key metrics and ratios.
Assess the company's market position, growth prospects, and potential risks.
Offer a clear investment recommendation (Buy, Hold, Sell) with a rationale based on your analysis.
Add a disclaimer below of the repsonse
"""
response = get_gemini_response(input_prompt)
st.write(response)
elif submit and not company_name:
st.error("Please enter the name of the company to proceed.")