forked from CarlosGatti/bot-python-iq-option
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayout.py
More file actions
46 lines (34 loc) · 1.15 KB
/
payout.py
File metadata and controls
46 lines (34 loc) · 1.15 KB
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
from iqoptionapi.stable_api import IQ_Option
import time, configparser
arquivo_user = configparser.RawConfigParser()
arquivo_user.read('config_user.txt')
API = IQ_Option(arquivo_user.get('USER', 'user'), arquivo_user.get('USER', 'password'))
API.connect()
API.change_balance('PRACTICE') # PRACTICE / REAL
if API.check_connect():
print(' Conectado com sucesso!')
else:
print(' Erro ao conectar')
input('\n\n Aperte enter para sair')
sys.exit()
def best_payout(par, timeframe = 1):
par = par.upper()
tb = API.get_all_profit()
API.subscribe_strike_list(par, timeframe)
tentativas = 0
while True:
d = API.get_digital_current_profit(par, timeframe)
if d != False:
d = int(d)
break
time.sleep(1)
if tentativas == 5:
print('Não foi possivel capturar o payout')
d = 0
break
tentativas += 1
API.unsubscribe_strike_list(par, timeframe)
payout = {'binario': 0, 'digital': d}
payout['binario'] = int(100 * tb[par]['turbo']) if timeframe <= 5 else int(100 * tb[par]['binary'])
return 'binario' if payout['binario'] > payout['digital'] else 'digital'
print(best_payout('EURUSD', 5))