Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,9 +23,14 @@ def get_stock_data(symbol, timeframe):
|
|
23 |
period = "60d"
|
24 |
|
25 |
data = ticker.history(period=period, interval=timeframe)
|
|
|
|
|
|
|
|
|
26 |
return data
|
27 |
|
28 |
|
|
|
29 |
def calculate_indicators(data):
|
30 |
"""Calculates technical indicators."""
|
31 |
data['SMA20'] = data['Close'].rolling(window=20).mean() # Simple Moving Average (20 days)
|
|
|
23 |
period = "60d"
|
24 |
|
25 |
data = ticker.history(period=period, interval=timeframe)
|
26 |
+
|
27 |
+
if data.empty:
|
28 |
+
raise ValueError(f"No data found for symbol '{symbol}' with timeframe '{timeframe}'.")
|
29 |
+
|
30 |
return data
|
31 |
|
32 |
|
33 |
+
|
34 |
def calculate_indicators(data):
|
35 |
"""Calculates technical indicators."""
|
36 |
data['SMA20'] = data['Close'].rolling(window=20).mean() # Simple Moving Average (20 days)
|