def main(): if not path.exists("iqdataset.csv"): with open("iqdataset.csv", 'w') as esc: esc.write("timestamp;varkandle\n") esc.close() else: pass iq = IQ_Option("","") # Login do user iq.set_max_reconnect(-1) if iq.check_connect(): while True: time.sleep(15) #Tempo para coletar, e sim, isso causa no resultado influência! try: goal = "EURUSD" # ATIVO size = 1 maxdict = 10 iq.start_candles_stream(goal, size, maxdict) cc = iq.get_realtime_candles(goal, 1) pp = pprint.PrettyPrinter(depth = 8) inti = cc tim = time.time() end_time = int(tim) - 0.8 end_cap = inti[int(end_time)]["min"] with open("iqdataset.csv", "a") as file: file = file.write(f"{end_time};{end_cap}\n") print(file) except Exception as e: print("ERRO:", e) continue if not iq.check_connect(): iq.connect() main()
def sign(email, password): error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" iqoption = IQ_Option(email, password) check, reason = iqoption.connect() MODE = 'PRACTICE' if check: print('\n') print("user " + email + " connected ") iqoption.change_balance(MODE) return iqoption #if see this you can close network for test elif iqoption.check_connect() == False: #detect the websocket is close print("try reconnect") check, reason = iqoption.connect() if check: print("Reconnect successfully") else: if reason == error_password: print("Error Password") else: print("No Network") else: if reason == "[Errno -2] Name or service not known": print("No Network") elif reason == error_password: print("Error Password")
def login(): init(autoreset=True) API = IQ_Option('*****@*****.**', 'Mohammedd2@') API.connect() if API.check_connect(): print(' Conectado com sucesso! \n') else: print(' Erro ao conectar') input('\n\n Aperte enter para sair') sys.exit() entrada(API)
def login_iqoption(): global API email = catalogator.lineEmail.text() senha = catalogator.lineSenha.text() print('Conectando....') API = IQ_Option(email, senha) API.connect() if API.check_connect(): catalogator.label_6.setText("Logado na Iq Option") else: catalogator.label_6.setText("Erro ao conecta")
def login_iqoption(): global API email_iq = catalogador.lineEmail.text() senha_iq = catalogador.lineSenha.text() API = IQ_Option(email_iq, senha_iq) print('Conectando....') API.connect() if API.check_connect(): print("Conectado") else: print("conectado")
def Conexao(): global API email = config['email'] senha = config['senha'] print('Conectando....') API = IQ_Option(email, senha) API.connect() if API.check_connect(): Clear_Screen() print('Conectado com sucesso!') else: print('Erro ao conectar') sys.exit()
def entrar(editEmail, editSenha): #print(editSenha.get()) API = IQ_Option(editEmail, editSenha) API.connect() API.change_balance("PRACTICE") #API.set_max_reconnect(5) while True: if API.check_connect() == False: print("Erro ao Conectar") API.reconnect() else: print("Conectado com sucesso!") tela_operacional(editEmail, editSenha) break time.sleep(5)
def getConnection(self): API = IQ_Option('login', 'senha') check, reason = API.connect() API.change_balance('PRACTICE') # PRACTICE / REAL while True: if API.check_connect() == False: print('Erro ao se conectar') API.connect() else: print('Conectado com sucesso') break time.sleep(1) return API
def conectar(self): global API try: API = IQ_Option(self.central.usuario, self.central.senha) API.connect() print('Conectou OK') #API.change_balance(self.central.tipoConta) while True: if API.check_connect() == False: return Mensagem().erroConectar #sys.exit() else: self.atualizaBanca() return Mensagem.sucessoConectar break except Exception as e: print(e)
def get_CandleResults(lista): returnedList = [] init(autoreset=True) API = IQ_Option('*****@*****.**', 'Fh006131__') check, reason=API.connect()#connect to iqoption API.change_balance('PRACTICE') # while True: if API.check_connect() == False: print('Erro ao se conectar') else: for l in lista: l = l.split(',') horario = datetime.strptime(l[0] + ":00", "%Y-%m-%dT%H:%M:%S") horario = datetime.timestamp(horario) if l[3] == "M5": velas = API.get_candles(l[1],300,3,int(horario)) elif l[3] == "M15": velas = API.get_candles(l[1],900,3,int(horario)) else: print ('Dado não lido. Incompatível!') for v in range(len(velas)): if int(velas[v]['from']) == int(horario): dir = 'call' if velas[v]['open'] < velas[v]['close'] else 'put' if velas[v]['open'] > velas[v]['close'] else 'doji' if dir == l[2].lower(): returnedList.append(l[0]+','+l[1]+','+l[2]+','+l[3]+'-✅') print(l[0],l[1],l[2],l[3],'|', Fore.GREEN + 'WIN') else: if int(velas[v]['from']) == int(horario): dir = 'call' if velas[v]['open'] < velas[v]['close'] else 'put' if velas[v]['open'] > velas[v]['close'] else 'doji' if dir == l[2].lower(): returnedList.append(l[0]+','+l[1]+','+l[2]+','+l[3]+'-✅1️⃣') print(l[0],l[1],l[2],l[3],'|', Fore.GREEN + 'WIN') else: if int(velas[v]['from']) == int(horario): dir = 'call' if velas[v]['open'] < velas[v]['close'] else 'put' if velas[v]['open'] > velas[v]['close'] else 'doji' if dir == l[2].lower(): returnedList.append(l[0]+','+l[1]+','+l[2]+','+l[3]+'-✅2️⃣') print(l[0],l[1],l[2],l[3],'|', Fore.GREEN + 'WIN') else: returnedList.append(l[0]+','+l[1]+','+l[2]+','+l[3]+'-❌') print(l[0],l[1],l[2],l[3],'|', Fore.RED + 'LOSS')
def test_Candle(self): #login I_want_money = IQ_Option(email, password) I_want_money.change_balance("PRACTICE") I_want_money.reset_practice_balance() self.assertEqual(I_want_money.check_connect(), True) #start test binary option ALL_Asset = I_want_money.get_all_open_time() if ALL_Asset["turbo"]["EURUSD"]["open"]: ACTIVES = "EURUSD" else: ACTIVES = "EURUSD-OTC" I_want_money.get_candles(ACTIVES, 60, 1000, time.time()) #realtime candle size = "all" I_want_money.start_candles_stream(ACTIVES, size, 10) I_want_money.get_realtime_candles(ACTIVES, size) I_want_money.stop_candles_stream(ACTIVES, size)
def CreateAndManageLoginWindow(): telaLogin = TelaLogin() if telaLogin.event == sg.WIN_CLOSED: telaLogin.window.close() exit() api = IQ_Option(str(telaLogin.values[0]), str(telaLogin.values[1])) #api = IQ_Option("*****@*****.**", "*****@*****.**") api.connect() telaLogin.window.close() while api.check_connect() == False: layout = [[ sg.Text( 'Login falhou, verifique se colocou o email/senha corretos') ], [sg.Text('Login'), sg.Input()], [sg.Text('Senha'), sg.Input(password_char="*")], [sg.Submit("logar")]] telaLogin.window = sg.Window("iqOption Bot").layout(layout) telaLogin.event, telaLogin.values = telaLogin.window.Read() api = IQ_Option(str(telaLogin.values[0]), str(telaLogin.values[1])) api.connect() telaLogin.window.close() return api
def test_binary_option(self): #login I_want_money = IQ_Option(email, password) I_want_money.change_balance("PRACTICE") I_want_money.reset_practice_balance() self.assertEqual(I_want_money.check_connect(), True) #start test binary option ALL_Asset = I_want_money.get_all_open_time() if ALL_Asset["turbo"]["EURUSD"]["open"]: ACTIVES = "EURUSD" else: ACTIVES = "EURUSD-OTC" Money = 1 ACTION_call = "call" #or "put" expirations_mode = 1 check_call, id_call = I_want_money.buy(Money, ACTIVES, ACTION_call, expirations_mode) self.assertTrue(check_call) self.assertTrue(type(id_call) is int) I_want_money.sell_option(id_call) ACTION_call = "put" check_put, id_put = I_want_money.buy(Money, ACTIVES, ACTION_call, expirations_mode) self.assertTrue(check_put) self.assertTrue(type(id_put) is int) I_want_money.sell_option(id_put) I_want_money.check_win_v2(id_put) I_want_money.get_binary_option_detail() I_want_money.get_all_profit() isSuccessful, dict = I_want_money.get_betinfo(id_put) self.assertTrue(isSuccessful) I_want_money.get_optioninfo(10)
from iqoptionapi.stable_api import IQ_Option import logging import time # logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s') Iq = IQ_Option("*****@*****.**", "aswdkl;123") # Iq = IQ_Option(content['email'], content['password']) Iq.connect() Money = [] ACTIVES = [] ACTION = [] expirations_mode = [] res = Iq.get_balance() print(res) print(Iq.check_connect()) Money.append(1) ACTIVES.append("EURUSD") ACTION.append("call") #put expirations_mode.append(1) Money.append(1) ACTIVES.append("EURAUD") ACTION.append("call") #put expirations_mode.append(1) print("buy multi") id_list = Iq.buy_multi(Money, ACTIVES, ACTION, expirations_mode) print("check win only one id (id_list[0])") print(Iq.check_win_v2(id_list[0], 2))
from iqoptionapi.stable_api import IQ_Option #API import sys, time #Bibliotecas para encerrar caso necessário e para pegar o tempo from datetime import datetime #Importa data e tempo dados = IQ_Option('*****@*****.**', 'A7Kmx1q2w3e') dados.connect() if dados.check_connect(): print('Conectado com sucesso!') else: print(' Erro ao conectar') input('\n\n Aperte enter para sair') sys.exit() def carregarsinais(): # Carrega os sinais arquivo = open('sinais.txt', 'r') #Abre o arquivo lista = arquivo.readlines() #Lê o arquivo for i, a in enumerate(lista): #Enumera os elementos if a == '': del lista[i] return str(lista) arquivo.close() #Fecha o arquivo a = carregarsinais() #Executa a função carregarsinais() dad = a.split(', ') #Coloca em array cada elemento separado por (', ')
error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" iqoption = IQ_Option(sys.argv[1], sys.argv[2]) check, reason = iqoption.connect() url = 'http://localhost:8081/check/' if check: req = requests.post(url, headers={'Authorization': sys.argv[3]}, json={ 'status': 'ok', 'email': sys.argv[1], 'password': sys.argv[2] }) print(json.dumps(req.json()['data'])) exit() while True: if iqoption.check_connect() == False: #detect the websocket is close print("try reconnect") check, reason = iqoption.connect() if check: print("Reconnect successfully") else: if reason == error_password: print("Error Password") else: print("No Network") else: if reason == "[Errno -2] Name or service not known": print(json.dumps({'status': 'error'})) exit() elif reason == error_password:
from iqoptionapi.stable_api import IQ_Option os.system('clear') ## INITIALIZE PART ## # Connecting to IQ server. # allow to logging. # logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s') # iq option setting. iq = IQ_Option('*****@*****.**', '5big09oN') mode = 'PRACTICE' # allow unlimited reconnect, (_) number of reconnection. iq.set_max_reconnect(-1) # Check connection. while iq.check_connect() == False: # detect the websocket is close print("try reconnect") iq.connect() # try to connect print("reconnect Success") time.sleep(1) # send status updated. print("\n\n\tConnection Success.\n\n") print('\nWorking in \"' + mode + ' MODE\"\n') # check balance and change mode. iq.change_balance(mode) balance = float(str(iq.get_balance())) currency_pair = { 'EURUSD', 'USDJPY', 'GBPUSD', 'USDCHF', 'EURJPY', 'USDCAD', 'AUDUSD' }
currency_char address created postal_index gender birthdate balance ''' def banca(): return API.get_balance() # Verificando a conexão com o servidor if (API.check_connect() != True): print('A conexão não foi estabelecida\nVerifique suas credenciais.') print(API.check_connect()) else: print('A conexão com a plataforma foi estabelecida com sucesso.') print(API.check_connect()) # Desenvolvendo modo_da_conta = 'PRACTICE' preco_fixo = [100, 70, 50] paridades = ['EURNZD', 'EURAUD', 'EURJPY'] acoes = ['put', 'call', 'call'] duracao = [0.0, 0.0, 0.0] duracao_m1 = 1 print(perfil()) # while(API.check_connect()==True):
def main(): config = configparser.RawConfigParser() config.read('cnf.ini') global email email = formulario.email.text() config.set('GERAL', 'email', str(email)) cfgfile = open('cnf.ini', 'w') config.write(cfgfile, space_around_delimiters=False) cfgfile.close() API = IQ_Option(email, formulario.senha.text()) API.connect() while True: if API.check_connect() == False: formulario.plainTextEdit_2.addItem('Erro ao se conectar!') API.connect() else: formulario.plainTextEdit_2.addItem('Conectado com sucesso!') formulario.pushButton.setText('Robo Iniciado com Sucesso!') formulario.pushButton.setEnabled(False) formulario.comboBox.setEnabled(False) formulario.senha.setEnabled(False) formulario.email.setEnabled(False) formulario.delay.setEnabled(False) formulario.payout.setEnabled(False) formulario.gales.setEnabled(False) formulario.stopgain.setEnabled(False) formulario.stoploss.setEnabled(False) formulario.primeira.setEnabled(False) formulario.segunda.setEnabled(False) formulario.terceira.setEnabled(False) formulario.pushButton_2.setEnabled(False) break time.sleep(1) API.change_balance(conta) def banca(): return round(API.get_balance(), 2) global saldo, saldo_mov saldo = banca() saldo_mov = saldo formulario.banca.setText(str(saldo)) time.sleep(1) def Mensagem(msg): formulario.plainTextEdit_2.addItem(msg) def Payout(par, timeframe): API.subscribe_strike_list(par, timeframe) while True: d = API.get_digital_current_profit(par, timeframe) if d > 0: break time.sleep(1) API.unsubscribe_strike_list(par, timeframe) return float(d / 100) def carregar_sinais(): arquivo = open('sinais.txt', encoding='UTF-8') lista = arquivo.read() arquivo.close lista = lista.split('\n') for index, a in enumerate(lista): if a == '': del lista[index] return lista def HoraAtual(): hora = datetime.now() tm = tz.gettz('America/Sao Paulo') hora_atual = hora.astimezone(tm) return hora_atual.strftime('%H:%M:%S') def CalculaStop(valor_mov): global stop global stop_mensagem global saldo_mov saldo_mov = abs(saldo_mov + valor_mov) if (saldo + int(stopgain)) <= saldo_mov: stop = True stop_mensagem = 'Stop Win: ' + str(round((saldo_mov - saldo), 2)) elif (saldo - int(stoploss)) >= saldo_mov: stop = True stop_mensagem = 'Stop Loss: ' + str(round((saldo_mov - saldo), 2)) def entradas(par, entrada, direcao, config, timeframe): status, id = API.buy(int(entrada), par, direcao, int(timeframe)) if status: lucro = API.check_win_v3(id) if lucro: if lucro > 0: return 'win', round(lucro, 2) elif lucro < 0: return 'loss', 0 elif lucro == 0: return 'equal', 0 ''' resultado,lucro = API.check_win_v3(id) if resultado: if resultado == 'win': return 'win',round(lucro, 2) elif resultado == 'loose': return 'loss',0 elif resultado == 'equal': return 'equal',0 ''' else: return 'error', 0 def IniciaTrade(): sinais = carregar_sinais() Mensagem('') Mensagem('Moedas a serem operadas:') for y in sinais: Mensagem(y.split(';')[0].upper() + ' / ' + y.split(';')[2]) for x in sinais: timeframe = x.split(';')[4].upper() par = x.split(';')[0].upper() dia = x.split(';')[1] minutos_lista = x.split(';')[2] direcao = x.split(';')[3].lower().replace('\n', '') minutos_lista_delay = format( datetime.strptime(minutos_lista, '%H:%M:%S') - timedelta(seconds=int(delay)), "%H:%M:%S") dia_atual = format(datetime.now(), '%d') if dia_atual > dia: Mensagem('Dia informado é menor que o dia atual!') break if stop: Mensagem('') Mensagem(stop_mensagem) break while True: minutos = HoraAtual() if minutos_lista_delay < minutos: break if minutos > minutos_lista_delay: break entrar = True if (minutos_lista_delay == minutos) else False if entrar: if True: Mensagem('') Mensagem('Iniciando Operaçao') Mensagem('Paridade: ' + par + ' / ' + 'Horario: ' + str(minutos_lista)) resultado, lucro = entradas(par, primeira_entrada, direcao, config, timeframe) Mensagem('Paridade: ' + par + ' -> ' + resultado + ' / ' + str(lucro)) if resultado == 'error': break if resultado == 'win': CalculaStop(lucro) break ''' if stop: mensagem_stop = '\n\nStop '+ resultado.upper() + ' batido!' Mensagem(mensagem_stop) sys.exit() ''' if resultado == 'loss' and int(gales) > 0: CalculaStop(int(primeira_entrada) * -1) valor_entrada = segunda_entrada for i in range( int(gales) if int(gales) > 0 else 1): Mensagem('Entrada Martingale Nivel ' + str(i + 1) + ' - ' + HoraAtual()) resultado, lucro = entradas( par, valor_entrada, direcao, config, timeframe) Mensagem('Resultado Martingale, Paridade: ' + par + ' -> ' + resultado + ' / ' + str(lucro)) if resultado == 'win': CalculaStop(lucro) break else: CalculaStop(int(valor_entrada) * -1) valor_entrada = terceira_entrada break else: break time.sleep(0.1) Mensagem('') formulario.plainTextEdit_2.addItem('Lista Finalizada!') #sys.exit() threading.Thread(target=IniciaTrade).start()
break else: print('Não conectado, tente novamente!') time.sleep(1) os.system('cls') modo = input('Tipo de conta (REAL OU PRACTICE): ') account.change_balance(modo) count = 1 #Contador value = int(input('Valor para negocição: ')) lag = int(input('Delay: ')) otc = input("Operar OTC s/n: ") print('\n\t\t\t\t\t REGEX-BOT\n') while True: if (account.check_connect() == False): print('Nao conectado, tentando de novo...!') else: print('Conectado, executando a lista!') break data = open("sinais.txt").read() #Abre Sinais.txt data = re.sub(r" ", "", data) #Apaga os espaços da lista de sinais, caso exista algum data = re.sub(r"(^[\S\s]+$)", r"\1\n\nM1\nXXXX\n\nM5\nXXXX\n\nM15\nXXXX\n\nM30\nXXXX\n\n", data) #Adiciona itens ao fim da string para evitar exceções sinal = re.findall(r"(\d{2}?/\d{2}?/\d{4}?.+)", data) #Cria array com todos os sinais expiration = [] #Cria array com a expiração de cada sinal
API = IQ_Option('', '') API.connect() API.change_balance('PRACTICE') # PRACTICE / REAL global VERIFICA_BOT, TELEGRAM_ID config = configuracao() config['banca_inicial'] = banca() VERIFICA_BOT = config['usar_bot'] TELEGRAM_ID = config['telegram_id'] if VERIFICA_BOT == 'S': bot = telegram.Bot(token=config['telegram_token']) if API.check_connect(): print(' Conectado com sucesso!') else: print(' Erro ao conectar') input('\n\n Aperte enter para sair') sys.exit() valor_entrada = 1.8 valor_entrada_b = float(valor_entrada) lucro = 0 sinais = carregaSinais() # while True: # minutos = (((datetime.now()).strftime('%H:%M:%S'))[1:])
class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) self.setupUi(self) self._generator = None self._timerId = None sys.stdout = EmittingStream(textWritten=self.normalOutputWritten) self.sinais_usados = [] self.opcaoBinaria = 'live-deal-binary-option-placed' # Binária self.filtro = [] self.lucro = 0 self.pushButton_login.clicked.connect(self.logar) self.pushButton_chooseFile.clicked.connect(self.getFiles) self.comboBox_chooseMode.activated.connect(self.getComboValue) self.realOrTraining = ['Treinamento', 'Conta Real'] self.comboBox_chooseMode.addItems(self.realOrTraining) self.opcoesListCopy = ['COPIAR ENTRADAS', 'CARREGAR LISTA'] self.comboBox_listaCopy.addItems(self.opcoesListCopy) self.comboBox_listaCopy.activated.connect(self.listaOuCopy) self.countries = ['Mundo','África do Sul', 'Brasil', 'Colômbia' ,'Índia','Tailândia',] self.comboBox_chooseCountry.addItems(self.countries) self.comboBox_chooseCountry.activated.connect(self.chooseCountry) self.check_porcentagem.stateChanged.connect(self.setarPorcentagem) self.pushButton_start.clicked.connect(self.start) self.pushButton_stop.clicked.connect(self.stop) self.lineEdit_senha.returnPressed.connect(self.logar) self.listaOuCopy() self.show() def setarPorcentagem(self): if self.check_porcentagem.isChecked() == True: print('Você selecionou valor em porcentagem.') else: print('Você selecionou valor unitário.') def logar(self): self.email=str(self.lineEdit_email.text()) self.senha=str(self.lineEdit_senha.text()) self.API = IQ_Option(self.email, self.senha) self.API.connect() if not self.API.check_connect(): print('Erro na conexão. Tente novamente.') self.label_13.setText("Erro na conexão") self.label_13.setStyleSheet("color: #FF0000;") else: print('Conectado com sucesso!') self.label_13.setText("Conectado") self.label_13.setStyleSheet("color: #08F26E;") self.comboBox_chooseMode.setCurrentIndex(0) self.API.change_balance('PRACTICE') self.label_banca.setText(str(self.API.get_balance())) def listaOuCopy(self): if self.comboBox_listaCopy.currentIndex() == 0: self.spinBox_ranking.show() self.spinBox_ranking1.show() self.label_26.show() self.label_28.show() self.label_29.show() self.radioButton_Copy.show() self.comboBox_chooseCountry.show() self.spinBox_rankingFixo.show() self.radioButton_Posicao.show() self.spinBox_valorMin.show() self.label_30.show() self.label_5.hide() self.label_8.hide() self.pushButton_chooseFile.hide() elif self.comboBox_listaCopy.currentIndex() == 1: self.label_5.show() self.label_8.show() self.pushButton_chooseFile.show() self.spinBox_ranking.hide() self.spinBox_ranking1.hide() self.label_26.hide() self.label_28.hide() self.label_29.hide() self.label_30.hide() self.radioButton_Copy.hide() self.comboBox_chooseCountry.hide() self.spinBox_valorMin.hide() self.spinBox_rankingFixo.hide() self.radioButton_Posicao.hide() def timestampConverter(self, time): hora = datetime.strptime(datetime.utcfromtimestamp(time).strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S') hora = hora.replace(tzinfo=tz.gettz('GMT')) return str(hora.astimezone(tz.gettz('America/Sao Paulo')))[:-6] def timestampConverterCopy(self, x, y, z): timestamp1, ms1 = divmod(x, 1000) timestamp2, ms2 = divmod(y, 1000) timestamp3, ms3 = divmod(z, 1000) entradacodt = datetime.fromtimestamp(timestamp1) + timedelta(milliseconds=ms1) expiracaodt = datetime.fromtimestamp(timestamp2) + timedelta(milliseconds=ms2) horaatualdt = datetime.fromtimestamp(timestamp3) + timedelta(milliseconds=ms3) entradaco = entradacodt.strftime('%Y-%m-%d %H:%M:%S') expiracao = expiracaodt.strftime('%Y-%m-%d %H:%M:%S') horaatual = horaatualdt.strftime('%Y-%m-%d %H:%M:%S') mintime1 = timedelta(milliseconds=x) mintime2 = timedelta(milliseconds=y) mintime3 = timedelta(milliseconds=z) min1 = mintime1.seconds min2 = mintime2.seconds min3 = mintime3.seconds exptime = min2 - min1 delaytime = min3 - min1 expminutes = (exptime % 3600) // 60 if expminutes == 0: expminutes = 1 return [entradaco, expiracao, horaatual, expminutes, delaytime] def chooseCountry(self): if self.comboBox_chooseCountry.currentIndex() == 0: print('Você mudou para o Ranking Mundial.') self.country = "Worldwide" elif self.comboBox_chooseCountry.currentIndex() == 1: print('Você mudou para o Ranking Sul-Africano.') self.country = "SA" elif self.comboBox_chooseCountry.currentIndex() == 2: print('Você mudou para o Ranking Brasileiro.') self.country = "BR" elif self.comboBox_chooseCountry.currentIndex() == 3: print('Você mudou para o Ranking Colombiano.') self.country = "CO" elif self.comboBox_chooseCountry.currentIndex() == 4: print('Você mudou para o Ranking Indiano.') self.country = "IN" elif self.comboBox_chooseCountry.currentIndex() == 5: print('Você mudou para o Ranking Tailândes.') self.country = "TH" def filtroRanking(self, country, numeroInicial, numeroFinal): self.filtro.clear() while True: try: ranking = self.API.get_leader_board(self.country, self.numeroInicial, self.numeroFinal, 0) for n in ranking['result']['positional']: id = ranking['result']['positional'][n]['user_id'] self.filtro.append(id) except: pass time.sleep(180) #Atualiza Ranking a cada 3 minutos. def ajustesEntradaBinaria(self, ti): global lastplayer trades = self.API.get_live_deal(ti) for trade in list(trades): if self.check_porcentagem.isChecked() == True: self.valor_entrada = (int(self.spinBox_gerenciamento.value()))*(float(self.spinBox_valueEntry.value()/100)) else: self.valor_entrada = float(self.spinBox_valueEntry.value()) self.valorMin = int(self.spinBox_valorMin.value()) self.mGale = int(self.spinBox_martingale.value()) entradacopy = trade['created_at'] expiracao = trade['expiration'] horalocal = int(datetime.now(tz=timezone.utc).timestamp() * 1000) timecopy = self.timestampConverterCopy(entradacopy, expiracao, horalocal) if lastplayer != trade['user_id'] and trade['amount_enrolled'] >= int(self.valorMin) and int(timecopy[3]) < 20 and int(timecopy[4]) < 3: if trade['user_id'] in self.filtro: lastplayer = trade['user_id'] ativo = list(ACTIVES.keys())[list(ACTIVES.values()).index(trade['active_id'])] print("\nNOME: "+str(trade['name'])+" | PAÍS: "+str(trade['flag'])+" | $ "+str(trade['amount_enrolled'])+"\n"+ trade['direction'].upper() + " | " +str(ativo)+" | "+str(timecopy[0])) print("SUA ENTRADA: $ "+str(round(self.valor_entrada, 2))+" | DELAY: "+str(timecopy[4] + 1)+"s") bcall = Thread(target=self.entrada, args=(self.valor_entrada, str(ativo), trade['direction'], int(timecopy[3]), horalocal, self.mGale)) bcall.start() trades.clear() def comecarCopy(self): self.API.subscribe_live_deal(self.opcaoBinaria, 10) if self.radioButton_Copy.isChecked() == True: self.numeroInicial=int(self.spinBox_ranking.value()) self.numeroFinal=int(self.spinBox_ranking1.value()) else: self.numeroInicial=int(self.spinBox_ranking.value()) self.numeroFinal=int(self.spinBox_ranking.value()) if self.numeroInicial == self.numeroFinal: print("Carregando entradas do Top " + str(self.numeroInicial)) elif self.numeroInicial != self.numeroFinal: print("Carregando entradas do Top "+ str(self.numeroInicial) + " ao " + str(self.numeroFinal) +".") catalogo = Thread(target=self.filtroRanking, args=(self.country, self.numeroInicial, self.numeroFinal)) catalogo.daemon = True catalogo.start() while True: self.ajustesEntradaBinaria(self.opcaoBinaria) yield self.API.unscribe_live_deal(self.opcaoBinaria) def getFiles(self): self.filename = QFileDialog.getOpenFileName(None, 'Select a file', '', '*.txt') self.path = self.filename[0] with open(self.path, "r") as f: self.text = f.read() self.textEdit_output.setText(self.text) def carregarSinais(self): with open(self.path, "r") as f: self.text = f.read() self.textEdit_output.setText(self.text) f.close() self.text = self.text.split('\n') for index, a in enumerate(self.text): if a == '': del self.text[index] return self.text def normalOutputWritten(self, textw): cursor = self.textEdit_terminal.textCursor() cursor.movePosition(QTextCursor.End) cursor.insertText(textw) self.textEdit_terminal.setTextCursor(cursor) self.textEdit_terminal.ensureCursorVisible() def stopWL(self, lucro, gain,loss): if self.lucro <= float('-' + str(abs(loss))): print('Stop Loss batido!') self.stop() if self.lucro >= float(abs(gain)): print('Stop Win batido!') self.stop() def stopWLM(self, lucro, gain,loss): if self.lucro <= float('-' + str(abs(loss))): sys.exit() if self.lucro >= float(abs(gain)): sys.exit() def meucheckwin(self, id_number): while True: stat, lista = self.API.get_position_history_v2('turbo-option', 15, 0, 0, 0) #15 é a quantidade de orders passadas quiser puxar. Pode por quantas quiser. xindex = next((index for (index, d) in enumerate(lista['positions']) if d['raw_event']['option_id'] == id_number), -1) if xindex >=0: x = list(lista['positions']) lucro = x[xindex]['close_profit'] invest = x[xindex]['invest'] resultado = lucro - invest return resultado break def entrada(self, valor, par_moedas, acao_entrada, expiracao, hora_operacao, gale): status, id_order = self.API.buy(valor, par_moedas, acao_entrada, expiracao) print(id_order) if status: resultado = self.meucheckwin(id_order) self.lucro += round(resultado, 2) if self.check_porcentagem.isChecked() == True: self.stopWin = (float(self.spinBox_gerenciamento.value()))*(float(int(self.spinBox_stopWin.value())/100)) self.stopLoss = (float(self.spinBox_gerenciamento.value()))*(float(int(self.spinBox_stopLoss.value())/100)) else: self.stopWin = float(self.spinBox_stopWin.value()) self.stopLoss = float(self.spinBox_stopLoss.value()) if resultado > 0 : print('\n✅ WIN | ' + 'LUCRO: $ ' + str(round(resultado, 2)) + ' | ' + str(acao_entrada.upper()) + ' ' + str(par_moedas)) elif resultado == 0: print('\nEMPATE | ' + 'LUCRO: $ ' + str(round(resultado, 2)) + ' | ' + str(acao_entrada.upper()) + ' ' + str(par_moedas)) elif resultado < 0: print('\n❌ LOSS | ' + 'LUCRO: $ ' + str(round(resultado, 2)) + ' | ' + str(acao_entrada.upper()) + ' ' + str(par_moedas)) self.stopWL(self.lucro, self.stopWin, self.stopLoss) if resultado < 0 and gale > 0: valor_com_martingale = (valor * 2.2) self.stopWLM(self.lucro, self.stopWin, self.stopLoss) print('\n🔁 MARTINGALE ' + str(gale) + ' | VALOR: $ ' + str(round(valor_com_martingale, 2)) + ' | ' + acao_entrada.upper() + ' ' + par_moedas) gale = gale - 1 Thread(target=self.entrada, args=(valor_com_martingale, par_moedas, acao_entrada, expiracao, self.timestampConverter(self.API.get_server_timestamp()), gale,)).start() return True return True else: print('Não foi possivel realizar a sua entrada.') return False def martinGale(self, tipo, valor): if tipo == 'auto': return valor * 2.2 def loopGenerator(self): while True: self.agora = self.timestampConverter(self.API.get_server_timestamp()) for sinal in self.text: dados = sinal.split(',') if dados[0] == self.agora and sinal not in self.sinais_usados: self.sinais_usados.append(sinal) valor_entrada = (float(self.spinBox_gerenciamento.value()))*(float(self.spinBox_valueEntry.value()/100)) par = dados[1] acao = dados[2].lower() expiracao = int(dados[3]) gale = int(self.spinBox_martingale.value()) print('\n' + acao.upper() + ' | ' + par + ' | ' + self.agora + '\nSUA ENTRADA: $ ' + str(valor_entrada)) Thread(target=self.entrada, args=(valor_entrada, par, acao, expiracao, dados[0], gale,)).start() yield def start(self): if self.comboBox_listaCopy.currentIndex() == 0: print('Aplicação inicializada!') self.stop() # Stop any existing timer self._generator = self.comecarCopy() # Start the loop self._timerId = self.startTimer(0) else: self.text = self.carregarSinais() print('Aplicação inicializada!') print('Sinais prontos! Aguardando hora de entrada.') self.stop() # Stop any existing timer self._generator = self.loopGenerator() # Start the loop self._timerId = self.startTimer(0) def stop(self): if self._timerId is not None: print('Aplicação parada!') self.killTimer(self._timerId) self.label_banca.setText(str(self.API.get_balance())) self._generator = None self._timerId = None def timerEvent(self, event): # This is called every time the GUI is idle. if self._generator is None: return try: next(self._generator) # Run the next iteration except StopIteration: self.stop() def getComboValue(self): if self.comboBox_chooseMode.currentIndex(): print('Você mudou para a Conta Real.') self.API.change_balance('REAL') self.label_banca.setText(str(self.API.get_balance())) elif self.comboBox_chooseMode.currentIndexChanged: print('Você mudou para a Conta de Treinamento.') self.API.change_balance('PRACTICE') self.label_banca.setText(str(self.API.get_balance()))
} conta_config = conta_config() sinais_usados = [] print('Conectando sua conta ...') API = IQ_Option(conta_config['email'], conta_config['senha']) API.connect() print('Servidor conectado! Configurando banca') API.change_balance('PRACTICE') # PRACTICE / REAL print('Banca configurada') retry_connect = 0 while True: if not API.check_connect(): print('Erro ao se conectar') else: print('Conectado com sucesso') time.sleep(0.5) retry_connect = 0 break retry_connect = retry_connect + 1 print('tentando reconectar [' + str(retry_connect) + ']') if retry_connect >= 5: break time.sleep(1)
print('ERRO AO REALIZAR ENTRADA!!') time.sleep(1) if status: print( f'\n INICIANDO OPERAÇÃO {str(id)}..\n {str(horario)} | {par} | OPÇÃO: {opcao.upper()} | DIREÇÃO: {direcao.upper()} | M{timeframe} | PAYOUT: {payout}%\n\n' ) Mensagem( f'INICIANDO OPERAÇÃO {str(id)}..\n {str(horario)} | {par} | OPÇÃO: {opcao.upper()} | DIREÇÃO: {direcao.upper()} | M{timeframe} | PAYOUT: {payout}%' ) API.connect() API.change_balance(config['conta']) while True: if API.check_connect() == False: print('>> Erro ao se conectar!\n') input(' Aperte enter para sair') sys.exit() else: print( f'>> Conectado com sucesso!\n {Fore.RED}VENDA DO BOT PROIBIDA!!!\n' ) banca() config['banca_inicial'] = valor_da_banca print( f"{Fore.LIGHTBLUE_EX}Saldo da conta {'demo' if account_type == 'PRACTICE' else 'real'}: {account_balance}" ) break try: buscarMenor()
datetime.utcfromtimestamp(x).strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S') hora = hora.replace(tzinfo=tz.gettz('GMT')) return hora API = IQ_Option('login', 'senha') API.connect() API.change_balance('PRACTICE') ajuste_hora = 0 ajuste_minuto = 0 while True: if (not API.check_connect()): API.connect() else: print("Conectou") break time.sleep(5) def stop(lucro, gain, loss): if lucro <= float('-' + str(abs(loss))): print('Stop Loss batido!') sys.exit() if lucro >= float(abs(gain)): print('Stop Gain Batido!') sys.exit()
import sys import time import datetime import requests import random import sqlite3 from iqoptionapi.stable_api import IQ_Option import iqconfig import api as upload api = IQ_Option('*****@*****.**', 'nephilin890') api.connect() while True: if api.check_connect() == False: print("Erro ao conectar!") api.connect() else: print("Conectado com sucesso!") break print() def main(): opens = [] opensPar = api.get_all_open_time() for openPar in opensPar['binary']: if opensPar['binary'][openPar]['open'] == True:
user = '' password = '' os.system('cls') concx = False matrix() home() login() while (concx == False): banner2() t = controle(user, password) user, password = t logging.disable(level=(logging.DEBUG)) IQ = IQ_Option(user, password) IQ.connect() if IQ.check_connect() == False: banner2() for i in range(42): time.sleep(0.1) sys.stdout.write("\rConectando: %d%%" % i) while (i > 101): os.system('cls') sys.stdout.flush() print('\nErro ao se conectar...') ContConct += 1 time.sleep(2) if (ContConct == 4): banner2() print('Verfique sua conexão com a internet ou seu e-mail/senha...') print('Por questões de segurança o sistema será encerrado!') time.sleep(7)
class MHI: def __init__(self, email, password): self.API = IQ_Option(email, password) self.config = configuration.getConfig() self.connection() def connection(self): self.API.connect() self.API.change_balance('PRACTICE') if self.API.check_connect(): print(' Conectado com sucesso!') else: print(' Erro ao conectar') sys.exit() def stop(self, lucro): if lucro <= float(-1 * abs(self.config['stop_loss'])): print('Stop Loss batido!') sys.exit() if lucro >= float(abs(self.config['stop_gain'])): print('Stop Gain Batido!') sys.exit() def Martingale(self, valor, payout): lucro_esperado = valor * payout perca = float(valor) while True: if round(valor * payout, 2) > round( abs(perca) + lucro_esperado, 2): return round(valor, 2) break valor += 0.01 def Payout(self, par=''): if par.strip() != '': self.API.subscribe_strike_list(par, 1) while True: d = self.API.get_digital_current_profit(par, 1) if d != False: d = round(int(d) / 100, 2) break time.sleep(1) self.API.unsubscribe_strike_list(par, 1) return d def isTime(self): minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) return True if (minutos >= 4.58 and minutos <= 5) or minutos >= 9.58 else False def getColors(self): velas = self.API.get_candles(self.config['par'], 60, 3, time.time()) retorno = '' for i in range(len(velas)): if velas[i]['open'] < velas[i]['close']: retorno += 'g' elif velas[i]['open'] > velas[i]['close']: retorno += 'r' else: retorno += 'd' return retorno def getDirection(self, cores): dir = False if cores.count('g') > cores.count('r') and cores.count('d') == 0: dir = ('put' if self.config['tipo_mhi'] == 1 else 'call') if cores.count('r') > cores.count('g') and cores.count('d') == 0: dir = ('call' if self.config['tipo_mhi'] == 1 else 'put') return dir def buyParity(self, dir): if self.config['operacao'] == 1: return self.API.buy_digital_spot(self.config['par'], self.config['valor_entrada'], dir, 1) else: return self.API.buy(self.config['valor_entrada'], self.config['par'], dir, 1) def finishTrade(self, id): finish = (True, 0) if self.config['operacao'] == 1: finish = self.API.check_win_digital_v2(id) else: finish = (True, self.API.check_win_v3(id)) return finish def startTrade(self, dir, payout): lucro = 0 print('iniciando trader') self.config['valor_entrada'] = self.config['valor_entrada_b'] for i in range(self.config['martingale']): if i > 2: dir = 'put' if dir == 'call' else 'call' buy, id = self.buyParity(dir) if buy: print('Compra efetuada') while True: try: finish, valor = self.finishTrade(id) except: finish = True valor = 0 if finish: print('Operaçao Finalizada') valor = valor if valor > 0 else float( -1 * abs(self.config['valor_entrada'])) lucro += round(valor, 2) self.config['valor_entrada'] = self.Martingale( self.config['valor_entrada'], payout) self.stop(lucro) break if valor > 0: break def start(self): self.config['valor_entrada_b'] = self.config['valor_entrada'] print("Aguardando o horario.") while True: horas = self.isTime() payout = self.Payout(self.config['par']) if payout < (self.config['payout'] / 100): print(f'Payout abaixo do minimo permitido: {payout}') break if horas: cores = self.getColors() dir = self.getDirection(cores) if dir: self.startTrade(dir, payout) time.sleep(0.5)
class IQ: def __init__(self): self.api = IQ_Option(os.environ["IQU"], os.environ["IQP"]) self.api.connect() self.api.change_balance(ARG_BALANCE) self.currency = ARG_CURRENCY while True: if self.api.check_connect() == False: print('Erro ao conectar') self.api.connect else: print('Conectado com Sucesso') break time.sleep(3) def getCurrency(self): return self.currency def getBalance(self): return self.api.get_balance() def getEnterValue(self): banca = self.getBalance() bancaFloor = math.floor(banca / 40) return bancaFloor if int(banca) > 40 else 2.0 # Limited to $USD 2 def getServerDatetime(self): serverTime = self.api.get_server_timestamp() hora = datetime.strptime( datetime.utcfromtimestamp(serverTime).strftime( '%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S') return hora.replace(tzinfo=tz.gettz('GMT')) def getCandles(self, rangeTime=60, quant=10): return self.api.get_candles(self.currency, rangeTime, quant, self.api.get_server_timestamp()) def buyDigital(self, direction): return self.api.buy_digital_spot(self.currency, self.getEnterValue(), direction, ARG_DURATION) def checkResult(self, id): return self.api.check_win_digital_v2(id) def shouldEntry(self): serverTime = self.getServerDatetime() # minutes = float(serverTime.strftime('%M.%S')[1:]) # return True if (minutes >= 4.58 and minutes <= 5) or minutes >= 9.58 else False seconds = int(serverTime.strftime('%S')) if seconds < 20: time.sleep(20) elif seconds < 30: time.sleep(10) goTrade = True if (seconds >= 48 and seconds <= 50) or seconds >= 58 else False if goTrade == False: time.sleep(1) return goTrade
import time import requests from bs4 import BeautifulSoup from selenium import webdriver from iqoptionapi.stable_api import IQ_Option dados = IQ_Option('*****@*****.**','A7Kmx1q2w3e') dados.connect() if dados.check_connect(): print('Conectado com sucesso ! ') else: print('Falha na conexão. Tente novamente! ') OpenAssets = dados.get_all_open_time() #Pega os dados na corretora de ativos abertos ativos = ['USD/JPY','USD/CAD','USD/CHF','EUR/USD','EUR/AUD','EUR/NZD','EUR/GBP','EUR/JPY','EUR/CAD','AUD/JPY','AUD/USD','AUD/CAD','GBP/USD','GBP/AUD','GBP/JPY','GBP/CAD','GBP/NZD','CAD/JPY','CAD/CHF'] print('Quantidade de ativos que eu pré determinei : ',len(ativos)) ativosF = ['USDJPY','USDCAD','USDCHF','EURUSD','EURAUD','EURNZD','EURGBP','EURJPY','EURCAD','AUDJPY','AUDUSD','AUDCAD','GBPUSD','GBPAUD','GBPJPY','GBPCAD','GBPNZD','CADJPY','CADCHF'] AtivosAbertos = [] for a in range(19): #Seleciona os ativos abertos de acordo com a lista acima e if OpenAssets['turbo'][ativosF[a]]['open']: AtivosAbertos.append(ativos[a]) print('Ativos abertos : ',len(AtivosAbertos) + 1)#Mostra a quantidade de ativos abertos print(AtivosAbertos) driver = webdriver.Chrome('/Users/Richeli/Desktop/iqoption/chromedriver') #Lozaliza os dados do navegador driver.get('http://br.investing.com/technical/pivot-points') #Site desejado