-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfibopoint.py
140 lines (102 loc) · 4.2 KB
/
fibopoint.py
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
__author__ = "Daniell Castelo Branco Ciriaco"
__email__ = "niellcast.contato@outlook.com"
import streamlit as st
from time import sleep
from src.database.db import Database
from src.config.page_config import set_page_config
from src.indicator.pivot_point import PivotPoint
def run() -> None:
set_page_config('Fibo Point')
data = Database('data.db')
menu = st.sidebar.selectbox(
'SELECIONAR IDIOMA - SELECT LANGUAGE',
['', 'Português', 'English']
)
if menu == 'Português':
st.title('Ponto de Pivot')
st.caption('Esta ferramenta utiliza o método LeandroStormer.')
stocks = [i[0] for i in data.read()]
stocks.insert(0, ' ')
stock = st.selectbox(
label='Escolha uma ação.',
options=stocks,
)
if stock != ' ':
with st.spinner('Calculando...'):
result = PivotPoint.calculate(stock)
sleep(3)
col9, col10, col11, col12, col13 = st.columns(5)
with col11:
st.metric(label='Ponto de Pivot',
value=result["pivot_point"])
col1, col2, col3, col4 = st.columns(4)
with col1:
st.metric(label='Resistência 1',
value=result["resistencia_1"])
with col2:
st.metric(label='Resistência 2',
value=result["resistencia_2"])
with col3:
st.metric(label='Resistência 3',
value=result["resistencia_3"])
with col4:
st.metric(label='Resistência 4',
value=result["resistencia_4"])
col5, col6, col7, col8 = st.columns(4)
with col5:
st.metric(label='Suporte 1',
value=result["suporte_1"])
with col6:
st.metric(label='Suporte 2',
value=result["suporte_2"])
with col7:
st.metric(label='Suporte 3',
value=result["suporte_3"])
with col8:
st.metric(label='Suporte 4',
value=result["suporte_4"])
elif menu == 'English':
st.title('Pivot Point')
st.caption('This tool uses the LeandroStormer method.')
stocks = [i[0] for i in data.read()]
stocks.insert(0, ' ')
stock = st.selectbox(
label='Search for a stock',
options=stocks,
)
if stock != ' ':
with st.spinner('Calculating...'):
result = PivotPoint.calculate(stock)
sleep(3)
col9, col10, col11, col12, col13 = st.columns(5)
with col11:
st.metric(label='Pivot Point',
value=result["pivot_point"])
col1, col2, col3, col4 = st.columns(4)
with col1:
st.metric(label='Resistance 1',
value=result["resistencia_1"])
with col2:
st.metric(label='Resistance 2',
value=result["resistencia_2"])
with col3:
st.metric(label='Resistance 3',
value=result["resistencia_3"])
with col4:
st.metric(label='Resistance 4',
value=result["resistencia_4"])
col5, col6, col7, col8 = st.columns(4)
with col5:
st.metric(label='Support 1',
value=result["suporte_1"])
with col6:
st.metric(label='Support 2',
value=result["suporte_2"])
with col7:
st.metric(label='Support 3',
value=result["suporte_3"])
with col8:
st.metric(label='Support 4',
value=result["suporte_4"])
if __name__ == '__main__':
run()