Hey @Mattia_Bolognesi,
Some tips to get you started :
- You can go from a list of checkboxes to list of checked stocks with some Python list manipulation. Example :
stocks = ["ST", "STR", "STREAM", "STREAMLIT"]
check_boxes = [st.sidebar.checkbox(stock, key=stock) for stock in stocks]
st.write([stock for stock, checked in zip(stocks, check_boxes) if checked])
- run some code after triggering a button
checked_stocks = [stock for stock, checked in zip(stocks, check_boxes) if checked]
if st.button("Download data"):
for stock in checked_stocks:
download_data(stock) # <-- download data with requests for example for this stock
I remember some posts regarding stock download you can check for inspiration notably Stocks views which has a link to source code, notably a function for downloading stock data with yfinance.
Fanilo