Make selectbox as an input for fetching data

Hi all,

I am trying to create a selectbox for users to choose their time frame (form & to) and then use the output of this selectboxes as an input to fetch data from Yahoo Finance. Any idea how can I do this ?

 import yfinance as yf
 import streamlit as st
 import pandas as pd
 start=st.selectbox('From', df['Time'])
 end=st.selectbox('To',df['Time'])
 tickerSymbol='TSLA'
 tickerdata=yf.Ticker(tickerSymbol)
 tickerDF=tickerData.history(period='1d',start=start,end=end)
 st.line_chart(tikerDF)

Hi @mehran, welcome to the Streamlit community!

This is the same basic question as these, so maybe you can get some inspiration from these examples:

1 Like