Update app.py
Browse files
app.py
CHANGED
@@ -43,9 +43,9 @@ data_load_state.text("Loading SPY data...done!")
|
|
43 |
|
44 |
# Calculate technical indicators: MACD and RSI
|
45 |
macd_indicator = MACD(close=data['Close'])
|
46 |
-
#
|
47 |
-
data['MACD'] = pd.Series(macd_indicator.macd().
|
48 |
-
data['MACD_signal'] = pd.Series(macd_indicator.macd_signal().
|
49 |
|
50 |
rsi_indicator = RSIIndicator(close=data['Close'], window=14)
|
51 |
data['RSI'] = rsi_indicator.rsi()
|
@@ -195,4 +195,4 @@ st.write(f"**Return:** {return_pct:.2f}%")
|
|
195 |
|
196 |
st.markdown("""
|
197 |
*This extended demo is for educational purposes only and does not constitute financial advice. Always test your strategies extensively before trading with real money.*
|
198 |
-
""")
|
|
|
43 |
|
44 |
# Calculate technical indicators: MACD and RSI
|
45 |
macd_indicator = MACD(close=data['Close'])
|
46 |
+
# Use flatten() to convert to a 1D array
|
47 |
+
data['MACD'] = pd.Series(np.array(macd_indicator.macd()).flatten(), index=data.index)
|
48 |
+
data['MACD_signal'] = pd.Series(np.array(macd_indicator.macd_signal()).flatten(), index=data.index)
|
49 |
|
50 |
rsi_indicator = RSIIndicator(close=data['Close'], window=14)
|
51 |
data['RSI'] = rsi_indicator.rsi()
|
|
|
195 |
|
196 |
st.markdown("""
|
197 |
*This extended demo is for educational purposes only and does not constitute financial advice. Always test your strategies extensively before trading with real money.*
|
198 |
+
""")
|