tbdavid2019 commited on
Commit
cdf1418
·
1 Parent(s): 541388d
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -82,13 +82,14 @@ def period_to_start_end(period_str: str):
82
  return start, now
83
 
84
 
85
- def get_stock_prices(ticker: str) -> Union[Dict, str]:
86
  """Fetches historical stock price data and technical indicator for a given ticker."""
87
  try:
 
88
  data = yf.download(
89
  ticker,
90
- start=dt.datetime.now() - dt.timedelta(weeks=13),
91
- end=dt.datetime.now(),
92
  interval='1d'
93
  )
94
 
 
82
  return start, now
83
 
84
 
85
+ def get_stock_prices(ticker: str, period: str = "3mo") -> Union[Dict, str]:
86
  """Fetches historical stock price data and technical indicator for a given ticker."""
87
  try:
88
+ start, end = period_to_start_end(period)
89
  data = yf.download(
90
  ticker,
91
+ start=start,
92
+ end=end,
93
  interval='1d'
94
  )
95