Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,15 @@ from Gradio_UI import GradioUI
|
|
| 12 |
|
| 13 |
@tool
|
| 14 |
def get_stock_price(ticker: str) -> str:
|
| 15 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
url = f"https://finance.yahoo.com/quote/{ticker}"
|
| 17 |
headers = {"User-Agent": "Mozilla/5.0"} # Avoid bot detection
|
| 18 |
response = requests.get(url, headers=headers)
|
|
|
|
| 12 |
|
| 13 |
@tool
|
| 14 |
def get_stock_price(ticker: str) -> str:
|
| 15 |
+
"""
|
| 16 |
+
Fetches the latest stock price for a given ticker symbol from Yahoo Finance.
|
| 17 |
+
|
| 18 |
+
Args:
|
| 19 |
+
ticker (str): The stock ticker symbol (e.g., "AAPL" for Apple).
|
| 20 |
+
|
| 21 |
+
Returns:
|
| 22 |
+
str: The current stock price or an error message if the price cannot be retrieved.
|
| 23 |
+
"""
|
| 24 |
url = f"https://finance.yahoo.com/quote/{ticker}"
|
| 25 |
headers = {"User-Agent": "Mozilla/5.0"} # Avoid bot detection
|
| 26 |
response = requests.get(url, headers=headers)
|