Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,34 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
import yfinance as yf
|
3 |
|
4 |
-
|
5 |
-
st.
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
st.
|
14 |
-
st.table(data)
|
15 |
-
st.line_chart(data)
|
|
|
1 |
+
import requests
|
2 |
import streamlit as st
|
3 |
import yfinance as yf
|
4 |
|
5 |
+
menu=['Home','Sport news','Crypto']
|
6 |
+
ch=st.sidebar.selectbox('Menu',menu)
|
7 |
+
if ch=='Home':
|
8 |
+
st.title('Test python projects')
|
9 |
+
st.write('This is a homepage to run and test different python scripts!')
|
10 |
+
if ch== 'Sport news':
|
11 |
+
st.title('Sport news')
|
12 |
+
ti=st.text_input('Text input')
|
13 |
+
if len(ti)>0:
|
14 |
+
r=requests.get('https://search-api.varzesh3.com/v1.0/query?q='+ti)
|
15 |
+
x=r.json()
|
16 |
+
for i in x['news']:
|
17 |
+
st.subheader(i['title'])
|
18 |
+
st.success(i['publishedOn'])
|
19 |
+
st.write(i['shortDescription'])
|
20 |
+
st.image(i['picture'])
|
21 |
+
st.write('--------------------------------------------')
|
22 |
+
if ch== 'Crypto':
|
23 |
+
list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD']
|
24 |
+
ms = st.multiselect('choose asset', list_asset)
|
25 |
+
#ss = st.selectbox('choose asset', list_asset)
|
26 |
+
dates1 = st.date_input('from')
|
27 |
+
dates2 = st.date_input('to')
|
28 |
|
29 |
+
if len(ms) > 0:
|
30 |
+
df = yf.download(ms, dates1, dates2)
|
31 |
+
st.write(df)
|
32 |
+
#st.table(df)
|
33 |
+
df2 = yf.download(ms, dates1, dates2)['Close']
|
34 |
+
st.line_chart(df2)
|
|
|
|