dvaz commited on
Commit
231c5eb
1 Parent(s): 953d5bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -11
app.py CHANGED
@@ -1,15 +1,34 @@
 
1
  import streamlit as st
2
  import yfinance as yf
3
 
4
- st.title('Learning streamlit header')
5
- st.header('Learning streamlit title')
6
- st.write('Learning streamlit normal write')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- agree = st.checkbox('I agree')
9
- if agree:
10
- st.write('ok')
11
-
12
- data = yf.download("AAPL", start="2022-08-25", end="2022-08-28")
13
- st.write(data)
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)