Spaces:
Sleeping
Sleeping
Update app.py
Browse files281 unmodified lines28228328428528628728828929029129229328 unmodified lines32232332432532632732832933033133233313 unmodified lines347348349350351352353354355356357358281 unmodified linesfig7.update_layout(title_text="Bollinger Bands", title_x=0, margin=dict(l=0, r=10, b=10, t=30), yaxis_title=None, xaxis_title=None)g7.plotly_chart(fig7, use_container_width=True)# Stock Price vs. Volumefig8 = px.line(data, x='Date', y='Close', template='seaborn')fig8.add_bar(x=data['Date'], y=data['Volume'], name='Volume')fig8.update_layout(title_text="Stock Price vs. Volume", title_x=0, margin=dict(l=0, r=10, b=10, t=30), yaxis_title=None, xaxis_title=None)g8.plotly_chart(fig8, use_container_width=True)# MACDdata['12D_EMA'] = data['Close'].ewm(span=12, adjust=False).mean()data['26D_EMA'] = data['Close'].ewm(span=26, adjust=False).mean()28 unmodified linesfig11.update_layout(title_text="Candlestick Chart", title_x=0, margin=dict(l=0, r=10, b=10, t=30))g11.plotly_chart(fig11, use_container_width=True)# Correlation Matrixcorr_matrix = data[['Open', 'High', 'Low', 'Close', 'Volume']].corr()fig12 = px.imshow(corr_matrix, template='seaborn')fig12.update_layout(title_text="Correlation Matrix", title_x=0, margin=dict(l=0, r=10, b=10, t=30))g12.plotly_chart(fig12, use_container_width=True)### ............................................... ### Price Rate of Change (ROC)g13, g14, g15 = st.columns((1,1,1))13 unmodified linesfig14.update_layout(title_text="Stochastic Oscillator", title_x=0, margin=dict(l=0, r=10, b=10, t=30), yaxis_title=None, xaxis_title=None)g14.plotly_chart(fig14, use_container_width=True)# Historical Volatilitydata['Log_Return'] = np.log(data['Close'] / data['Close'].shift(1))data['Historical_Volatility'] = data['Log_Return'].rolling(window=252).std() * np.sqrt(252)fig15 = px.line(data, x='Date', y='Historical_Volatility', template='seaborn')fig15.update_layout(title_text="Historical Volatility (252-day)", title_x=0, margin=dict(l=0, r=10, b=10, t=30), yaxis_title=None, xaxis_title=None)g15.plotly_chart(fig15, use_container_width=True)except Exception as e:st.error(f"An error fetching stock information: {str(e)}")281 unmodified lines28228328428528628728 unmodified lines31631731831932032113 unmodified lines335336337338339281 unmodified linesfig7.update_layout(title_text="Bollinger Bands", title_x=0, margin=dict(l=0, r=10, b=10, t=30), yaxis_title=None, xaxis_title=None)g7.plotly_chart(fig7, use_container_width=True)# MACDdata['12D_EMA'] = data['Close'].ewm(span=12, adjust=False).mean()data['26D_EMA'] = data['Close'].ewm(span=26, adjust=False).mean()28 unmodified linesfig11.update_layout(title_text="Candlestick Chart", title_x=0, margin=dict(l=0, r=10, b=10, t=30))g11.plotly_chart(fig11, use_container_width=True)### ............................................... ### Price Rate of Change (ROC)g13, g14, g15 = st.columns((1,1,1))13 unmodified linesfig14.update_layout(title_text="Stochastic Oscillator", title_x=0, margin=dict(l=0, r=10, b=10, t=30), yaxis_title=None, xaxis_title=None)g14.plotly_chart(fig14, use_container_width=True)except Exception as e:st.error(f"An error fetching stock information: {str(e)}")
app.py-19