Seewhatson commited on
Commit
ddbae41
·
verified ·
1 Parent(s): f67f6e5

Update app.py

Browse files

update return format for stock price search

Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -13,7 +13,7 @@ from Gradio_UI import GradioUI
13
  @tool
14
  def get_stock_price(ticker_symbol:str, time_period:str)-> str: #it's import to specify the return type
15
  #Keep this format for the description / args / args description but feel free to modify the tool
16
- """A tool that searches for the historic price of a stock symbol given the symbol ticker name and a period.
17
  Args:
18
  ticker_symbol: A string representing a stock symbol (e.g., 'AAPL')
19
  time_period: A string representing the time period for pricing. Valid options are 1d, 5d, 1mo, 3mo, 6mo, 1y,2y, 5y, 10y and ytd the current timezone
@@ -21,7 +21,7 @@ def get_stock_price(ticker_symbol:str, time_period:str)-> str: #it's import to s
21
  try:
22
  data = yf.Ticker(ticker_symbol)
23
  historic_price = data.history(period=time_period)
24
- return historic_price.to_string()
25
  except Exception as e:
26
  return f"Error getting the price for {ticker_symbol}: {str(e)}"
27
 
 
13
  @tool
14
  def get_stock_price(ticker_symbol:str, time_period:str)-> str: #it's import to specify the return type
15
  #Keep this format for the description / args / args description but feel free to modify the tool
16
+ """A tool that searches for the historic price of a stock symbol given the symbol ticker name and a period. IT will return in a csv string format.
17
  Args:
18
  ticker_symbol: A string representing a stock symbol (e.g., 'AAPL')
19
  time_period: A string representing the time period for pricing. Valid options are 1d, 5d, 1mo, 3mo, 6mo, 1y,2y, 5y, 10y and ytd the current timezone
 
21
  try:
22
  data = yf.Ticker(ticker_symbol)
23
  historic_price = data.history(period=time_period)
24
+ return historic_price.to_csv()
25
  except Exception as e:
26
  return f"Error getting the price for {ticker_symbol}: {str(e)}"
27