File size: 635 Bytes
a2c10b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# modules/get_company_profile.py
from api.endpoints import FMPEndpoints

class GetCompanyProfile:
    async def get_data(self, ticker, year=None, date=None):
        endpoints = FMPEndpoints()
        try:
            data = await endpoints.get_profile(ticker)
            if not data:
                return f"Error: No company profile data available for {ticker}."
            ceo = data[0].get("ceo", "N/A")
            sector = data[0].get("sector", "N/A")
            return f"{ticker}'s CEO is {ceo} and it operates in the {sector} sector."
        except Exception as e:
            return f"Error fetching company profile: {e}"