Spaces:
Runtime error
Runtime error
import requests | |
import streamlit as st | |
import yfinance as yf | |
menu=['Home','Sport news','Crypto'] | |
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) | |
#ss = st.selectbox('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) | |
#st.table(df) | |
df2 = yf.download(ms, dates1, dates2)['Close'] | |
st.line_chart(df2) |