Agathe1489 commited on
Commit
891bd21
·
verified ·
1 Parent(s): 5afa424

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -12,7 +12,15 @@ from Gradio_UI import GradioUI
12
 
13
  @tool
14
  def get_stock_price(ticker: str) -> str:
15
- """Fetches the latest stock price for a given ticker symbol from Yahoo Finance."""
 
 
 
 
 
 
 
 
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)