Last active
August 8, 2020 06:50
-
-
Save shashankvemuri/e87a255711b4c513347fc57a12d028ab to your computer and use it in GitHub Desktop.
Rest of code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adjusted Close Price | |
st.header(f"Adjusted Close Price\n {company_name}") | |
st.line_chart(data['Adj Close']) | |
# ## SMA and EMA | |
#Simple Moving Average | |
data['SMA'] = talib.SMA(data['Adj Close'], timeperiod = 20) | |
# Exponential Moving Average | |
data['EMA'] = talib.EMA(data['Adj Close'], timeperiod = 20) | |
# Plot | |
st.header(f"Simple Moving Average vs. Exponential Moving Average\n {company_name}") | |
st.line_chart(data[['Adj Close','SMA','EMA']]) | |
# Bollinger Bands | |
data['upper_band'], data['middle_band'], data['lower_band'] = talib.BBANDS(data['Adj Close'], timeperiod =20) | |
# Plot | |
st.header(f"Bollinger Bands\n {company_name}") | |
st.line_chart(data[['Adj Close','upper_band','middle_band','lower_band']]) | |
# ## MACD (Moving Average Convergence Divergence) | |
# MACD | |
data['macd'], data['macdsignal'], data['macdhist'] = talib.MACD(data['Adj Close'], fastperiod=12, slowperiod=26, signalperiod=9) | |
# Plot | |
st.header(f"Moving Average Convergence Divergence\n {company_name}") | |
st.line_chart(data[['macd','macdsignal']]) | |
## CCI (Commodity Channel Index) | |
# CCI | |
cci = ta.trend.cci(data['High'], data['Low'], data['Close'], n=31, c=0.015) | |
# Plot | |
st.header(f"Commodity Channel Index\n {company_name}") | |
st.line_chart(cci) | |
# ## RSI (Relative Strength Index) | |
# RSI | |
data['RSI'] = talib.RSI(data['Adj Close'], timeperiod=14) | |
# Plot | |
st.header(f"Relative Strength Index\n {company_name}") | |
st.line_chart(data['RSI']) | |
# ## OBV (On Balance Volume) | |
# OBV | |
data['OBV'] = talib.OBV(data['Adj Close'], data['Volume'])/10**6 | |
# Plot | |
st.header(f"On Balance Volume\n {company_name}") | |
st.line_chart(data['OBV']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment