Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,16 +87,18 @@ if st.button("Analyze"):
|
|
| 87 |
# Moving Averages and Bollinger Bands
|
| 88 |
st.subheader("Volatility Analysis")
|
| 89 |
ma_20, upper_band, lower_band = calculate_bollinger_bands(stock_data)
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
|
| 101 |
# Fetch and Analyze News
|
| 102 |
st.subheader("Latest News and Sentiment Analysis")
|
|
|
|
| 87 |
# Moving Averages and Bollinger Bands
|
| 88 |
st.subheader("Volatility Analysis")
|
| 89 |
ma_20, upper_band, lower_band = calculate_bollinger_bands(stock_data)
|
| 90 |
+
|
| 91 |
+
# Create a figure for Bollinger Bands
|
| 92 |
+
fig, ax = plt.subplots(figsize=(10, 5))
|
| 93 |
+
ax.plot(stock_data['Close'], label="Close Price")
|
| 94 |
+
ax.plot(ma_20, label="20-Day Moving Average", linestyle='--')
|
| 95 |
+
ax.plot(upper_band, label="Upper Bollinger Band", linestyle='--')
|
| 96 |
+
ax.plot(lower_band, label="Lower Bollinger Band", linestyle='--')
|
| 97 |
+
ax.legend()
|
| 98 |
+
ax.set_title(f"{ticker} Price with Bollinger Bands")
|
| 99 |
+
ax.set_xlabel("Date")
|
| 100 |
+
ax.set_ylabel("Price")
|
| 101 |
+
st.pyplot(fig)
|
| 102 |
|
| 103 |
# Fetch and Analyze News
|
| 104 |
st.subheader("Latest News and Sentiment Analysis")
|