Spaces:
Sleeping
Sleeping
playing
Browse files
app.py
CHANGED
@@ -33,18 +33,19 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
# api_url = 'https://api.api-ninjas.com/v1/stockprice?ticker={}'.format(symbol)
|
43 |
# response = requests.get(api_url, headers={'X-Api-Key': 'tLxWjj6xXdYXkyajGKBdKQ==ncmATTD1rqr2s2Hb'})
|
44 |
# if response.status_code == requests.codes.ok:
|
45 |
# return (response.json()['price'])
|
46 |
# else:
|
47 |
# return ("Error:", response.status_code, response.text)
|
|
|
48 |
|
49 |
final_answer = FinalAnswerTool()
|
50 |
|
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
+
@tool
|
37 |
+
def get_stock_price(symbol: str) -> float:
|
38 |
+
"""The tool that provides the current stock price for a given symbol.
|
39 |
+
Args:
|
40 |
+
symbol: A string representing the valid stock symbol (eg., 'meta' or 'aapl').
|
41 |
+
"""
|
42 |
# api_url = 'https://api.api-ninjas.com/v1/stockprice?ticker={}'.format(symbol)
|
43 |
# response = requests.get(api_url, headers={'X-Api-Key': 'tLxWjj6xXdYXkyajGKBdKQ==ncmATTD1rqr2s2Hb'})
|
44 |
# if response.status_code == requests.codes.ok:
|
45 |
# return (response.json()['price'])
|
46 |
# else:
|
47 |
# return ("Error:", response.status_code, response.text)
|
48 |
+
return None
|
49 |
|
50 |
final_answer = FinalAnswerTool()
|
51 |
|