File size: 4,269 Bytes
cd84626
 
 
5047c98
c387830
cd84626
 
 
 
 
c387830
cd84626
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5047c98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c387830
 
 
 
5047c98
c387830
5047c98
c387830
 
5047c98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c387830
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import requests
import streamlit as st
import yfinance as yf
import pandas_ta as ta
from tradingview_ta import *


st.set_page_config('Crypto',":moneybag:","wide",menu_items={'About': "This is an *extremely* cool app!"})


menu=['Chart','RSI Indicator','Pivot points','Trading-view']
ch=st.sidebar.selectbox('Menu',menu)

if ch== 'Chart':
    with st.container():
        list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD']
        ms = st.multiselect('choose asset', list_asset)
        dates1 = st.date_input('from')
        dates2 = st.date_input('to')
        st.write('---')

    if len(ms) > 0:
        with st.container():
            df = yf.download(ms, dates1, dates2)
            st.write(df)
            df2 = yf.download(ms, dates1, dates2)['Close']
            st.line_chart(df2)









if ch== 'RSI Indicator':
    with st.container():
        list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD']
        ms = st.selectbox('choose asset', list_asset)
        dates1 = st.date_input('from')
        dates2 = st.date_input('to')
        st.write('---')


    lis=[]
    if len(ms) > 0:
        with st.container():
            df = yf.download(ms, dates1, dates2)
            x=ta.rsi(df['Close'],lenght=14)
            try:
                st.write(x)
                for i,j in x.items():
                    lis.append(j)

                st.write(f'RSI(14):    {lis[-1]}')

            except:
                st.warning('Minimum interval should be 14 days.')








if ch== 'Pivot points':
    with st.container():
        list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD']
        ms = st.selectbox('choose asset', list_asset)
        dates1 = st.date_input('from')
        dates2 = st.date_input('to')
        st.write('---')


    hlis=[]
    llis=[]
    clis=[]
    if len(ms) > 0:
        with st.container():
            df = yf.download(ms, dates1, dates2)

            for i,j in df['Close'].items():
                clis.append(j)
            close=clis[-1]

            for ii,jj in df['High'].items():
                hlis.append(jj)
            high=hlis[-1]

            for iii,jjj in df['Low'].items():
                llis.append(jjj)
            low=llis[-1]

            PP = (high + low + close) / 3

            R1 = 2 * PP - low
            S1 = 2 * PP - high
            st.write(f'S1:{S1}----R1:{R1}')
            R2 = PP + (high - low)
            S2 = PP - (high - low)
            st.write(f'S2:{S2}----R2:{R2}')
            R3 = PP + 2 * (high - low)
            S3 = PP - 2 * (high - low)
            st.write(f'S3:{S3}----R3:{R3}')
            R4 = PP + 3 * (high - low)
            S4 = PP - 3 * (high - low)
            st.write(f'S4:{S4}----R4:{R4}')







list_pair= ["BTCUSDT" ,"ETHUSDT","BNBUSDT","ADAUSDT","DOGEUSDT","SHIBAUSDT","MATICUSDT","ALGOUSDT","CHZUSDT"]

list_interval = ["Monthly","Weekly","Daily","4h","2h","1h","30m","15m","5m","1m"]
dict = {
        "1m":Interval.INTERVAL_1_MINUTE,
        "5m":Interval.INTERVAL_5_MINUTES ,
        "15m":Interval.INTERVAL_15_MINUTES,
        "30m":Interval.INTERVAL_30_MINUTES,
        "1h":Interval.INTERVAL_1_HOUR,
        "2h":Interval.INTERVAL_2_HOURS,
        "4h":Interval.INTERVAL_4_HOURS,
        "Daily":Interval.INTERVAL_1_DAY,
        "Weekly":Interval.INTERVAL_1_WEEK,
        "Monthly":Interval.INTERVAL_1_MONTH,
        }

list_exchange = ["BINANCE" ,"COINEX","UNISWAP","GATEIO","HUOBI","GATEIO","KUCOIN","FTX","COINBASE","OKX"]
screener="CRYPTO"

if ch== 'Trading-view':
    with st.container():

        pair = st.selectbox('Choose pair',list_pair)

        exchange = st.selectbox('Choose exchange', list_exchange)

        interval2 = st.selectbox('Choose interval', list_interval)
        interval2=(dict[interval2])

        handler = TA_Handler(
        symbol=pair,
        screener=screener,
        exchange=exchange,
        interval=interval2
        )

    with st.container():
        try:
            rec = handler.get_analysis().summary["RECOMMENDATION"]
            st.warning("RECOMMENDATION: "+ rec)

            ind = handler.get_analysis().indicators
            for k,v in ind.items():
                st.write(f'{k} ----- {v}')

            #handler.get_analysis().
        except:
            st.error('Exchange or pair not found.')