dvaz commited on
Commit
5047c98
·
1 Parent(s): 1ee35ab

Upload 20_Crypto.py

Browse files
Files changed (1) hide show
  1. pages/20_Crypto.py +87 -7
pages/20_Crypto.py CHANGED
@@ -1,17 +1,13 @@
1
  import requests
2
  import streamlit as st
3
  import yfinance as yf
4
- import streamlit.components.v1 as components
5
- from requests_html import HTMLSession
6
-
7
-
8
 
9
 
10
  st.set_page_config('Crypto',":moneybag:","wide",menu_items={'About': "This is an *extremely* cool app!"})
11
 
12
 
13
-
14
- menu=['Chart']
15
  ch=st.sidebar.selectbox('Menu',menu)
16
 
17
  if ch== 'Chart':
@@ -27,4 +23,88 @@ if ch== 'Chart':
27
  df = yf.download(ms, dates1, dates2)
28
  st.write(df)
29
  df2 = yf.download(ms, dates1, dates2)['Close']
30
- st.line_chart(df2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import requests
2
  import streamlit as st
3
  import yfinance as yf
4
+ import pandas_ta as ta
 
 
 
5
 
6
 
7
  st.set_page_config('Crypto',":moneybag:","wide",menu_items={'About': "This is an *extremely* cool app!"})
8
 
9
 
10
+ menu=['Chart','RSI Indicator','Pivot points']
 
11
  ch=st.sidebar.selectbox('Menu',menu)
12
 
13
  if ch== 'Chart':
 
23
  df = yf.download(ms, dates1, dates2)
24
  st.write(df)
25
  df2 = yf.download(ms, dates1, dates2)['Close']
26
+ st.line_chart(df2)
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+ if ch== 'RSI Indicator':
37
+ with st.container():
38
+ list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD']
39
+ ms = st.selectbox('choose asset', list_asset)
40
+ dates1 = st.date_input('from')
41
+ dates2 = st.date_input('to')
42
+ st.write('---')
43
+
44
+
45
+ lis=[]
46
+ if len(ms) > 0:
47
+ with st.container():
48
+ df = yf.download(ms, dates1, dates2)
49
+ x=ta.rsi(df['Close'],lenght=14)
50
+ st.write(x)
51
+ for i,j in x.items():
52
+ lis.append(j)
53
+ st.write(f'RSI-14: {lis[-1]}')
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+ if ch== 'Pivot points':
65
+ with st.container():
66
+ list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD']
67
+ ms = st.selectbox('choose asset', list_asset)
68
+ dates1 = st.date_input('from')
69
+ dates2 = st.date_input('to')
70
+ st.write('---')
71
+
72
+
73
+ hlis=[]
74
+ llis=[]
75
+ clis=[]
76
+ if len(ms) > 0:
77
+ with st.container():
78
+ df = yf.download(ms, dates1, dates2)
79
+
80
+ for i,j in df['Close'].items():
81
+ clis.append(j)
82
+ close=clis[-1]
83
+
84
+ for ii,jj in df['High'].items():
85
+ hlis.append(jj)
86
+ high=hlis[-1]
87
+
88
+ for iii,jjj in df['Low'].items():
89
+ llis.append(jjj)
90
+ low=llis[-1]
91
+
92
+ PP = (high + low + close) / 3
93
+
94
+ R1 = 2 * PP - low
95
+ S1 = 2 * PP - high
96
+ st.write(f'S1:{S1}----R1:{R1}')
97
+ R2 = PP + (high - low)
98
+ S2 = PP - (high - low)
99
+ st.write(f'S2:{S2}----R2:{R2}')
100
+ R3 = PP + 2 * (high - low)
101
+ S3 = PP - 2 * (high - low)
102
+ st.write(f'S3:{S3}----R3:{R3}')
103
+ R4 = PP + 3 * (high - low)
104
+ S4 = PP - 3 * (high - low)
105
+ st.write(f'S4:{S4}----R4:{R4}')
106
+
107
+
108
+
109
+
110
+