tournas commited on
Commit
082daaf
·
verified ·
1 Parent(s): f950ece

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -16,20 +16,17 @@ api_key = os.getenv("ALPHAVANTAGE")
16
  # Define a tool to retrieve the Discounted Cash Flow (DCF) of a company
17
 
18
  @tool
19
- def get_dcf_of_company(company_name: str) -> str:
20
  """A tool that retrieves the DCF of a company based on its name.
21
  Args:
22
- company_name: The name of the company.
 
23
  """
24
  try:
25
  # Step 1: Retrieve the stock ticker symbol
26
- search_url = f'https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords={company_name}&apikey=NR9AFISYRYH2B5U3'
27
  response = requests.get(search_url)
28
  data = response.json()
29
- if 'bestMatches' in data and len(data['bestMatches']) > 0:
30
- symbol = data['bestMatches'][0]['1. symbol']
31
- else:
32
- return f"No stock symbol found for company '{company_name}'."
33
 
34
  # Step 2: Retrieve the company's financial statements
35
  financials = {}
 
16
  # Define a tool to retrieve the Discounted Cash Flow (DCF) of a company
17
 
18
  @tool
19
+ def get_dcf_of_company(symbol: str) -> str:
20
  """A tool that retrieves the DCF of a company based on its name.
21
  Args:
22
+ symbol: The symbol name of the company in the stock market, always in capitals.
23
+ e.g. AAPL for apple, IBM for IBM
24
  """
25
  try:
26
  # Step 1: Retrieve the stock ticker symbol
27
+ search_url = f'https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords={symbol}&apikey=NR9AFISYRYH2B5U3'
28
  response = requests.get(search_url)
29
  data = response.json()
 
 
 
 
30
 
31
  # Step 2: Retrieve the company's financial statements
32
  financials = {}