Added a tool to search for the name of a stock ticker.
Browse files
app.py
CHANGED
@@ -38,14 +38,22 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
38 |
def get_yfinance_ticker_price(ticker_name: str) -> float:
|
39 |
"""A tool to return the current price for the provided Yahoo Finance stock ticker name
|
40 |
Args:
|
41 |
-
ticker_name
|
42 |
|
43 |
"""
|
44 |
# Get the ticker for the provided ticker name
|
45 |
ticker = yf.Ticker(ticker_name)
|
46 |
-
|
47 |
return ticker.info.get('regularMarketPrice', None)
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
final_answer = FinalAnswerTool()
|
50 |
model = HfApiModel(
|
51 |
max_tokens=2096,
|
|
|
38 |
def get_yfinance_ticker_price(ticker_name: str) -> float:
|
39 |
"""A tool to return the current price for the provided Yahoo Finance stock ticker name
|
40 |
Args:
|
41 |
+
ticker_name: Ticker name. A ticker is the name of a stock in the Yahoo Finance Portal (e. g. Intel Corporation has the ticker INTC)
|
42 |
|
43 |
"""
|
44 |
# Get the ticker for the provided ticker name
|
45 |
ticker = yf.Ticker(ticker_name)
|
|
|
46 |
return ticker.info.get('regularMarketPrice', None)
|
47 |
|
48 |
+
@tool
|
49 |
+
def get_yfinance_ticker_name(stock_name : str) -> str:
|
50 |
+
"""A tool that uses web search to search for the Yahoo Finance stock ticker name of the provided stock. It returns the search results for the query.
|
51 |
+
Args:
|
52 |
+
stock_name : A string containing name of the stock (e. g. Intel Corporation or iShares Core MSCI World UCITS ETF USD (Acc))
|
53 |
+
"""
|
54 |
+
result = web_search(query=f"{stock_name} Yahoo Finance stock ticker name")
|
55 |
+
return result
|
56 |
+
|
57 |
final_answer = FinalAnswerTool()
|
58 |
model = HfApiModel(
|
59 |
max_tokens=2096,
|