Spaces:
Sleeping
Sleeping
| from smolagents import Tool | |
| from typing import Any, Optional | |
| class SimpleTool(Tool): | |
| name = "get_stock_data" | |
| description = "Gets the latest adjusted closing price for a given stock symbol." | |
| inputs = {'symbol': {'type': 'string', 'description': 'The stock symbol to look up.'}} | |
| output_type = "string" | |
| def forward(self, symbol: str) -> str: | |
| """ | |
| Gets the latest adjusted closing price for a given stock symbol. | |
| Args: | |
| symbol: The stock symbol to look up. | |
| """ | |
| import yfinance as yf | |
| return yf.download(symbol, period="1mo")["Adj Close"][-1] |