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

Upload 20_Crypto.py

Browse files
Files changed (1) hide show
  1. pages/20_Crypto.py +62 -5
pages/20_Crypto.py CHANGED
@@ -2,12 +2,13 @@ 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':
@@ -47,12 +48,15 @@ if ch== 'RSI Indicator':
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
 
@@ -108,3 +112,56 @@ if ch== 'Pivot points':
108
 
109
 
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  import streamlit as st
3
  import yfinance as yf
4
  import pandas_ta as ta
5
+ from tradingview_ta import *
6
 
7
 
8
  st.set_page_config('Crypto',":moneybag:","wide",menu_items={'About': "This is an *extremely* cool app!"})
9
 
10
 
11
+ menu=['Chart','RSI Indicator','Pivot points','Trading-view']
12
  ch=st.sidebar.selectbox('Menu',menu)
13
 
14
  if ch== 'Chart':
 
48
  with st.container():
49
  df = yf.download(ms, dates1, dates2)
50
  x=ta.rsi(df['Close'],lenght=14)
51
+ try:
52
+ st.write(x)
53
+ for i,j in x.items():
54
+ lis.append(j)
55
 
56
+ st.write(f'RSI(14): {lis[-1]}')
57
 
58
+ except:
59
+ st.warning('Minimum interval should be 14 days.')
60
 
61
 
62
 
 
112
 
113
 
114
 
115
+
116
+
117
+ list_pair= ["BTCUSDT" ,"ETHUSDT","BNBUSDT","ADAUSDT","DOGEUSDT","SHIBAUSDT","MATICUSDT","ALGOUSDT","CHZUSDT"]
118
+
119
+ list_interval = ["Monthly","Weekly","Daily","4h","2h","1h","30m","15m","5m","1m"]
120
+ dict = {
121
+ "1m":Interval.INTERVAL_1_MINUTE,
122
+ "5m":Interval.INTERVAL_5_MINUTES ,
123
+ "15m":Interval.INTERVAL_15_MINUTES,
124
+ "30m":Interval.INTERVAL_30_MINUTES,
125
+ "1h":Interval.INTERVAL_1_HOUR,
126
+ "2h":Interval.INTERVAL_2_HOURS,
127
+ "4h":Interval.INTERVAL_4_HOURS,
128
+ "Daily":Interval.INTERVAL_1_DAY,
129
+ "Weekly":Interval.INTERVAL_1_WEEK,
130
+ "Monthly":Interval.INTERVAL_1_MONTH,
131
+ }
132
+
133
+ list_exchange = ["BINANCE" ,"COINEX","UNISWAP","GATEIO","HUOBI","GATEIO","KUCOIN","FTX","COINBASE","OKX"]
134
+ screener="CRYPTO"
135
+
136
+ if ch== 'Trading-view':
137
+ with st.container():
138
+
139
+ pair = st.selectbox('Choose pair',list_pair)
140
+
141
+ exchange = st.selectbox('Choose exchange', list_exchange)
142
+
143
+ interval2 = st.selectbox('Choose interval', list_interval)
144
+ interval2=(dict[interval2])
145
+
146
+ handler = TA_Handler(
147
+ symbol=pair,
148
+ screener=screener,
149
+ exchange=exchange,
150
+ interval=interval2
151
+ )
152
+
153
+ with st.container():
154
+ try:
155
+ rec = handler.get_analysis().summary["RECOMMENDATION"]
156
+ st.warning("RECOMMENDATION: "+ rec)
157
+
158
+ ind = handler.get_analysis().indicators
159
+ for k,v in ind.items():
160
+ st.write(f'{k} ----- {v}')
161
+
162
+ #handler.get_analysis().
163
+ except:
164
+ st.error('Exchange or pair not found.')
165
+
166
+
167
+