i want remove empty space that i marked by pink color
st.title('Stock X')
st.sidebar.info('Welcome to the Stock Price Prediction App. Choose your Stocks below')
def main():
option = st.sidebar.selectbox('Make a choice', ['Visualize'])
if option == 'Visualize':
tech_indicators()
@st.cache_resource
def download_df(op, start_date, end_date):
df = yf.download(op, start=start_date, end=end_date, progress=False)
return df
Stock = st.sidebar.text_input('Enter a Stock Symbol', value='MSFT')
Stock = Stock.upper()
today = datetime.date.today()
duration = st.sidebar.number_input('Enter the duration', value=1500)
before = today - datetime.timedelta(days=duration)
start_date = st.sidebar.date_input('Start Date', value=before)
end_date = st.sidebar.date_input('End date', today)
if st.sidebar.button('Send'):
if start_date < end_date:
st.sidebar.success('Start date: `%s`\n\nEnd date: `%s`' %(start_date, end_date))
download_df(Stock, start_date, end_date)
else:
st.sidebar.error('Error: End date must fall after start date')
df = download_df(Stock, start_date, end_date)
def tech_indicators():
st.header('Technical Indicators')
Stock = st.radio('Choose a Technical Indicator to Visualize', ['Chart', 'BB', 'SMA', 'EMA'])
Viz = df.copy()
# Bollinger bands
if Stock == 'Chart':
st.write('Candlestick chart')
chart = StreamlitChart(width=900, height=600)
chart.set(Viz)
chart.load()
st.markdown("<style>.css-18e3th9 { padding-top: 0rem; } </style>", unsafe_allow_html=True) # Adjust padding as needed
elif Stock == 'BB':
st.write('BollingerBands')
elif Stock == 'SMA':
st.write('Simple Moving Average')
else:
st.write('Expoenetial Moving Average')
if __name__ == '__main__':
main()