Views
No views yet
if not data.empty:
# Display raw data
st.subheader('Raw Data')
st.write(data.tail())
# Calculate technical indicators using pandas_ta
data['SMA'] = ta.sma(data['Close'], length=20)
data['EMA'] = ta.ema(data['Close'], length=20)
data['RSI'] = ta.rsi(data['Close'], length=14)
# Display technical indicators
st.subheader('Technical Indicators')
st.write(data[['Close', 'SMA', 'EMA', 'RSI']].tail())
# Plotting
st.subheader('Stock Price and SMA/EMA')
st.line_chart(data[['Close', 'SMA', 'EMA']])
st.subheader('RSI')
st.line_chart(data['RSI'])
else:
st.error('Invalid stock ticker or no data available. Please try again.')