Spaces:
Running
Running
Commit
·
cdf1418
1
Parent(s):
541388d
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=
|
91 |
-
end=
|
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 |
|