import requests import streamlit as st import yfinance as yf menu=['Home','Sport news','Crypto','Sales'] ch=st.sidebar.selectbox('Menu',menu) if ch=='Home': st.title('Test python projects') st.write('This is a homepage to run and test different python scripts!') if ch== 'Sport news': st.title('Sport news') ti=st.text_input('Text input') if len(ti)>0: r=requests.get('https://search-api.varzesh3.com/v1.0/query?q='+ti) x=r.json() for i in x['news']: st.subheader(i['title']) st.success(i['publishedOn']) st.write(i['shortDescription']) st.image(i['picture']) st.write('--------------------------------------------') if ch== 'Crypto': list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD'] ms = st.multiselect('choose asset', list_asset) dates1 = st.date_input('from') dates2 = st.date_input('to') if len(ms) > 0: df = yf.download(ms, dates1, dates2) st.write(df) df2 = yf.download(ms, dates1, dates2)['Close'] st.line_chart(df2) if ch == 'Sales': st.title('Good deals from stores below:') url = requests.get('https://www.cheapshark.com/api/1.0/stores') x = url.json() for i in x: st.write(i['storeName'] ) url2 = requests.get('https://www.cheapshark.com/api/1.0/deals?storeID=1&upperPrice=15') y = url2.json() for j in y: st.write('------------------------------------------') st.write('Game name: '+j['title']) st.write('ID: '+j['gameID']) st.write('New price: '+j['salePrice']) st.write('Old price: '+j['normalPrice']) st.write(j['thumb']) st.write('------------------------------------------')