├── imgs ├── iq_coding.png ├── arquivo_zip.png ├── github_pix.png ├── nova_pasta.png ├── api_iqoption.png ├── donate_paypal.png ├── extrair_pasta.png ├── install_python.png ├── novo_arquivo.png ├── versao_python.png ├── download_python.png ├── exibir_extensao.png ├── extensao_errada.png ├── renomear_arquivo.png └── arquivo_renomeado.png ├── bots ├── requirements.txt ├── listas.md ├── bots_disponiveis.md ├── bots_estrategias.md ├── gerador_de_lista_de_sinais_m5.py ├── mhi_um_maioria.py ├── mhi_um_minoria.py ├── mhi_dois_maioria.py ├── mhi_dois_minoria.py ├── mhi_tres_maioria.py ├── mhi_tres_minoria.py ├── vituxo_dois_zero_maioria.py ├── vituxo_dois_zero_minoria.py ├── milhao_maioria.py └── milhao_minoria.py ├── README.md ├── .gitignore └── preparando_ambiente.md /imgs/iq_coding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/iq_coding.png -------------------------------------------------------------------------------- /imgs/arquivo_zip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/arquivo_zip.png -------------------------------------------------------------------------------- /imgs/github_pix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/github_pix.png -------------------------------------------------------------------------------- /imgs/nova_pasta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/nova_pasta.png -------------------------------------------------------------------------------- /imgs/api_iqoption.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/api_iqoption.png -------------------------------------------------------------------------------- /imgs/donate_paypal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/donate_paypal.png -------------------------------------------------------------------------------- /imgs/extrair_pasta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/extrair_pasta.png -------------------------------------------------------------------------------- /imgs/install_python.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/install_python.png -------------------------------------------------------------------------------- /imgs/novo_arquivo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/novo_arquivo.png -------------------------------------------------------------------------------- /imgs/versao_python.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/versao_python.png -------------------------------------------------------------------------------- /imgs/download_python.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/download_python.png -------------------------------------------------------------------------------- /imgs/exibir_extensao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/exibir_extensao.png -------------------------------------------------------------------------------- /imgs/extensao_errada.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/extensao_errada.png -------------------------------------------------------------------------------- /imgs/renomear_arquivo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/renomear_arquivo.png -------------------------------------------------------------------------------- /imgs/arquivo_renomeado.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guilhersantos/iq_bots/HEAD/imgs/arquivo_renomeado.png -------------------------------------------------------------------------------- /bots/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2020.12.5 2 | chardet==4.0.0 3 | idna==2.10 4 | numpy==1.19.4 5 | pandas==1.1.5 6 | python-dateutil==2.8.1 7 | pytz==2020.5 8 | requests==2.25.1 9 | six==1.15.0 10 | urllib3==1.26.2 11 | websocket-client==0.57.0 12 | -------------------------------------------------------------------------------- /bots/listas.md: -------------------------------------------------------------------------------- 1 | ### GERADOR DE LISTA DE SINAIS M5 2 | 3 | #### - Descrição 4 | 5 | A lista será gerada baseando-se no numéro de ocorrência de um candle de alta(verde) ou de baixa(vermelho) 6 | em cada horário alternando-se de 5 em 5 minutos, onde será somando essa ocorrência e divida pelo número de dias. 7 | 8 | #### - Exemplo: 9 | 10 | > - Uma das pariedades escolhida EURUSD 11 | > - Quantidade de dias igual a 60 12 | > - Hora: 10:00 13 | > - Quantidade de candles verdes igual a 30 14 | > - Quantidade de candles vermelhos igual a 25 15 | > - Quantidade de candles dojis igual a 5 16 | > - verdes/dias = 50% 17 | > - vermelhos/dias = 41,6% 18 | > - dojis/dias = 8,3% -> iguinora-se os dojis 19 | > 20 | > Sinal gerado igual -> EURUSD;10:00;CALL 21 | 22 | #### - Versões 23 | 24 | > 1.0: As configurações se encontram dentro do código
25 | > - Lista de pariedades: pariedades 26 | > - Quantidade de dias: quantidade_dias 27 | > - Filtro de percentual: filtro_percentual 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## IQ_BOTs 2 | 3 | ## *Atenção, não siga em diante sem ler isso primeiro!!! 4 | 5 | * A partir de agora todo código que eu for começar a desenvolver eu irei disponibilizar aqui para todos 100% de grátis! 6 | 7 | 8 | * Irei tentar(também não sei tudo né) fazer revisão de códigos: 9 | * Para tentar resolver algum erro ou implementar alguma funcionalidade! 10 | * Não colocarei de forma alguma algum tipo de controle de licensa! 11 | * Não irei criar ou trabalhar com nenhum tipo de interface visual, apenas scripts! 12 | 13 | 14 | * Lembre-se isso é um trabalho / hobby voluntário, logo: 15 | * Sem promessa ou obrigação de o faze-lo. 16 | * Usarei meu tempo disponível e minha boa vontade do dia! 17 | * Ao me enviar no privado entendo que já deu esta permissão, caso contrário nem envie! 18 | 19 | > Dito isso, somente irei aceitar que me enviem o código no privado [Telegram - @poolals](http://bit.ly/3h2C4ZU), mas podem ter certeza, caso eu julgue a ideia nova/boa/útil e que ajude os demais membros do grupo de qualquer forma, este será disponibilizado neste local, com ou sem permissão do mesmo! 20 | 21 |

Se deu valor, doe se puder

22 |

donate_paypal

23 |

github_pix

24 |

Total doado R$ 10,00

25 | 26 | *** 27 | > ### _Arquivo com informações úteis:_ 28 | >> - Como preparar o ambiente para execução dos BOTs: [preparando o ambiente](http://bit.ly/3nPyViV) ! 29 | >> - BOT's disponíveis até o momento: [bot's disponíveis](http://bit.ly/3rwK6Ps) ! 30 | 31 | *** 32 | *** 33 | 34 | # Atenção, não tenho nenhum vínculo junto a corretora IQ Option, não encorajo nem indico operações binárias de qualquer forma, seja ela manualmente ou com utilização de robôs, o risco de PERDA financeira é extremamente alto, tenha muito cuidado. 35 | 36 | ## Se for se arriscar, verifique junto ao órgão regulador as informações sobre a corretora, No Brasil este é a [CVM](http://www.cvm.gov.br) 37 | 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | 131 | # PyCharm 132 | .idea 133 | bots/iqoptionapi 134 | -------------------------------------------------------------------------------- /preparando_ambiente.md: -------------------------------------------------------------------------------- 1 | # Começe aqui 2 | *** 3 | *** 4 | ## 1. Preparando o ambiente. 5 | 6 | 1.1 - Baixe a API mais atual [clicando aqui](http://bit.ly/2Wug9RR). 7 | 8 | ![api_iqoption](imgs/api_iqoption.png) 9 | 10 | 1.2. - Faça o dowload do arquivo ZIP. 11 | 12 | ![arquivo_zip](imgs/arquivo_zip.png) 13 | 14 | 1.3. - Crie uma nova pasta no seu computador, eu crie essa “robo” 15 | na minha area de trabalho e entre nela. 16 | 17 | ![nova_pasta](imgs/nova_pasta.png) 18 | 19 | 1.4. - Extrair a pasta “iqoptionapi” inteira de dentro do zip baixado para sua pasta criada. 20 | 21 | ![extrair_pasta](imgs/extrair_pasta.png) 22 | 23 | 1.5. - Crie um arquivo que será o arquivo de seu robo, eu criei o meu como “robo_iq.py”, 24 | lembre-se a extensão do arquivo deverá ser “.py”! 25 | 26 | ![novo_arquivo](imgs/novo_arquivo.png) 27 | ![extensao_errada](imgs/extensao_errada.png) 28 | 29 | >_Atenção: Caso o tipo de arquivo encontrar-se como “Documento de Texto” isso será um problema, então siga esses passos, click em exibir , selecione detalhes, e selecione o checkbox de “Extensões de nomes de arquivos, a extensão verdadeira irá aparecer como na imagem abaixo._ 30 | 31 | ![exibir_extensao](imgs/exibir_extensao.png) 32 | 33 | 1.5.1 - Agora renomei o arquivo para a extensão correta, click com o botão direito do mouse 34 | no mesmo e escolha renomear e apague a parte “.txt” ficando apenas “robo_iq.py”. 35 | 36 | ![renomear_arquivo](imgs/renomear_arquivo.png) 37 | 38 | 1.5.2 - Confira o resultado 39 | 40 | ![arquivo_renomeado](imgs/arquivo_renomeado.png) 41 | 42 | ## 2. Instalando o python. 43 | 44 | 2.1. Acesse a url do python e navegue a a lista de arquivos “Files” e faça o download da vesão 45 | de acordo com sua maquina(PC) 64 bits ou 32 bits e execute a instalação da mesma. 46 | 47 | [click aqui - python 3.8](https://www.python.org/downloads/release/python-386/) 48 | 49 | ![download_python](imgs/download_python.png) 50 | 51 | >_Atenção: No momento da instalação o checkbox “Add Python to enviroment variables" deve esta selecionado._ 52 | 53 | ![install_python](imgs/install_python.png) 54 | 55 | 2.2 - Para testar se tudo deu certo, abra seu cmd ou powershell e digite: python --version 56 | Algo como na imagem abaixo deverá ser exibido. 57 | 58 | ![versao_python](imgs/versao_python.png) 59 | 60 | ## 3. Ultimos passos. 61 | 62 | 3.1 - Instalando modulos essenciais. 63 | 64 | Abra seu cmd ou powershell e digite: 65 | 66 | pip install requests 67 | pip install websocket-client==0.57 68 | pip install python-dateutil 69 | 70 | >_Dica: Você pode rodar o comando "pip freeze" para verificar todos os modulos instalados em sua maquina._ 71 | 72 | -------------------------------------------------------------------------------- /bots/bots_disponiveis.md: -------------------------------------------------------------------------------- 1 | # Aqui estarão os status de cada BOT a ser desenvolvido. 2 | 3 | > Serão desenvolvidas as ESTRATÉGIAS DE QUADRANTES
4 | 5 | --- 6 | --- 7 | 8 | #### * Atenção - não deixe de dar os feedbacks quanto ao bom ou mal funcionamento dos scripts ou estratégias, pois assim conseguiremos evoluí-las ou corrigí-las ! 9 | #### ** Atenção - não se esqueça de seguir com as instalações dos modulos necessários contido no arquivo requirements.txt ! 10 | ``` 11 | pip install -r requirements.txt 12 | ``` 13 | 14 | #### *** Atenção - não deixe de acompanhar as informações e instruções contidas dentro dos arquivos .MD, ou click nos links(nomes) ! 15 | 16 | *** 17 | *** 18 | 19 | ## 1 - *Estratégias* 20 | 21 | | Nome | Status | Timeframe | Funcionalidades | Versão | Ultima alteração | 22 | |:-------------------------------------------------------------|:----------------------------------------|:-----------:| ---------------------------------------------------------| :------: | :--------------: | 23 | | [MHI 1 MINORIA](bots_estrategias.md#mhi-um-minoria) | Liberado, aguardando feedback de testes | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | 25/12/2020 | 24 | | [MHI 2 MINORIA](bots_estrategias.md#mhi-dois-minoria) | Liberado, aguardando feedback de testes | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | 26/12/2020 | 25 | | [MHI 3 MINORIA](bots_estrategias.md#mhi-tres-minoria) | Liberado, aguardando feedback de testes | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | 26/12/2020 | 26 | | [MHI 1 MAIORIA](bots_estrategias.md#mhi-um-maioria) | Liberado, aguardando feedback de testes | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | 28/12/2020 | 27 | | [MHI 2 MANORIA](bots_estrategias.md#mhi-dois-maioria) | Liberado, aguardando feedback de testes | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | 28/12/2020 | 28 | | [MHI 3 MAIORIA](bots_estrategias.md#mhi-tres-maioria) | Liberado, aguardando feedback de testes | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | 28/12/2020 | 29 | | [VITUXO 2.0 MAIORIA](bots_estrategias.md#vituxo-20-maioria) | Liberado, aguardando feedback de testes | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | 29/12/2020 | 30 | | [VITUXO 2.0 MINORIA](bots_estrategias.md#vituxo-20-minoria) | Liberado, aguardando feedback de testes | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | 29/12/2020 | 31 | | [C3]() | | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | | 32 | | [M.S.F]() | | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | | 33 | | [MILHÃO MAIORIA](bots_estrategias.md#milhao-maioria) | Liberado, aguardando feedback de testes | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | 29/12/2020 | 34 | | [MILHÃO MINORIA](bots_estrategias.md#milhao-minoria) | Liberado, aguardando feedback de testes | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | 29/12/2020 | 35 | | [3 VISINHOS]() | | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | | 36 | | [DAKA]() | | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | | 37 | | [PADRÂO 23]() | | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | | 38 | | [R7]() | | M1 | Configurações no código, Martingale, Stop Loss, Stop Win | 1.0 | | 39 | 40 | *** 41 | *** 42 | 43 | ## 2 - *Estratégias com listas de sinais* 44 | 45 | | Nome | Status | Timeframe | Funcionalidades | Versão | Ultima alteração | 46 | |:--------------------------------------------------------------------------|:------------------------------------------|:-----------:| ---------------------------------------------------------------------------------------- | :------: | :--------------: | 47 | | [GERADOR DE LISTA DE SINAIS](listas.md#gerador-de-lista-de-sinais-m5) | Liberado, aguardando feedback de testes | M5 | Configurações no código, lista de pariedades, quantidade de dias, filtro por percentual | 1.0 | 25/12/2020 | 48 | | [VERIFICADOR DE LISTA DE SINAIS](listas.md) | | | | | | 49 | | [EXECUTOR DE LISTA DE SINAIS](listas.md) | | | | | | 50 | -------------------------------------------------------------------------------- /bots/bots_estrategias.md: -------------------------------------------------------------------------------- 1 | ### MHI UM MINORIA 2 | 3 | #### - Descrição 4 | ``` 5 | Quadrante Analise | Entrada 6 | | || 7 | 1 2 3 4 5 | \/ 8 | ███ ███ ███ ███ ███ | ████ 9 | ``` 10 | 11 | Olhar as 3 últimas velas do quadrante de analise e ver qual cor de candle esta em minoria.
12 | Entrar na PRIMEIRA vela do próximo quadrante dizendo que a mesma será da cor da MINORIA.
13 | ___** Use até 2 martingales nas velas seguintes a vela de entrada.___
14 | 15 | #### - Versões 16 | 17 | > 1.0: As configurações se encontram dentro do código
18 | > - Martingale 19 | > - Stop Loss 20 | > - Stop Win 21 | 22 | *** 23 | *** 24 | 25 | ### MHI DOIS MINORIA 26 | 27 | #### - Descrição 28 | ``` 29 | Quadrante Analise | Entrada 30 | | || 31 | 1 2 3 4 5 | \/ 32 | ███ ███ ███ ███ ███ | ███ ████ 33 | ``` 34 | 35 | Olhar as 3 últimas velas do quadrante de analise e ver qual cor de candle esta em minoria.
36 | Entrar na SEGUNDA vela do próximo quadrante dizendo que a mesma será da cor da MINORIA.
37 | ___** Use até 2 martingales nas velas seguintes a vela de entrada.___
38 | 39 | #### - Versões 40 | 41 | > 1.0: As configurações se encontram dentro do código
42 | > - Martingale 43 | > - Stop Loss 44 | > - Stop Win 45 | 46 | *** 47 | *** 48 | 49 | ### MHI TRES MINORIA 50 | 51 | #### - Descrição 52 | ``` 53 | Quadrante Analise | Entrada 54 | | || 55 | 1 2 3 4 5 | \/ 56 | ███ ███ ███ ███ ███ | ███ ███ ████ 57 | ``` 58 | 59 | Olhar as 3 últimas velas do quadrante de analise e ver qual cor de candle esta em minoria.
60 | Entrar na TERCEIRA vela do próximo quadrante dizendo que a mesma será da cor da MINORIA.
61 | ___** Use até 2 martingales nas velas seguintes a vela de entrada.___
62 | 63 | #### - Versões 64 | 65 | > 1.0: As configurações se encontram dentro do código
66 | > - Martingale 67 | > - Stop Loss 68 | > - Stop Win 69 | 70 | ### MHI UM MAIORIA 71 | 72 | #### - Descrição 73 | ``` 74 | Quadrante Analise | Entrada 75 | | || 76 | 1 2 3 4 5 | \/ 77 | ███ ███ ███ ███ ███ | ████ 78 | ``` 79 | 80 | Olhar as 3 últimas velas do quadrante de analise e ver qual cor de candle esta em maioria.
81 | Entrar na PRIMEIRA vela do próximo quadrante dizendo que a mesma será da cor da MAIORIA.
82 | ___** Use até 2 martingales nas velas seguintes a vela de entrada.___
83 | 84 | #### - Versões 85 | 86 | > 1.0: As configurações se encontram dentro do código
87 | > - Martingale 88 | > - Stop Loss 89 | > - Stop Win 90 | 91 | *** 92 | *** 93 | 94 | ### MHI DOIS MAIORIA 95 | 96 | #### - Descrição 97 | ``` 98 | Quadrante Analise | Entrada 99 | | || 100 | 1 2 3 4 5 | \/ 101 | ███ ███ ███ ███ ███ | ███ ████ 102 | ``` 103 | 104 | Olhar as 3 últimas velas do quadrante de analise e ver qual cor de candle esta em maioria.
105 | Entrar na SEGUNDA vela do próximo quadrante dizendo que a mesma será da cor da MAIORIA.
106 | ___** Use até 2 martingales nas velas seguintes a vela de entrada.___
107 | 108 | #### - Versões 109 | 110 | > 1.0: As configurações se encontram dentro do código
111 | > - Martingale 112 | > - Stop Loss 113 | > - Stop Win 114 | 115 | *** 116 | *** 117 | 118 | ### MHI TRES MAIORIA 119 | 120 | #### - Descrição 121 | ``` 122 | Quadrante Analise | Entrada 123 | | || 124 | 1 2 3 4 5 | \/ 125 | ███ ███ ███ ███ ███ | ███ ███ ████ 126 | ``` 127 | 128 | Olhar as 3 últimas velas do quadrante de analise e ver qual cor de candle esta em maioria.
129 | Entrar na TERCEIRA vela do próximo quadrante dizendo que a mesma será da cor da MAIORIA.
130 | ___** Use até 2 martingales nas velas seguintes a vela de entrada.___
131 | 132 | #### - Versões 133 | 134 | > 1.0: As configurações se encontram dentro do código
135 | > - Martingale 136 | > - Stop Loss 137 | > - Stop Win 138 | 139 | *** 140 | *** 141 | 142 | ### VITUXO 2.0 MAIORIA 143 | 144 | #### - Descrição 145 | ``` 146 | Quadrante Analise | Entrada 147 | | || 148 | 1 2 3 4 5 | \/ 149 | ███ ███ ███ ███ ███ | ███ ███ ████ 150 | ``` 151 | 152 | Olhar as 3 primeiras velas do quadrante de analise e ver qual cor de candle esta em maioria.
153 | Entrar na TERCEIRA vela do próximo quadrante dizendo que a mesma será da cor da MAIORIA.
154 | ___** Use até 2 martingales nas velas seguintes a vela de entrada.___
155 | 156 | #### - Versões 157 | 158 | > 1.0: As configurações se encontram dentro do código
159 | > - Martingale 160 | > - Stop Loss 161 | > - Stop Win 162 | 163 | ### VITUXO 2.0 MINORIA 164 | 165 | #### - Descrição 166 | ``` 167 | Quadrante Analise | Entrada 168 | | || 169 | 1 2 3 4 5 | \/ 170 | ███ ███ ███ ███ ███ | ███ ███ ████ 171 | ``` 172 | 173 | Olhar as 3 primeiras velas do quadrante de analise e ver qual cor de candle esta em minoria.
174 | Entrar na TERCEIRA vela do próximo quadrante dizendo que a mesma será da cor da MINORIA.
175 | ___** Use até 2 martingales nas velas seguintes a vela de entrada.___
176 | 177 | #### - Versões 178 | 179 | > 1.0: As configurações se encontram dentro do código
180 | > - Martingale 181 | > - Stop Loss 182 | > - Stop Win 183 | 184 | *** 185 | *** 186 | 187 | ### MILHAO MAIORIA 188 | 189 | #### - Descrição 190 | ``` 191 | Quadrante Analise | Entrada 192 | | || 193 | 1 2 3 4 5 | \/ 194 | ███ ███ ███ ███ ███ | ████ 195 | ``` 196 | 197 | Olhar as 5 primeiras velas do quadrante de analise e ver qual cor de candle esta em maioria.
198 | Entrar na TERCEIRA vela do próximo quadrante dizendo que a mesma será da cor da MAIORIA.
199 | ___** Use até 2 martingales nas velas seguintes a vela de entrada.___
200 | 201 | #### - Versões 202 | 203 | > 1.0: As configurações se encontram dentro do código
204 | > - Martingale 205 | > - Stop Loss 206 | > - Stop Win 207 | 208 | ### MILHAO MINORIA 209 | 210 | #### - Descrição 211 | ``` 212 | Quadrante Analise | Entrada 213 | | || 214 | 1 2 3 4 5 | \/ 215 | ███ ███ ███ ███ ███ | ████ 216 | ``` 217 | 218 | Olhar as 5 primeiras velas do quadrante de analise e ver qual cor de candle esta em minoria.
219 | Entrar na TERCEIRA vela do próximo quadrante dizendo que a mesma será da cor da MINORIA.
220 | ___** Use até 2 martingales nas velas seguintes a vela de entrada.___
221 | 222 | #### - Versões 223 | 224 | > 1.0: As configurações se encontram dentro do código
225 | > - Martingale 226 | > - Stop Loss 227 | > - Stop Win 228 | -------------------------------------------------------------------------------- /bots/gerador_de_lista_de_sinais_m5.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import os 3 | import sys 4 | import time 5 | from datetime import datetime, timedelta 6 | 7 | import numpy as np 8 | import pandas as pd 9 | from dateutil import tz 10 | 11 | from iqoptionapi.stable_api import IQ_Option 12 | 13 | 14 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 15 | check, reason = _iq.connect() 16 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 17 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 18 | if check: 19 | print("Start your application") 20 | _iq.change_balance(_account_type) 21 | return True 22 | else: 23 | if reason == "[Errno -2] Name or service not known": 24 | print("No Network") 25 | elif reason == error_password: 26 | error_message = ast.literal_eval(error_password) 27 | print(error_message['message']) 28 | elif reason == requests_limit_exceeded: 29 | error_message = ast.literal_eval(requests_limit_exceeded) 30 | print(error_message['message']) 31 | 32 | print("Finishing application, check your data and try again.") 33 | return False 34 | 35 | 36 | def format_currency_value(_currency_account: str, _value: float) -> str: 37 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 38 | 39 | 40 | def get_color_candle(_candle: dict) -> str: 41 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 42 | 43 | 44 | # Aqui você faz as configurações da sua conta IQ Opetion 45 | # #:===============================================================:# 46 | login = 'COLOQUE AQUI SEU EMAIL IQ' 47 | password = 'COLOQUE AQUI SUA SENHA IQ' 48 | account_type = 'PRACTICE' 49 | 50 | # Aqui começa a configuração da API, não alterar 51 | # #:===============================================================:# 52 | iq = IQ_Option(login, password) 53 | if not verificar_se_fez_a_conexao(iq, account_type): 54 | sys.exit(0) 55 | 56 | currency_account = iq.get_currency() 57 | account_balance = iq.get_balance() 58 | DATE_TIME_FORMAT = '%Y-%m-%d %H:%M' 59 | 60 | print('#:===============================================================:#') 61 | print(f"This is your API version {IQ_Option.__version__}") 62 | print('#:===============================================================:#') 63 | print(f"Welcome: {login}") 64 | print( 65 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: " 66 | f"{format_currency_value(currency_account, account_balance)}") 67 | print('#:===============================================================:#') 68 | 69 | # Aqui você faz as configurações do BOT 70 | # #:===============================================================:# 71 | pariedades = ['EURUSD-OTC', 'AUDCAD-OTC'] 72 | quantidade_dias = 15 73 | filtro_percentual = 80 74 | 75 | 76 | def timestamp_converter(_timestamp: int) -> str: 77 | hora = datetime.strptime(datetime.utcfromtimestamp(_timestamp).strftime(DATE_TIME_FORMAT), DATE_TIME_FORMAT) 78 | hora = hora.replace(tzinfo=tz.gettz('GMT')) 79 | return str(hora.astimezone(tz.gettz('America/Sao Paulo')))[:-9] 80 | 81 | 82 | def filter_columns(_candles: list) -> list: 83 | return [{k: v for k, v in candle.items() if k in {'from', 'open', 'close'}} for candle in _candles] 84 | 85 | 86 | def adjust_catalog(_pariedade: str, _candle: dict) -> dict: 87 | return { 88 | 'pariedade': _pariedade, 89 | 'hora': timestamp_converter(_candle['from']).split(' ')[1], 90 | 'green': 1 if get_color_candle(_candle) == 'G' else 0, 91 | 'red': 1 if get_color_candle(_candle) == 'R' else 0, 92 | 'doji': 1 if get_color_candle(_candle) == 'D' else 0 93 | } 94 | 95 | 96 | if quantidade_dias < 15: 97 | quantidade_dias = 15 98 | 99 | print("Iniciando a geração de lista de sinais, aguarde >>>>>>>>>>>>>>>") 100 | print(f"Baseada em {quantidade_dias} dias e separando probabilidades de {filtro_percentual}%") 101 | 102 | catalogacao = [] 103 | for pariedade in pariedades: 104 | for dia in range(quantidade_dias, -1, -1): 105 | if dia == 0: 106 | current_date = datetime( 107 | year=datetime.now().date().year, 108 | month=datetime.now().date().month, 109 | day=datetime.now().date().day, 110 | hour=datetime.now().hour, 111 | minute=0, 112 | second=0, 113 | microsecond=0) - timedelta(days=dia, minutes=5) 114 | current_timestamp = int(time.mktime(current_date.timetuple())) 115 | candles = iq.get_candles(pariedade, 300, datetime.now().hour * 12, current_timestamp) 116 | candles = [{k: v for k, v in candle.items() if k in {'from', 'open', 'close'}} for candle in candles] 117 | for candle in candles: 118 | catalogacao.append(adjust_catalog(pariedade, candle)) 119 | else: 120 | current_date = datetime( 121 | year=datetime.now().date().year, 122 | month=datetime.now().date().month, 123 | day=datetime.now().date().day, 124 | hour=0, 125 | minute=0, 126 | second=0, 127 | microsecond=0) - timedelta(days=dia, minutes=5) 128 | current_timestamp = int(time.mktime(current_date.timetuple())) 129 | candles = iq.get_candles(pariedade, 300, 228, current_timestamp) 130 | for candle in filter_columns(candles): 131 | catalogacao.append(adjust_catalog(pariedade, candle)) 132 | 133 | df = pd.DataFrame(catalogacao) 134 | sum_df = df.groupby(['pariedade', 'hora'], as_index=False).agg({'green': 'sum', 'red': 'sum', 'doji': 'sum'}) 135 | sum_df['total'] = sum_df['green'] + sum_df['red'] + sum_df['doji'] 136 | sum_df['green_percent'] = np.int64(sum_df['green'] / sum_df['total'] * 100) 137 | sum_df['red_percent'] = np.int64(sum_df['red'] / sum_df['total'] * 100) 138 | sum_df['doji_percent'] = np.int64(sum_df['doji'] / sum_df['total'] * 100) 139 | new_df = sum_df[['pariedade', 'hora', 'green_percent', 'red_percent', 'doji_percent']] 140 | new_df = new_df.sort_values(by='hora') 141 | list_catalog = new_df.values.tolist() 142 | 143 | data_uso_lista = datetime.now() - timedelta(days=-1) 144 | 145 | nome_do_arquivo = f"lista_sinais_{data_uso_lista.strftime('%Y_%m_%d')}.txt" 146 | 147 | directory = "data/" 148 | if not os.path.exists(directory): 149 | os.makedirs(directory) 150 | 151 | sparador = ';' 152 | 153 | with open(directory + nome_do_arquivo, 'a', encoding='utf-8') as file: 154 | for item in list_catalog: 155 | if item[2] > filtro_percentual: 156 | file.write(item[0] + sparador + item[1] + sparador + 'CALL\n') 157 | if item[3] > filtro_percentual: 158 | file.write(item[0] + sparador + item[1] + sparador + 'PUT\n') 159 | 160 | print(f"Finalizando a geração de lista de sinais >>>>>>>>>>>>>>>") 161 | print('#:===============================================================:#') 162 | print(f"Data de geração: {datetime.now().strftime('%Y-%m-%d %H:M')}") 163 | print(f"Data para utilização: {data_uso_lista.strftime('%Y-%m-%d')}") 164 | print('#:===============================================================:#') 165 | -------------------------------------------------------------------------------- /bots/mhi_um_maioria.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import sys 3 | import time 4 | from datetime import datetime 5 | 6 | from iqoptionapi.stable_api import IQ_Option 7 | 8 | 9 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 10 | check, reason = _iq.connect() 11 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 12 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 13 | if check: 14 | print("Start your application") 15 | _iq.change_balance(_account_type) 16 | return True 17 | else: 18 | if reason == "[Errno -2] Name or service not known": 19 | print("No Network") 20 | elif reason == error_password: 21 | error_message = ast.literal_eval(error_password) 22 | print(error_message['message']) 23 | elif reason == requests_limit_exceeded: 24 | error_message = ast.literal_eval(requests_limit_exceeded) 25 | print(error_message['message']) 26 | 27 | print("Finishing application, check your data and try again.") 28 | return False 29 | 30 | 31 | def format_currency_value(_currency_account: str, _value: float) -> str: 32 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 33 | 34 | 35 | def get_color_candle(_candle: dict) -> str: 36 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 37 | 38 | 39 | # Aqui você faz as configurações do BOT 40 | # #:===============================================================:# 41 | valor_entrada_incial = 100 42 | stop_loss = 1200 43 | stop_win = 800 44 | quantidade_martigale = 2 45 | pariedade = 'EURUSD-OTC' 46 | tipo_pariedade = 'DIGITAL' 47 | 48 | # Aqui você faz as configurações da sua conta IQ Opetion 49 | # #:===============================================================:# 50 | login = 'COLOQUE AQUI SEU EMAIL IQ' 51 | password = 'COLOQUE AQUI SUA SENHA IQ' 52 | account_type = 'PRACTICE' 53 | 54 | # Aqui começa a configuração da API, não alterar 55 | # #:===============================================================:# 56 | iq = IQ_Option(login, password) 57 | if not verificar_se_fez_a_conexao(iq, account_type): 58 | sys.exit(0) 59 | 60 | currency_account = iq.get_currency() 61 | account_balance = iq.get_balance() 62 | 63 | print('#:===============================================================:#') 64 | print(f"This is your API version {IQ_Option.__version__}") 65 | print('#:===============================================================:#') 66 | print(f"Welcome: {login}") 67 | print( 68 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: {format_currency_value(currency_account, account_balance)}") 69 | print('#:===============================================================:#') 70 | 71 | # Variáveis de controle do BOT, não alterar 72 | # #:===============================================================:# 73 | lucro_atual = 0 74 | valor_entrada_atual = valor_entrada_incial 75 | quantidade_martigale_executado = -1 76 | executar_martingale = False 77 | 78 | print('#:===============================================================:#') 79 | print(f'Executando estratégia MHI 1 MAIORIA') 80 | print(f"Data: {datetime.now().strftime('%Y-%m-%d %H:M')}") 81 | print(f'Pariedade: {pariedade}') 82 | print(f'Valor Entrada: {format_currency_value(currency_account, valor_entrada_incial)}') 83 | print(f'Stop loss: {format_currency_value(currency_account, stop_loss)}') 84 | print(f'Stop Win: {format_currency_value(currency_account, stop_win)}') 85 | print(f'Maximo Marigales: {quantidade_martigale}') 86 | print('#:===============================================================:#') 87 | 88 | 89 | def verificar_stops(_stop_loss: float, _stop_win: float, _lucro_atual: float, _valor_entrada_atual: float, 90 | _show_message: bool = True) -> bool: 91 | if _lucro_atual >= _stop_win: 92 | if _show_message: 93 | print(f'Stop Win atingido!') 94 | return True 95 | 96 | if _lucro_atual < 0: 97 | if abs(_lucro_atual) + _valor_entrada_atual >= _stop_loss: 98 | if _show_message: 99 | print(f'Stop Loss atingido, ou valor muito próximo!') 100 | return True 101 | 102 | return False 103 | 104 | 105 | def aguardar_horario_entrada(_iq: IQ_Option, _pariedade: str) -> list: 106 | print('>>>>>>>>>>>>>>> Aguardando horário de entrada', end='\r') 107 | print() 108 | while True: 109 | minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) 110 | if (4.59 <= minutos <= 5) or minutos == 9.59: 111 | return _iq.get_candles(_pariedade, 60, 3, time.time()) 112 | 113 | 114 | def validar_estrategia(_candles: list) -> [bool, str]: 115 | print('>>>>>>>>>>>>>>> Validando estratégia', end='\r') 116 | print() 117 | cores = get_color_candle(_candles[0]) + get_color_candle(_candles[1]) + get_color_candle(_candles[2]) 118 | if cores.count('D'): 119 | return False, "None" 120 | elif cores.count('G') > cores.count('R'): 121 | return True, 'CALL' 122 | else: 123 | return True, 'PUT' 124 | 125 | 126 | def executar_entrada(_iq: IQ_Option, _pariedade: str, _tipo_pariedade: str, _direcao: str, _valor_entrada_atual: float, 127 | _quantidade_martigale_executado: int) -> [str, float]: 128 | status, order_id = _iq.buy_digital_spot(_pariedade, _valor_entrada_atual, _direcao.upper(), 1) \ 129 | if _tipo_pariedade.upper() == 'DIGITAL' else _iq.buy(_valor_entrada_atual, _pariedade, _direcao.upper(), 1) 130 | 131 | if quantidade_martigale_executado == -1: 132 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 133 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 134 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 135 | else: 136 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 137 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 138 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, Martingale nível: {_quantidade_martigale_executado + 1}, " 139 | f"em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 140 | 141 | if status: 142 | print(f">>>>>>>>>>>>>>> Aguardando resultado da operação") 143 | while True: 144 | status, reusltado = _iq.check_win_digital_v2( 145 | order_id) if _tipo_pariedade.upper() == 'DIGITAL' else _iq.check_win_v4(order_id) 146 | if status: 147 | if reusltado > 0: 148 | return 'WIN', float(reusltado) 149 | else: 150 | return 'LOSS', float(_valor_entrada_atual) 151 | 152 | return 'ERROR', float(0) 153 | 154 | 155 | print('>>>>>>>>>>>>>>> Iniciando operações') 156 | while not verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual): 157 | candles = aguardar_horario_entrada(iq, pariedade) 158 | estrategia_valida, direcao = validar_estrategia(candles) 159 | 160 | if estrategia_valida: 161 | 162 | while True: 163 | 164 | if quantidade_martigale > quantidade_martigale_executado: 165 | resultado, valor = executar_entrada(iq, pariedade, tipo_pariedade, direcao, valor_entrada_atual, 166 | quantidade_martigale_executado) 167 | 168 | if resultado == 'LOSS': 169 | lucro_atual -= valor 170 | print( 171 | f">>>>>>>>>>>>>>> Resulatdo da operação foi LOSS, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 172 | quantidade_martigale_executado += 1 173 | valor_entrada_atual = valor_entrada_atual * 2 174 | else: 175 | lucro_atual += valor 176 | print( 177 | f">>>>>>>>>>>>>>> Resulatdo da operação foi WIN, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 178 | valor_entrada_atual = valor_entrada_incial 179 | quantidade_martigale_executado = -1 180 | break 181 | else: 182 | quantidade_martigale_executado = -1 183 | valor_entrada_atual = valor_entrada_incial 184 | break 185 | 186 | if verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual, False): 187 | break 188 | else: 189 | print(">>>>>>>>>>>>>>> Pulando entrada atual, alto risco de LOSS") 190 | time.sleep(5) 191 | -------------------------------------------------------------------------------- /bots/mhi_um_minoria.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import sys 3 | import time 4 | from datetime import datetime 5 | 6 | from iqoptionapi.stable_api import IQ_Option 7 | 8 | 9 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 10 | check, reason = _iq.connect() 11 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 12 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 13 | if check: 14 | print("Start your application") 15 | _iq.change_balance(_account_type) 16 | return True 17 | else: 18 | if reason == "[Errno -2] Name or service not known": 19 | print("No Network") 20 | elif reason == error_password: 21 | error_message = ast.literal_eval(error_password) 22 | print(error_message['message']) 23 | elif reason == requests_limit_exceeded: 24 | error_message = ast.literal_eval(requests_limit_exceeded) 25 | print(error_message['message']) 26 | 27 | print("Finishing application, check your data and try again.") 28 | return False 29 | 30 | 31 | def format_currency_value(_currency_account: str, _value: float) -> str: 32 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 33 | 34 | 35 | def get_color_candle(_candle: dict) -> str: 36 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 37 | 38 | 39 | # Aqui você faz as configurações do BOT 40 | # #:===============================================================:# 41 | valor_entrada_incial = 100 42 | stop_loss = 1200 43 | stop_win = 800 44 | quantidade_martigale = 2 45 | pariedade = 'EURUSD-OTC' 46 | tipo_pariedade = 'DIGITAL' 47 | 48 | # Aqui você faz as configurações da sua conta IQ Opetion 49 | # #:===============================================================:# 50 | login = 'COLOQUE AQUI SEU EMAIL IQ' 51 | password = 'COLOQUE AQUI SUA SENHA IQ' 52 | account_type = 'PRACTICE' 53 | 54 | # Aqui começa a configuração da API, não alterar 55 | # #:===============================================================:# 56 | iq = IQ_Option(login, password) 57 | if not verificar_se_fez_a_conexao(iq, account_type): 58 | sys.exit(0) 59 | 60 | currency_account = iq.get_currency() 61 | account_balance = iq.get_balance() 62 | 63 | print('#:===============================================================:#') 64 | print(f"This is your API version {IQ_Option.__version__}") 65 | print('#:===============================================================:#') 66 | print(f"Welcome: {login}") 67 | print( 68 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: {format_currency_value(currency_account, account_balance)}") 69 | print('#:===============================================================:#') 70 | 71 | # Variáveis de controle do BOT, não alterar 72 | # #:===============================================================:# 73 | lucro_atual = 0 74 | valor_entrada_atual = valor_entrada_incial 75 | quantidade_martigale_executado = -1 76 | executar_martingale = False 77 | 78 | print('#:===============================================================:#') 79 | print(f'Executando estratégia MHI 1 MINORIA') 80 | print(f"Data: {datetime.now().strftime('%Y-%m-%d %H:M')}") 81 | print(f'Pariedade: {pariedade}') 82 | print(f'Valor Entrada: {format_currency_value(currency_account, valor_entrada_incial)}') 83 | print(f'Stop loss: {format_currency_value(currency_account, stop_loss)}') 84 | print(f'Stop Win: {format_currency_value(currency_account, stop_win)}') 85 | print(f'Maximo Marigales: {quantidade_martigale}') 86 | print('#:===============================================================:#') 87 | 88 | 89 | def verificar_stops(_stop_loss: float, _stop_win: float, _lucro_atual: float, _valor_entrada_atual: float, 90 | _show_message: bool = True) -> bool: 91 | if _lucro_atual >= _stop_win: 92 | if _show_message: 93 | print(f'Stop Win atingido!') 94 | return True 95 | 96 | if _lucro_atual < 0: 97 | if abs(_lucro_atual) + _valor_entrada_atual >= _stop_loss: 98 | if _show_message: 99 | print(f'Stop Loss atingido, ou valor muito próximo!') 100 | return True 101 | 102 | return False 103 | 104 | 105 | def aguardar_horario_entrada(_iq: IQ_Option, _pariedade: str) -> list: 106 | print('>>>>>>>>>>>>>>> Aguardando horário de entrada', end='\r') 107 | print() 108 | while True: 109 | minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) 110 | if (4.59 <= minutos <= 5) or minutos == 9.59: 111 | return _iq.get_candles(_pariedade, 60, 3, time.time()) 112 | 113 | 114 | def validar_estrategia(_candles: list) -> [bool, str]: 115 | print('>>>>>>>>>>>>>>> Validando estratégia', end='\r') 116 | print() 117 | cores = get_color_candle(_candles[0]) + get_color_candle(_candles[1]) + get_color_candle(_candles[2]) 118 | if cores.count('D'): 119 | return False, "None" 120 | elif cores.count('G') > cores.count('R'): 121 | return True, 'PUT' 122 | else: 123 | return True, 'CALL' 124 | 125 | 126 | def executar_entrada(_iq: IQ_Option, _pariedade: str, _tipo_pariedade: str, _direcao: str, _valor_entrada_atual: float, 127 | _quantidade_martigale_executado: int) -> [str, float]: 128 | status, order_id = _iq.buy_digital_spot(_pariedade, _valor_entrada_atual, _direcao.upper(), 1) \ 129 | if _tipo_pariedade.upper() == 'DIGITAL' else _iq.buy(_valor_entrada_atual, _pariedade, _direcao.upper(), 1) 130 | 131 | if quantidade_martigale_executado == -1: 132 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 133 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 134 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 135 | else: 136 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 137 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 138 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, Martingale nível: {_quantidade_martigale_executado + 1}, " 139 | f"em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 140 | 141 | if status: 142 | print(f">>>>>>>>>>>>>>> Aguardando resultado da operação") 143 | while True: 144 | status, reusltado = _iq.check_win_digital_v2( 145 | order_id) if _tipo_pariedade.upper() == 'DIGITAL' else _iq.check_win_v4(order_id) 146 | if status: 147 | if reusltado > 0: 148 | return 'WIN', float(reusltado) 149 | else: 150 | return 'LOSS', float(_valor_entrada_atual) 151 | 152 | return 'ERROR', float(0) 153 | 154 | 155 | print('>>>>>>>>>>>>>>> Iniciando operações') 156 | while not verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual): 157 | candles = aguardar_horario_entrada(iq, pariedade) 158 | estrategia_valida, direcao = validar_estrategia(candles) 159 | 160 | if estrategia_valida: 161 | 162 | while True: 163 | 164 | if quantidade_martigale > quantidade_martigale_executado: 165 | resultado, valor = executar_entrada(iq, pariedade, tipo_pariedade, direcao, valor_entrada_atual, 166 | quantidade_martigale_executado) 167 | 168 | if resultado == 'LOSS': 169 | lucro_atual -= valor 170 | print( 171 | f">>>>>>>>>>>>>>> Resulatdo da operação foi LOSS, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 172 | quantidade_martigale_executado += 1 173 | valor_entrada_atual = valor_entrada_atual * 2 174 | else: 175 | lucro_atual += valor 176 | print( 177 | f">>>>>>>>>>>>>>> Resulatdo da operação foi WIN, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 178 | valor_entrada_atual = valor_entrada_incial 179 | quantidade_martigale_executado = -1 180 | break 181 | else: 182 | quantidade_martigale_executado = -1 183 | valor_entrada_atual = valor_entrada_incial 184 | break 185 | 186 | if verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual, False): 187 | break 188 | else: 189 | print(">>>>>>>>>>>>>>> Pulando entrada atual, alto risco de LOSS") 190 | time.sleep(5) 191 | -------------------------------------------------------------------------------- /bots/mhi_dois_maioria.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import sys 3 | import time 4 | from datetime import datetime 5 | 6 | from iqoptionapi.stable_api import IQ_Option 7 | 8 | 9 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 10 | check, reason = _iq.connect() 11 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 12 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 13 | if check: 14 | print("Start your application") 15 | _iq.change_balance(_account_type) 16 | return True 17 | else: 18 | if reason == "[Errno -2] Name or service not known": 19 | print("No Network") 20 | elif reason == error_password: 21 | error_message = ast.literal_eval(error_password) 22 | print(error_message['message']) 23 | elif reason == requests_limit_exceeded: 24 | error_message = ast.literal_eval(requests_limit_exceeded) 25 | print(error_message['message']) 26 | 27 | print("Finishing application, check your data and try again.") 28 | return False 29 | 30 | 31 | def format_currency_value(_currency_account: str, _value: float) -> str: 32 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 33 | 34 | 35 | def get_color_candle(_candle: dict) -> str: 36 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 37 | 38 | 39 | # Aqui você faz as configurações do BOT 40 | # #:===============================================================:# 41 | valor_entrada_incial = 100 42 | stop_loss = 1200 43 | stop_win = 800 44 | quantidade_martigale = 2 45 | pariedade = 'EURUSD-OTC' 46 | tipo_pariedade = 'DIGITAL' 47 | 48 | # Aqui você faz as configurações da sua conta IQ Opetion 49 | # #:===============================================================:# 50 | login = 'COLOQUE AQUI SEU EMAIL IQ' 51 | password = 'COLOQUE AQUI SUA SENHA IQ' 52 | account_type = 'PRACTICE' 53 | 54 | # Aqui começa a configuração da API, não alterar 55 | # #:===============================================================:# 56 | iq = IQ_Option(login, password) 57 | if not verificar_se_fez_a_conexao(iq, account_type): 58 | sys.exit(0) 59 | 60 | currency_account = iq.get_currency() 61 | account_balance = iq.get_balance() 62 | 63 | print('#:===============================================================:#') 64 | print(f"This is your API version {IQ_Option.__version__}") 65 | print('#:===============================================================:#') 66 | print(f"Welcome: {login}") 67 | print( 68 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: {format_currency_value(currency_account, account_balance)}") 69 | print('#:===============================================================:#') 70 | 71 | # Variáveis de controle do BOT, não alterar 72 | # #:===============================================================:# 73 | lucro_atual = 0 74 | valor_entrada_atual = valor_entrada_incial 75 | quantidade_martigale_executado = -1 76 | executar_martingale = False 77 | 78 | print('#:===============================================================:#') 79 | print(f'Executando estratégia MHI 2 MAIORIA') 80 | print(f"Data: {datetime.now().strftime('%Y-%m-%d %H:M')}") 81 | print(f'Pariedade: {pariedade}') 82 | print(f'Valor Entrada: {format_currency_value(currency_account, valor_entrada_incial)}') 83 | print(f'Stop loss: {format_currency_value(currency_account, stop_loss)}') 84 | print(f'Stop Win: {format_currency_value(currency_account, stop_win)}') 85 | print(f'Maximo Marigales: {quantidade_martigale}') 86 | print('#:===============================================================:#') 87 | 88 | 89 | def verificar_stops(_stop_loss: float, _stop_win: float, _lucro_atual: float, _valor_entrada_atual: float, 90 | _show_message: bool = True) -> bool: 91 | if _lucro_atual >= _stop_win: 92 | if _show_message: 93 | print(f'Stop Win atingido!') 94 | return True 95 | 96 | if _lucro_atual < 0: 97 | if abs(_lucro_atual) + _valor_entrada_atual >= _stop_loss: 98 | if _show_message: 99 | print(f'Stop Loss atingido, ou valor muito próximo!') 100 | return True 101 | 102 | return False 103 | 104 | 105 | def aguardar_horario_entrada(_iq: IQ_Option, _pariedade: str) -> list: 106 | print('>>>>>>>>>>>>>>> Aguardando horário de entrada', end='\r') 107 | print() 108 | while True: 109 | minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) 110 | if (5.59 <= minutos <= 6) or minutos == 0.59: 111 | return _iq.get_candles(_pariedade, 60, 3, time.time() - 60) 112 | 113 | 114 | def validar_estrategia(_candles: list) -> [bool, str]: 115 | print('>>>>>>>>>>>>>>> Validando estratégia', end='\r') 116 | print() 117 | cores = get_color_candle(_candles[0]) + get_color_candle(_candles[1]) + get_color_candle(_candles[2]) 118 | if cores.count('D'): 119 | return False, "None" 120 | elif cores.count('G') > cores.count('R'): 121 | return True, 'CALL' 122 | else: 123 | return True, 'PUT' 124 | 125 | 126 | def executar_entrada(_iq: IQ_Option, _pariedade: str, _tipo_pariedade: str, _direcao: str, _valor_entrada_atual: float, 127 | _quantidade_martigale_executado: int) -> [str, float]: 128 | status, order_id = _iq.buy_digital_spot(_pariedade, _valor_entrada_atual, _direcao.upper(), 1) \ 129 | if _tipo_pariedade.upper() == 'DIGITAL' else _iq.buy(_valor_entrada_atual, _pariedade, _direcao.upper(), 1) 130 | 131 | if quantidade_martigale_executado == -1: 132 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 133 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 134 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 135 | else: 136 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 137 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 138 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, Martingale nível: {_quantidade_martigale_executado + 1}, " 139 | f"em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 140 | 141 | if status: 142 | print(f">>>>>>>>>>>>>>> Aguardando resultado da operação") 143 | while True: 144 | status, reusltado = _iq.check_win_digital_v2( 145 | order_id) if _tipo_pariedade.upper() == 'DIGITAL' else _iq.check_win_v4(order_id) 146 | if status: 147 | if reusltado > 0: 148 | return 'WIN', float(reusltado) 149 | else: 150 | return 'LOSS', float(_valor_entrada_atual) 151 | 152 | return 'ERROR', float(0) 153 | 154 | 155 | print('>>>>>>>>>>>>>>> Iniciando operações') 156 | while not verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual): 157 | candles = aguardar_horario_entrada(iq, pariedade) 158 | estrategia_valida, direcao = validar_estrategia(candles) 159 | 160 | if estrategia_valida: 161 | 162 | while True: 163 | 164 | if quantidade_martigale > quantidade_martigale_executado: 165 | resultado, valor = executar_entrada(iq, pariedade, tipo_pariedade, direcao, valor_entrada_atual, 166 | quantidade_martigale_executado) 167 | 168 | if resultado == 'LOSS': 169 | lucro_atual -= valor 170 | print( 171 | f">>>>>>>>>>>>>>> Resulatdo da operação foi LOSS, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 172 | quantidade_martigale_executado += 1 173 | valor_entrada_atual = valor_entrada_atual * 2 174 | else: 175 | lucro_atual += valor 176 | print( 177 | f">>>>>>>>>>>>>>> Resulatdo da operação foi WIN, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 178 | valor_entrada_atual = valor_entrada_incial 179 | quantidade_martigale_executado = -1 180 | break 181 | else: 182 | quantidade_martigale_executado = -1 183 | valor_entrada_atual = valor_entrada_incial 184 | break 185 | 186 | if verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual, False): 187 | break 188 | else: 189 | print(">>>>>>>>>>>>>>> Pulando entrada atual, alto risco de LOSS") 190 | time.sleep(5) 191 | -------------------------------------------------------------------------------- /bots/mhi_dois_minoria.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import sys 3 | import time 4 | from datetime import datetime 5 | 6 | from iqoptionapi.stable_api import IQ_Option 7 | 8 | 9 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 10 | check, reason = _iq.connect() 11 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 12 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 13 | if check: 14 | print("Start your application") 15 | _iq.change_balance(_account_type) 16 | return True 17 | else: 18 | if reason == "[Errno -2] Name or service not known": 19 | print("No Network") 20 | elif reason == error_password: 21 | error_message = ast.literal_eval(error_password) 22 | print(error_message['message']) 23 | elif reason == requests_limit_exceeded: 24 | error_message = ast.literal_eval(requests_limit_exceeded) 25 | print(error_message['message']) 26 | 27 | print("Finishing application, check your data and try again.") 28 | return False 29 | 30 | 31 | def format_currency_value(_currency_account: str, _value: float) -> str: 32 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 33 | 34 | 35 | def get_color_candle(_candle: dict) -> str: 36 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 37 | 38 | 39 | # Aqui você faz as configurações do BOT 40 | # #:===============================================================:# 41 | valor_entrada_incial = 100 42 | stop_loss = 1200 43 | stop_win = 800 44 | quantidade_martigale = 2 45 | pariedade = 'EURUSD-OTC' 46 | tipo_pariedade = 'DIGITAL' 47 | 48 | # Aqui você faz as configurações da sua conta IQ Opetion 49 | # #:===============================================================:# 50 | login = 'COLOQUE AQUI SEU EMAIL IQ' 51 | password = 'COLOQUE AQUI SUA SENHA IQ' 52 | account_type = 'PRACTICE' 53 | 54 | # Aqui começa a configuração da API, não alterar 55 | # #:===============================================================:# 56 | iq = IQ_Option(login, password) 57 | if not verificar_se_fez_a_conexao(iq, account_type): 58 | sys.exit(0) 59 | 60 | currency_account = iq.get_currency() 61 | account_balance = iq.get_balance() 62 | 63 | print('#:===============================================================:#') 64 | print(f"This is your API version {IQ_Option.__version__}") 65 | print('#:===============================================================:#') 66 | print(f"Welcome: {login}") 67 | print( 68 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: {format_currency_value(currency_account, account_balance)}") 69 | print('#:===============================================================:#') 70 | 71 | # Variáveis de controle do BOT, não alterar 72 | # #:===============================================================:# 73 | lucro_atual = 0 74 | valor_entrada_atual = valor_entrada_incial 75 | quantidade_martigale_executado = -1 76 | executar_martingale = False 77 | 78 | print('#:===============================================================:#') 79 | print(f'Executando estratégia MHI 2 MINORIA') 80 | print(f"Data: {datetime.now().strftime('%Y-%m-%d %H:M')}") 81 | print(f'Pariedade: {pariedade}') 82 | print(f'Valor Entrada: {format_currency_value(currency_account, valor_entrada_incial)}') 83 | print(f'Stop loss: {format_currency_value(currency_account, stop_loss)}') 84 | print(f'Stop Win: {format_currency_value(currency_account, stop_win)}') 85 | print(f'Maximo Marigales: {quantidade_martigale}') 86 | print('#:===============================================================:#') 87 | 88 | 89 | def verificar_stops(_stop_loss: float, _stop_win: float, _lucro_atual: float, _valor_entrada_atual: float, 90 | _show_message: bool = True) -> bool: 91 | if _lucro_atual >= _stop_win: 92 | if _show_message: 93 | print(f'Stop Win atingido!') 94 | return True 95 | 96 | if _lucro_atual < 0: 97 | if abs(_lucro_atual) + _valor_entrada_atual >= _stop_loss: 98 | if _show_message: 99 | print(f'Stop Loss atingido, ou valor muito próximo!') 100 | return True 101 | 102 | return False 103 | 104 | 105 | def aguardar_horario_entrada(_iq: IQ_Option, _pariedade: str) -> list: 106 | print('>>>>>>>>>>>>>>> Aguardando horário de entrada', end='\r') 107 | print() 108 | while True: 109 | minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) 110 | if (5.59 <= minutos <= 6) or minutos == 0.59: 111 | return _iq.get_candles(_pariedade, 60, 3, time.time() - 60) 112 | 113 | 114 | def validar_estrategia(_candles: list) -> [bool, str]: 115 | print('>>>>>>>>>>>>>>> Validando estratégia', end='\r') 116 | print() 117 | cores = get_color_candle(_candles[0]) + get_color_candle(_candles[1]) + get_color_candle(_candles[2]) 118 | if cores.count('D'): 119 | return False, "None" 120 | elif cores.count('G') > cores.count('R'): 121 | return True, 'PUT' 122 | else: 123 | return True, 'CALL' 124 | 125 | 126 | def executar_entrada(_iq: IQ_Option, _pariedade: str, _tipo_pariedade: str, _direcao: str, _valor_entrada_atual: float, 127 | _quantidade_martigale_executado: int) -> [str, float]: 128 | status, order_id = _iq.buy_digital_spot(_pariedade, _valor_entrada_atual, _direcao.upper(), 1) \ 129 | if _tipo_pariedade.upper() == 'DIGITAL' else _iq.buy(_valor_entrada_atual, _pariedade, _direcao.upper(), 1) 130 | 131 | if quantidade_martigale_executado == -1: 132 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 133 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 134 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 135 | else: 136 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 137 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 138 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, Martingale nível: {_quantidade_martigale_executado + 1}, " 139 | f"em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 140 | 141 | if status: 142 | print(f">>>>>>>>>>>>>>> Aguardando resultado da operação") 143 | while True: 144 | status, reusltado = _iq.check_win_digital_v2( 145 | order_id) if _tipo_pariedade.upper() == 'DIGITAL' else _iq.check_win_v4(order_id) 146 | if status: 147 | if reusltado > 0: 148 | return 'WIN', float(reusltado) 149 | else: 150 | return 'LOSS', float(_valor_entrada_atual) 151 | 152 | return 'ERROR', float(0) 153 | 154 | 155 | print('>>>>>>>>>>>>>>> Iniciando operações') 156 | while not verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual): 157 | candles = aguardar_horario_entrada(iq, pariedade) 158 | estrategia_valida, direcao = validar_estrategia(candles) 159 | 160 | if estrategia_valida: 161 | 162 | while True: 163 | 164 | if quantidade_martigale > quantidade_martigale_executado: 165 | resultado, valor = executar_entrada(iq, pariedade, tipo_pariedade, direcao, valor_entrada_atual, 166 | quantidade_martigale_executado) 167 | 168 | if resultado == 'LOSS': 169 | lucro_atual -= valor 170 | print( 171 | f">>>>>>>>>>>>>>> Resulatdo da operação foi LOSS, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 172 | quantidade_martigale_executado += 1 173 | valor_entrada_atual = valor_entrada_atual * 2 174 | else: 175 | lucro_atual += valor 176 | print( 177 | f">>>>>>>>>>>>>>> Resulatdo da operação foi WIN, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 178 | valor_entrada_atual = valor_entrada_incial 179 | quantidade_martigale_executado = -1 180 | break 181 | else: 182 | quantidade_martigale_executado = -1 183 | valor_entrada_atual = valor_entrada_incial 184 | break 185 | 186 | if verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual, False): 187 | break 188 | else: 189 | print(">>>>>>>>>>>>>>> Pulando entrada atual, alto risco de LOSS") 190 | time.sleep(5) 191 | -------------------------------------------------------------------------------- /bots/mhi_tres_maioria.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import sys 3 | import time 4 | from datetime import datetime 5 | 6 | from iqoptionapi.stable_api import IQ_Option 7 | 8 | 9 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 10 | check, reason = _iq.connect() 11 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 12 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 13 | if check: 14 | print("Start your application") 15 | _iq.change_balance(_account_type) 16 | return True 17 | else: 18 | if reason == "[Errno -2] Name or service not known": 19 | print("No Network") 20 | elif reason == error_password: 21 | error_message = ast.literal_eval(error_password) 22 | print(error_message['message']) 23 | elif reason == requests_limit_exceeded: 24 | error_message = ast.literal_eval(requests_limit_exceeded) 25 | print(error_message['message']) 26 | 27 | print("Finishing application, check your data and try again.") 28 | return False 29 | 30 | 31 | def format_currency_value(_currency_account: str, _value: float) -> str: 32 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 33 | 34 | 35 | def get_color_candle(_candle: dict) -> str: 36 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 37 | 38 | 39 | # Aqui você faz as configurações do BOT 40 | # #:===============================================================:# 41 | valor_entrada_incial = 100 42 | stop_loss = 1200 43 | stop_win = 800 44 | quantidade_martigale = 2 45 | pariedade = 'EURUSD-OTC' 46 | tipo_pariedade = 'DIGITAL' 47 | 48 | # Aqui você faz as configurações da sua conta IQ Opetion 49 | # #:===============================================================:# 50 | login = 'COLOQUE AQUI SEU EMAIL IQ' 51 | password = 'COLOQUE AQUI SUA SENHA IQ' 52 | account_type = 'PRACTICE' 53 | 54 | # Aqui começa a configuração da API, não alterar 55 | # #:===============================================================:# 56 | iq = IQ_Option(login, password) 57 | if not verificar_se_fez_a_conexao(iq, account_type): 58 | sys.exit(0) 59 | 60 | currency_account = iq.get_currency() 61 | account_balance = iq.get_balance() 62 | 63 | print('#:===============================================================:#') 64 | print(f"This is your API version {IQ_Option.__version__}") 65 | print('#:===============================================================:#') 66 | print(f"Welcome: {login}") 67 | print( 68 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: {format_currency_value(currency_account, account_balance)}") 69 | print('#:===============================================================:#') 70 | 71 | # Variáveis de controle do BOT, não alterar 72 | # #:===============================================================:# 73 | lucro_atual = 0 74 | valor_entrada_atual = valor_entrada_incial 75 | quantidade_martigale_executado = -1 76 | executar_martingale = False 77 | 78 | print('#:===============================================================:#') 79 | print(f'Executando estratégia MHI 3 MAIORIA') 80 | print(f"Data: {datetime.now().strftime('%Y-%m-%d %H:M')}") 81 | print(f'Pariedade: {pariedade}') 82 | print(f'Valor Entrada: {format_currency_value(currency_account, valor_entrada_incial)}') 83 | print(f'Stop loss: {format_currency_value(currency_account, stop_loss)}') 84 | print(f'Stop Win: {format_currency_value(currency_account, stop_win)}') 85 | print(f'Maximo Marigales: {quantidade_martigale}') 86 | print('#:===============================================================:#') 87 | 88 | 89 | def verificar_stops(_stop_loss: float, _stop_win: float, _lucro_atual: float, _valor_entrada_atual: float, 90 | _show_message: bool = True) -> bool: 91 | if _lucro_atual >= _stop_win: 92 | if _show_message: 93 | print(f'Stop Win atingido!') 94 | return True 95 | 96 | if _lucro_atual < 0: 97 | if abs(_lucro_atual) + _valor_entrada_atual >= _stop_loss: 98 | if _show_message: 99 | print(f'Stop Loss atingido, ou valor muito próximo!') 100 | return True 101 | 102 | return False 103 | 104 | 105 | def aguardar_horario_entrada(_iq: IQ_Option, _pariedade: str) -> list: 106 | print('>>>>>>>>>>>>>>> Aguardando horário de entrada', end='\r') 107 | print() 108 | while True: 109 | minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) 110 | if (6.59 <= minutos <= 7) or minutos == 1.59: 111 | return _iq.get_candles(_pariedade, 60, 3, time.time() - 120) 112 | 113 | 114 | def validar_estrategia(_candles: list) -> [bool, str]: 115 | print('>>>>>>>>>>>>>>> Validando estratégia', end='\r') 116 | print() 117 | cores = get_color_candle(_candles[0]) + get_color_candle(_candles[1]) + get_color_candle(_candles[2]) 118 | if cores.count('D'): 119 | return False, "None" 120 | elif cores.count('G') > cores.count('R'): 121 | return True, 'CALL' 122 | else: 123 | return True, 'PUT' 124 | 125 | 126 | def executar_entrada(_iq: IQ_Option, _pariedade: str, _tipo_pariedade: str, _direcao: str, _valor_entrada_atual: float, 127 | _quantidade_martigale_executado: int) -> [str, float]: 128 | status, order_id = _iq.buy_digital_spot(_pariedade, _valor_entrada_atual, _direcao.upper(), 1) \ 129 | if _tipo_pariedade.upper() == 'DIGITAL' else _iq.buy(_valor_entrada_atual, _pariedade, _direcao.upper(), 1) 130 | 131 | if quantidade_martigale_executado == -1: 132 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 133 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 134 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 135 | else: 136 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 137 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 138 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, Martingale nível: {_quantidade_martigale_executado + 1}, " 139 | f"em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 140 | 141 | if status: 142 | print(f">>>>>>>>>>>>>>> Aguardando resultado da operação") 143 | while True: 144 | status, reusltado = _iq.check_win_digital_v2( 145 | order_id) if _tipo_pariedade.upper() == 'DIGITAL' else _iq.check_win_v4(order_id) 146 | if status: 147 | if reusltado > 0: 148 | return 'WIN', float(reusltado) 149 | else: 150 | return 'LOSS', float(_valor_entrada_atual) 151 | 152 | return 'ERROR', float(0) 153 | 154 | 155 | print('>>>>>>>>>>>>>>> Iniciando operações') 156 | while not verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual): 157 | candles = aguardar_horario_entrada(iq, pariedade) 158 | estrategia_valida, direcao = validar_estrategia(candles) 159 | 160 | if estrategia_valida: 161 | 162 | while True: 163 | 164 | if quantidade_martigale > quantidade_martigale_executado: 165 | resultado, valor = executar_entrada(iq, pariedade, tipo_pariedade, direcao, valor_entrada_atual, 166 | quantidade_martigale_executado) 167 | 168 | if resultado == 'LOSS': 169 | lucro_atual -= valor 170 | print( 171 | f">>>>>>>>>>>>>>> Resulatdo da operação foi LOSS, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 172 | quantidade_martigale_executado += 1 173 | valor_entrada_atual = valor_entrada_atual * 2 174 | else: 175 | lucro_atual += valor 176 | print( 177 | f">>>>>>>>>>>>>>> Resulatdo da operação foi WIN, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 178 | valor_entrada_atual = valor_entrada_incial 179 | quantidade_martigale_executado = -1 180 | break 181 | else: 182 | quantidade_martigale_executado = -1 183 | valor_entrada_atual = valor_entrada_incial 184 | break 185 | 186 | if verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual, False): 187 | break 188 | else: 189 | print(">>>>>>>>>>>>>>> Pulando entrada atual, alto risco de LOSS") 190 | time.sleep(5) 191 | -------------------------------------------------------------------------------- /bots/mhi_tres_minoria.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import sys 3 | import time 4 | from datetime import datetime 5 | 6 | from iqoptionapi.stable_api import IQ_Option 7 | 8 | 9 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 10 | check, reason = _iq.connect() 11 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 12 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 13 | if check: 14 | print("Start your application") 15 | _iq.change_balance(_account_type) 16 | return True 17 | else: 18 | if reason == "[Errno -2] Name or service not known": 19 | print("No Network") 20 | elif reason == error_password: 21 | error_message = ast.literal_eval(error_password) 22 | print(error_message['message']) 23 | elif reason == requests_limit_exceeded: 24 | error_message = ast.literal_eval(requests_limit_exceeded) 25 | print(error_message['message']) 26 | 27 | print("Finishing application, check your data and try again.") 28 | return False 29 | 30 | 31 | def format_currency_value(_currency_account: str, _value: float) -> str: 32 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 33 | 34 | 35 | def get_color_candle(_candle: dict) -> str: 36 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 37 | 38 | 39 | # Aqui você faz as configurações do BOT 40 | # #:===============================================================:# 41 | valor_entrada_incial = 100 42 | stop_loss = 1200 43 | stop_win = 800 44 | quantidade_martigale = 2 45 | pariedade = 'EURUSD-OTC' 46 | tipo_pariedade = 'DIGITAL' 47 | 48 | # Aqui você faz as configurações da sua conta IQ Opetion 49 | # #:===============================================================:# 50 | login = 'COLOQUE AQUI SEU EMAIL IQ' 51 | password = 'COLOQUE AQUI SUA SENHA IQ' 52 | account_type = 'PRACTICE' 53 | 54 | # Aqui começa a configuração da API, não alterar 55 | # #:===============================================================:# 56 | iq = IQ_Option(login, password) 57 | if not verificar_se_fez_a_conexao(iq, account_type): 58 | sys.exit(0) 59 | 60 | currency_account = iq.get_currency() 61 | account_balance = iq.get_balance() 62 | 63 | print('#:===============================================================:#') 64 | print(f"This is your API version {IQ_Option.__version__}") 65 | print('#:===============================================================:#') 66 | print(f"Welcome: {login}") 67 | print( 68 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: {format_currency_value(currency_account, account_balance)}") 69 | print('#:===============================================================:#') 70 | 71 | # Variáveis de controle do BOT, não alterar 72 | # #:===============================================================:# 73 | lucro_atual = 0 74 | valor_entrada_atual = valor_entrada_incial 75 | quantidade_martigale_executado = -1 76 | executar_martingale = False 77 | 78 | print('#:===============================================================:#') 79 | print(f'Executando estratégia MHI 3 MINORIA') 80 | print(f"Data: {datetime.now().strftime('%Y-%m-%d %H:M')}") 81 | print(f'Pariedade: {pariedade}') 82 | print(f'Valor Entrada: {format_currency_value(currency_account, valor_entrada_incial)}') 83 | print(f'Stop loss: {format_currency_value(currency_account, stop_loss)}') 84 | print(f'Stop Win: {format_currency_value(currency_account, stop_win)}') 85 | print(f'Maximo Marigales: {quantidade_martigale}') 86 | print('#:===============================================================:#') 87 | 88 | 89 | def verificar_stops(_stop_loss: float, _stop_win: float, _lucro_atual: float, _valor_entrada_atual: float, 90 | _show_message: bool = True) -> bool: 91 | if _lucro_atual >= _stop_win: 92 | if _show_message: 93 | print(f'Stop Win atingido!') 94 | return True 95 | 96 | if _lucro_atual < 0: 97 | if abs(_lucro_atual) + _valor_entrada_atual >= _stop_loss: 98 | if _show_message: 99 | print(f'Stop Loss atingido, ou valor muito próximo!') 100 | return True 101 | 102 | return False 103 | 104 | 105 | def aguardar_horario_entrada(_iq: IQ_Option, _pariedade: str) -> list: 106 | print('>>>>>>>>>>>>>>> Aguardando horário de entrada', end='\r') 107 | print() 108 | while True: 109 | minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) 110 | if (6.59 <= minutos <= 7) or minutos == 1.59: 111 | return _iq.get_candles(_pariedade, 60, 3, time.time() - 120) 112 | 113 | 114 | def validar_estrategia(_candles: list) -> [bool, str]: 115 | print('>>>>>>>>>>>>>>> Validando estratégia', end='\r') 116 | print() 117 | cores = get_color_candle(_candles[0]) + get_color_candle(_candles[1]) + get_color_candle(_candles[2]) 118 | if cores.count('D'): 119 | return False, "None" 120 | elif cores.count('G') > cores.count('R'): 121 | return True, 'PUT' 122 | else: 123 | return True, 'CALL' 124 | 125 | 126 | def executar_entrada(_iq: IQ_Option, _pariedade: str, _tipo_pariedade: str, _direcao: str, _valor_entrada_atual: float, 127 | _quantidade_martigale_executado: int) -> [str, float]: 128 | status, order_id = _iq.buy_digital_spot(_pariedade, _valor_entrada_atual, _direcao.upper(), 1) \ 129 | if _tipo_pariedade.upper() == 'DIGITAL' else _iq.buy(_valor_entrada_atual, _pariedade, _direcao.upper(), 1) 130 | 131 | if quantidade_martigale_executado == -1: 132 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 133 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 134 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 135 | else: 136 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 137 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 138 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, Martingale nível: {_quantidade_martigale_executado + 1}, " 139 | f"em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 140 | 141 | if status: 142 | print(f">>>>>>>>>>>>>>> Aguardando resultado da operação") 143 | while True: 144 | status, reusltado = _iq.check_win_digital_v2( 145 | order_id) if _tipo_pariedade.upper() == 'DIGITAL' else _iq.check_win_v4(order_id) 146 | if status: 147 | if reusltado > 0: 148 | return 'WIN', float(reusltado) 149 | else: 150 | return 'LOSS', float(_valor_entrada_atual) 151 | 152 | return 'ERROR', float(0) 153 | 154 | 155 | print('>>>>>>>>>>>>>>> Iniciando operações') 156 | while not verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual): 157 | candles = aguardar_horario_entrada(iq, pariedade) 158 | estrategia_valida, direcao = validar_estrategia(candles) 159 | 160 | if estrategia_valida: 161 | 162 | while True: 163 | 164 | if quantidade_martigale > quantidade_martigale_executado: 165 | resultado, valor = executar_entrada(iq, pariedade, tipo_pariedade, direcao, valor_entrada_atual, 166 | quantidade_martigale_executado) 167 | 168 | if resultado == 'LOSS': 169 | lucro_atual -= valor 170 | print( 171 | f">>>>>>>>>>>>>>> Resulatdo da operação foi LOSS, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 172 | quantidade_martigale_executado += 1 173 | valor_entrada_atual = valor_entrada_atual * 2 174 | else: 175 | lucro_atual += valor 176 | print( 177 | f">>>>>>>>>>>>>>> Resulatdo da operação foi WIN, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 178 | valor_entrada_atual = valor_entrada_incial 179 | quantidade_martigale_executado = -1 180 | break 181 | else: 182 | quantidade_martigale_executado = -1 183 | valor_entrada_atual = valor_entrada_incial 184 | break 185 | 186 | if verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual, False): 187 | break 188 | else: 189 | print(">>>>>>>>>>>>>>> Pulando entrada atual, alto risco de LOSS") 190 | time.sleep(5) 191 | -------------------------------------------------------------------------------- /bots/vituxo_dois_zero_maioria.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import sys 3 | import time 4 | from datetime import datetime 5 | 6 | from iqoptionapi.stable_api import IQ_Option 7 | 8 | 9 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 10 | check, reason = _iq.connect() 11 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 12 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 13 | if check: 14 | print("Start your application") 15 | _iq.change_balance(_account_type) 16 | return True 17 | else: 18 | if reason == "[Errno -2] Name or service not known": 19 | print("No Network") 20 | elif reason == error_password: 21 | error_message = ast.literal_eval(error_password) 22 | print(error_message['message']) 23 | elif reason == requests_limit_exceeded: 24 | error_message = ast.literal_eval(requests_limit_exceeded) 25 | print(error_message['message']) 26 | 27 | print("Finishing application, check your data and try again.") 28 | return False 29 | 30 | 31 | def format_currency_value(_currency_account: str, _value: float) -> str: 32 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 33 | 34 | 35 | def get_color_candle(_candle: dict) -> str: 36 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 37 | 38 | 39 | # Aqui você faz as configurações do BOT 40 | # #:===============================================================:# 41 | valor_entrada_incial = 100 42 | stop_loss = 1200 43 | stop_win = 800 44 | quantidade_martigale = 2 45 | pariedade = 'EURUSD' 46 | tipo_pariedade = 'DIGITAL' 47 | 48 | # Aqui você faz as configurações da sua conta IQ Opetion 49 | # #:===============================================================:# 50 | login = 'COLOQUE AQUI SEU EMAIL IQ' 51 | password = 'COLOQUE AQUI SUA SENHA IQ' 52 | account_type = 'PRACTICE' 53 | 54 | # Aqui começa a configuração da API, não alterar 55 | # #:===============================================================:# 56 | iq = IQ_Option(login, password) 57 | if not verificar_se_fez_a_conexao(iq, account_type): 58 | sys.exit(0) 59 | 60 | currency_account = iq.get_currency() 61 | account_balance = iq.get_balance() 62 | 63 | print('#:===============================================================:#') 64 | print(f"This is your API version {IQ_Option.__version__}") 65 | print('#:===============================================================:#') 66 | print(f"Welcome: {login}") 67 | print( 68 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: {format_currency_value(currency_account, account_balance)}") 69 | print('#:===============================================================:#') 70 | 71 | # Variáveis de controle do BOT, não alterar 72 | # #:===============================================================:# 73 | lucro_atual = 0 74 | valor_entrada_atual = valor_entrada_incial 75 | quantidade_martigale_executado = -1 76 | executar_martingale = False 77 | 78 | print('#:===============================================================:#') 79 | print(f'Executando estratégia VITUXO 2.0 MAIORIA') 80 | print(f"Data: {datetime.now().strftime('%Y-%m-%d %H:M')}") 81 | print(f'Pariedade: {pariedade}') 82 | print(f'Valor Entrada: {format_currency_value(currency_account, valor_entrada_incial)}') 83 | print(f'Stop loss: {format_currency_value(currency_account, stop_loss)}') 84 | print(f'Stop Win: {format_currency_value(currency_account, stop_win)}') 85 | print(f'Maximo Marigales: {quantidade_martigale}') 86 | print('#:===============================================================:#') 87 | 88 | 89 | def verificar_stops(_stop_loss: float, _stop_win: float, _lucro_atual: float, _valor_entrada_atual: float, 90 | _show_message: bool = True) -> bool: 91 | if _lucro_atual >= _stop_win: 92 | if _show_message: 93 | print(f'Stop Win atingido!') 94 | return True 95 | 96 | if _lucro_atual < 0: 97 | if abs(_lucro_atual) + _valor_entrada_atual >= _stop_loss: 98 | if _show_message: 99 | print(f'Stop Loss atingido, ou valor muito próximo!') 100 | return True 101 | 102 | return False 103 | 104 | 105 | def aguardar_horario_entrada(_iq: IQ_Option, _pariedade: str) -> list: 106 | print('>>>>>>>>>>>>>>> Aguardando horário de entrada', end='\r') 107 | print() 108 | while True: 109 | minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) 110 | if (6.59 <= minutos <= 7) or minutos == 1.59: 111 | return _iq.get_candles(_pariedade, 60, 3, time.time() - 240) 112 | 113 | 114 | def validar_estrategia(_candles: list) -> [bool, str]: 115 | print('>>>>>>>>>>>>>>> Validando estratégia', end='\r') 116 | print() 117 | cores = get_color_candle(_candles[0]) + get_color_candle(_candles[1]) + get_color_candle(_candles[2]) 118 | if cores.count('D'): 119 | return False, "None" 120 | elif cores.count('G') > cores.count('R'): 121 | return True, 'CALL' 122 | else: 123 | return True, 'PUT' 124 | 125 | 126 | def executar_entrada(_iq: IQ_Option, _pariedade: str, _tipo_pariedade: str, _direcao: str, _valor_entrada_atual: float, 127 | _quantidade_martigale_executado: int) -> [str, float]: 128 | status, order_id = _iq.buy_digital_spot(_pariedade, _valor_entrada_atual, _direcao.upper(), 1) \ 129 | if _tipo_pariedade.upper() == 'DIGITAL' else _iq.buy(_valor_entrada_atual, _pariedade, _direcao.upper(), 1) 130 | 131 | if quantidade_martigale_executado == -1: 132 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 133 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 134 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 135 | else: 136 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 137 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 138 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, Martingale nível: {_quantidade_martigale_executado + 1}, " 139 | f"em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 140 | 141 | if status: 142 | print(f">>>>>>>>>>>>>>> Aguardando resultado da operação") 143 | while True: 144 | status, reusltado = _iq.check_win_digital_v2( 145 | order_id) if _tipo_pariedade.upper() == 'DIGITAL' else _iq.check_win_v4(order_id) 146 | if status: 147 | if reusltado > 0: 148 | return 'WIN', float(reusltado) 149 | else: 150 | return 'LOSS', float(_valor_entrada_atual) 151 | 152 | return 'ERROR', float(0) 153 | 154 | 155 | print('>>>>>>>>>>>>>>> Iniciando operações') 156 | while not verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual): 157 | candles = aguardar_horario_entrada(iq, pariedade) 158 | estrategia_valida, direcao = validar_estrategia(candles) 159 | 160 | if estrategia_valida: 161 | 162 | while True: 163 | 164 | if quantidade_martigale > quantidade_martigale_executado: 165 | resultado, valor = executar_entrada(iq, pariedade, tipo_pariedade, direcao, valor_entrada_atual, 166 | quantidade_martigale_executado) 167 | 168 | if resultado == 'LOSS': 169 | lucro_atual -= valor 170 | print( 171 | f">>>>>>>>>>>>>>> Resulatdo da operação foi LOSS, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 172 | quantidade_martigale_executado += 1 173 | valor_entrada_atual = valor_entrada_atual * 2 174 | else: 175 | lucro_atual += valor 176 | print( 177 | f">>>>>>>>>>>>>>> Resulatdo da operação foi WIN, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 178 | valor_entrada_atual = valor_entrada_incial 179 | quantidade_martigale_executado = -1 180 | break 181 | else: 182 | quantidade_martigale_executado = -1 183 | valor_entrada_atual = valor_entrada_incial 184 | break 185 | 186 | if verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual, False): 187 | break 188 | else: 189 | print(">>>>>>>>>>>>>>> Pulando entrada atual, alto risco de LOSS") 190 | time.sleep(5) 191 | -------------------------------------------------------------------------------- /bots/vituxo_dois_zero_minoria.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import sys 3 | import time 4 | from datetime import datetime 5 | 6 | from iqoptionapi.stable_api import IQ_Option 7 | 8 | 9 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 10 | check, reason = _iq.connect() 11 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 12 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 13 | if check: 14 | print("Start your application") 15 | _iq.change_balance(_account_type) 16 | return True 17 | else: 18 | if reason == "[Errno -2] Name or service not known": 19 | print("No Network") 20 | elif reason == error_password: 21 | error_message = ast.literal_eval(error_password) 22 | print(error_message['message']) 23 | elif reason == requests_limit_exceeded: 24 | error_message = ast.literal_eval(requests_limit_exceeded) 25 | print(error_message['message']) 26 | 27 | print("Finishing application, check your data and try again.") 28 | return False 29 | 30 | 31 | def format_currency_value(_currency_account: str, _value: float) -> str: 32 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 33 | 34 | 35 | def get_color_candle(_candle: dict) -> str: 36 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 37 | 38 | 39 | # Aqui você faz as configurações do BOT 40 | # #:===============================================================:# 41 | valor_entrada_incial = 100 42 | stop_loss = 1200 43 | stop_win = 800 44 | quantidade_martigale = 2 45 | pariedade = 'EURUSD' 46 | tipo_pariedade = 'DIGITAL' 47 | 48 | # Aqui você faz as configurações da sua conta IQ Opetion 49 | # #:===============================================================:# 50 | login = 'COLOQUE AQUI SEU EMAIL IQ' 51 | password = 'COLOQUE AQUI SUA SENHA IQ' 52 | account_type = 'PRACTICE' 53 | 54 | # Aqui começa a configuração da API, não alterar 55 | # #:===============================================================:# 56 | iq = IQ_Option(login, password) 57 | if not verificar_se_fez_a_conexao(iq, account_type): 58 | sys.exit(0) 59 | 60 | currency_account = iq.get_currency() 61 | account_balance = iq.get_balance() 62 | 63 | print('#:===============================================================:#') 64 | print(f"This is your API version {IQ_Option.__version__}") 65 | print('#:===============================================================:#') 66 | print(f"Welcome: {login}") 67 | print( 68 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: {format_currency_value(currency_account, account_balance)}") 69 | print('#:===============================================================:#') 70 | 71 | # Variáveis de controle do BOT, não alterar 72 | # #:===============================================================:# 73 | lucro_atual = 0 74 | valor_entrada_atual = valor_entrada_incial 75 | quantidade_martigale_executado = -1 76 | executar_martingale = False 77 | 78 | print('#:===============================================================:#') 79 | print(f'Executando estratégia VITUXO 2.0 MINORIA') 80 | print(f"Data: {datetime.now().strftime('%Y-%m-%d %H:M')}") 81 | print(f'Pariedade: {pariedade}') 82 | print(f'Valor Entrada: {format_currency_value(currency_account, valor_entrada_incial)}') 83 | print(f'Stop loss: {format_currency_value(currency_account, stop_loss)}') 84 | print(f'Stop Win: {format_currency_value(currency_account, stop_win)}') 85 | print(f'Maximo Marigales: {quantidade_martigale}') 86 | print('#:===============================================================:#') 87 | 88 | 89 | def verificar_stops(_stop_loss: float, _stop_win: float, _lucro_atual: float, _valor_entrada_atual: float, 90 | _show_message: bool = True) -> bool: 91 | if _lucro_atual >= _stop_win: 92 | if _show_message: 93 | print(f'Stop Win atingido!') 94 | return True 95 | 96 | if _lucro_atual < 0: 97 | if abs(_lucro_atual) + _valor_entrada_atual >= _stop_loss: 98 | if _show_message: 99 | print(f'Stop Loss atingido, ou valor muito próximo!') 100 | return True 101 | 102 | return False 103 | 104 | 105 | def aguardar_horario_entrada(_iq: IQ_Option, _pariedade: str) -> list: 106 | print('>>>>>>>>>>>>>>> Aguardando horário de entrada', end='\r') 107 | print() 108 | while True: 109 | minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) 110 | if (6.59 <= minutos <= 7) or minutos == 1.59: 111 | return _iq.get_candles(_pariedade, 60, 3, time.time() - 240) 112 | 113 | 114 | def validar_estrategia(_candles: list) -> [bool, str]: 115 | print('>>>>>>>>>>>>>>> Validando estratégia', end='\r') 116 | print() 117 | cores = get_color_candle(_candles[0]) + get_color_candle(_candles[1]) + get_color_candle(_candles[2]) 118 | if cores.count('D'): 119 | return False, "None" 120 | elif cores.count('G') > cores.count('R'): 121 | return True, 'PUT' 122 | else: 123 | return True, 'CALL' 124 | 125 | 126 | def executar_entrada(_iq: IQ_Option, _pariedade: str, _tipo_pariedade: str, _direcao: str, _valor_entrada_atual: float, 127 | _quantidade_martigale_executado: int) -> [str, float]: 128 | status, order_id = _iq.buy_digital_spot(_pariedade, _valor_entrada_atual, _direcao.upper(), 1) \ 129 | if _tipo_pariedade.upper() == 'DIGITAL' else _iq.buy(_valor_entrada_atual, _pariedade, _direcao.upper(), 1) 130 | 131 | if quantidade_martigale_executado == -1: 132 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 133 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 134 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 135 | else: 136 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 137 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 138 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, Martingale nível: {_quantidade_martigale_executado + 1}, " 139 | f"em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 140 | 141 | if status: 142 | print(f">>>>>>>>>>>>>>> Aguardando resultado da operação") 143 | while True: 144 | status, reusltado = _iq.check_win_digital_v2( 145 | order_id) if _tipo_pariedade.upper() == 'DIGITAL' else _iq.check_win_v4(order_id) 146 | if status: 147 | if reusltado > 0: 148 | return 'WIN', float(reusltado) 149 | else: 150 | return 'LOSS', float(_valor_entrada_atual) 151 | 152 | return 'ERROR', float(0) 153 | 154 | 155 | print('>>>>>>>>>>>>>>> Iniciando operações') 156 | while not verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual): 157 | candles = aguardar_horario_entrada(iq, pariedade) 158 | estrategia_valida, direcao = validar_estrategia(candles) 159 | 160 | if estrategia_valida: 161 | 162 | while True: 163 | 164 | if quantidade_martigale > quantidade_martigale_executado: 165 | resultado, valor = executar_entrada(iq, pariedade, tipo_pariedade, direcao, valor_entrada_atual, 166 | quantidade_martigale_executado) 167 | 168 | if resultado == 'LOSS': 169 | lucro_atual -= valor 170 | print( 171 | f">>>>>>>>>>>>>>> Resulatdo da operação foi LOSS, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 172 | quantidade_martigale_executado += 1 173 | valor_entrada_atual = valor_entrada_atual * 2 174 | else: 175 | lucro_atual += valor 176 | print( 177 | f">>>>>>>>>>>>>>> Resulatdo da operação foi WIN, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 178 | valor_entrada_atual = valor_entrada_incial 179 | quantidade_martigale_executado = -1 180 | break 181 | else: 182 | quantidade_martigale_executado = -1 183 | valor_entrada_atual = valor_entrada_incial 184 | break 185 | 186 | if verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual, False): 187 | break 188 | else: 189 | print(">>>>>>>>>>>>>>> Pulando entrada atual, alto risco de LOSS") 190 | time.sleep(5) 191 | -------------------------------------------------------------------------------- /bots/milhao_maioria.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import sys 3 | import time 4 | from datetime import datetime 5 | 6 | from iqoptionapi.stable_api import IQ_Option 7 | 8 | 9 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 10 | check, reason = _iq.connect() 11 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 12 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 13 | if check: 14 | print("Start your application") 15 | _iq.change_balance(_account_type) 16 | return True 17 | else: 18 | if reason == "[Errno -2] Name or service not known": 19 | print("No Network") 20 | elif reason == error_password: 21 | error_message = ast.literal_eval(error_password) 22 | print(error_message['message']) 23 | elif reason == requests_limit_exceeded: 24 | error_message = ast.literal_eval(requests_limit_exceeded) 25 | print(error_message['message']) 26 | 27 | print("Finishing application, check your data and try again.") 28 | return False 29 | 30 | 31 | def format_currency_value(_currency_account: str, _value: float) -> str: 32 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 33 | 34 | 35 | def get_color_candle(_candle: dict) -> str: 36 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 37 | 38 | 39 | # Aqui você faz as configurações do BOT 40 | # #:===============================================================:# 41 | valor_entrada_incial = 100 42 | stop_loss = 1200 43 | stop_win = 800 44 | quantidade_martigale = 2 45 | pariedade = 'EURUSD-OTC' 46 | tipo_pariedade = 'DIGITAL' 47 | 48 | # Aqui você faz as configurações da sua conta IQ Opetion 49 | # #:===============================================================:# 50 | login = 'COLOQUE AQUI SEU EMAIL IQ' 51 | password = 'COLOQUE AQUI SUA SENHA IQ' 52 | account_type = 'PRACTICE' 53 | 54 | # Aqui começa a configuração da API, não alterar 55 | # #:===============================================================:# 56 | iq = IQ_Option(login, password) 57 | if not verificar_se_fez_a_conexao(iq, account_type): 58 | sys.exit(0) 59 | 60 | currency_account = iq.get_currency() 61 | account_balance = iq.get_balance() 62 | 63 | print('#:===============================================================:#') 64 | print(f"This is your API version {IQ_Option.__version__}") 65 | print('#:===============================================================:#') 66 | print(f"Welcome: {login}") 67 | print( 68 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: {format_currency_value(currency_account, account_balance)}") 69 | print('#:===============================================================:#') 70 | 71 | # Variáveis de controle do BOT, não alterar 72 | # #:===============================================================:# 73 | lucro_atual = 0 74 | valor_entrada_atual = valor_entrada_incial 75 | quantidade_martigale_executado = -1 76 | executar_martingale = False 77 | 78 | print('#:===============================================================:#') 79 | print(f'Executando estratégia MILHAO MAIORIA') 80 | print(f"Data: {datetime.now().strftime('%Y-%m-%d %H:M')}") 81 | print(f'Pariedade: {pariedade}') 82 | print(f'Valor Entrada: {format_currency_value(currency_account, valor_entrada_incial)}') 83 | print(f'Stop loss: {format_currency_value(currency_account, stop_loss)}') 84 | print(f'Stop Win: {format_currency_value(currency_account, stop_win)}') 85 | print(f'Maximo Marigales: {quantidade_martigale}') 86 | print('#:===============================================================:#') 87 | 88 | 89 | def verificar_stops(_stop_loss: float, _stop_win: float, _lucro_atual: float, _valor_entrada_atual: float, 90 | _show_message: bool = True) -> bool: 91 | if _lucro_atual >= _stop_win: 92 | if _show_message: 93 | print(f'Stop Win atingido!') 94 | return True 95 | 96 | if _lucro_atual < 0: 97 | if abs(_lucro_atual) + _valor_entrada_atual >= _stop_loss: 98 | if _show_message: 99 | print(f'Stop Loss atingido, ou valor muito próximo!') 100 | return True 101 | 102 | return False 103 | 104 | 105 | def aguardar_horario_entrada(_iq: IQ_Option, _pariedade: str) -> list: 106 | print('>>>>>>>>>>>>>>> Aguardando horário de entrada', end='\r') 107 | print() 108 | while True: 109 | minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) 110 | if (4.59 <= minutos <= 5) or minutos == 9.59: 111 | return _iq.get_candles(_pariedade, 60, 5, time.time()) 112 | 113 | 114 | def validar_estrategia(_candles: list) -> [bool, str]: 115 | print('>>>>>>>>>>>>>>> Validando estratégia', end='\r') 116 | print() 117 | cores = get_color_candle(_candles[0]) + get_color_candle(_candles[1]) + get_color_candle( 118 | _candles[2]) + get_color_candle(_candles[3]) + get_color_candle(_candles[4]) 119 | if cores.count('D'): 120 | return False, "None" 121 | elif cores.count('G') > cores.count('R'): 122 | return True, 'CALL' 123 | else: 124 | return True, 'PUT' 125 | 126 | 127 | def executar_entrada(_iq: IQ_Option, _pariedade: str, _tipo_pariedade: str, _direcao: str, _valor_entrada_atual: float, 128 | _quantidade_martigale_executado: int) -> [str, float]: 129 | status, order_id = _iq.buy_digital_spot(_pariedade, _valor_entrada_atual, _direcao.upper(), 1) \ 130 | if _tipo_pariedade.upper() == 'DIGITAL' else _iq.buy(_valor_entrada_atual, _pariedade, _direcao.upper(), 1) 131 | 132 | if quantidade_martigale_executado == -1: 133 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 134 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 135 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 136 | else: 137 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 138 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 139 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, Martingale nível: {_quantidade_martigale_executado + 1}, " 140 | f"em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 141 | 142 | if status: 143 | print(f">>>>>>>>>>>>>>> Aguardando resultado da operação") 144 | while True: 145 | status, reusltado = _iq.check_win_digital_v2( 146 | order_id) if _tipo_pariedade.upper() == 'DIGITAL' else _iq.check_win_v4(order_id) 147 | if status: 148 | if reusltado > 0: 149 | return 'WIN', float(reusltado) 150 | else: 151 | return 'LOSS', float(_valor_entrada_atual) 152 | 153 | return 'ERROR', float(0) 154 | 155 | 156 | print('>>>>>>>>>>>>>>> Iniciando operações') 157 | while not verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual): 158 | candles = aguardar_horario_entrada(iq, pariedade) 159 | estrategia_valida, direcao = validar_estrategia(candles) 160 | 161 | if estrategia_valida: 162 | 163 | while True: 164 | 165 | if quantidade_martigale > quantidade_martigale_executado: 166 | resultado, valor = executar_entrada(iq, pariedade, tipo_pariedade, direcao, valor_entrada_atual, 167 | quantidade_martigale_executado) 168 | 169 | if resultado == 'LOSS': 170 | lucro_atual -= valor 171 | print( 172 | f">>>>>>>>>>>>>>> Resulatdo da operação foi LOSS, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 173 | quantidade_martigale_executado += 1 174 | valor_entrada_atual = valor_entrada_atual * 2 175 | else: 176 | lucro_atual += valor 177 | print( 178 | f">>>>>>>>>>>>>>> Resulatdo da operação foi WIN, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 179 | valor_entrada_atual = valor_entrada_incial 180 | quantidade_martigale_executado = -1 181 | break 182 | else: 183 | quantidade_martigale_executado = -1 184 | valor_entrada_atual = valor_entrada_incial 185 | break 186 | 187 | if verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual, False): 188 | break 189 | else: 190 | print(">>>>>>>>>>>>>>> Pulando entrada atual, alto risco de LOSS") 191 | time.sleep(5) 192 | -------------------------------------------------------------------------------- /bots/milhao_minoria.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import sys 3 | import time 4 | from datetime import datetime 5 | 6 | from iqoptionapi.stable_api import IQ_Option 7 | 8 | 9 | def verificar_se_fez_a_conexao(_iq: IQ_Option, _account_type: str = 'PRACTICE') -> bool: 10 | check, reason = _iq.connect() 11 | error_password = """{"code":"invalid_credentials","message":"You entered the wrong credentials. Please check that the login/password is correct."}""" 12 | requests_limit_exceeded = """{"code":"requests_limit_exceeded","message":"The number of requests has been exceeded. Try again in 10 minutes.","ttl":600}""" 13 | if check: 14 | print("Start your application") 15 | _iq.change_balance(_account_type) 16 | return True 17 | else: 18 | if reason == "[Errno -2] Name or service not known": 19 | print("No Network") 20 | elif reason == error_password: 21 | error_message = ast.literal_eval(error_password) 22 | print(error_message['message']) 23 | elif reason == requests_limit_exceeded: 24 | error_message = ast.literal_eval(requests_limit_exceeded) 25 | print(error_message['message']) 26 | 27 | print("Finishing application, check your data and try again.") 28 | return False 29 | 30 | 31 | def format_currency_value(_currency_account: str, _value: float) -> str: 32 | return '$ {:,.2f}'.format(_value) if _currency_account == 'USD' else 'R$ {:,.2f}'.format(_value) 33 | 34 | 35 | def get_color_candle(_candle: dict) -> str: 36 | return 'G' if _candle['open'] < _candle['close'] else 'R' if _candle['open'] > _candle['close'] else 'D' 37 | 38 | 39 | # Aqui você faz as configurações do BOT 40 | # #:===============================================================:# 41 | valor_entrada_incial = 100 42 | stop_loss = 1200 43 | stop_win = 800 44 | quantidade_martigale = 2 45 | pariedade = 'EURUSD-OTC' 46 | tipo_pariedade = 'DIGITAL' 47 | 48 | # Aqui você faz as configurações da sua conta IQ Opetion 49 | # #:===============================================================:# 50 | login = 'COLOQUE AQUI SEU EMAIL IQ' 51 | password = 'COLOQUE AQUI SUA SENHA IQ' 52 | account_type = 'PRACTICE' 53 | 54 | # Aqui começa a configuração da API, não alterar 55 | # #:===============================================================:# 56 | iq = IQ_Option(login, password) 57 | if not verificar_se_fez_a_conexao(iq, account_type): 58 | sys.exit(0) 59 | 60 | currency_account = iq.get_currency() 61 | account_balance = iq.get_balance() 62 | 63 | print('#:===============================================================:#') 64 | print(f"This is your API version {IQ_Option.__version__}") 65 | print('#:===============================================================:#') 66 | print(f"Welcome: {login}") 67 | print( 68 | f"{'Practice account balance' if account_type == 'PRACTICE' else 'Real account balance'}: {format_currency_value(currency_account, account_balance)}") 69 | print('#:===============================================================:#') 70 | 71 | # Variáveis de controle do BOT, não alterar 72 | # #:===============================================================:# 73 | lucro_atual = 0 74 | valor_entrada_atual = valor_entrada_incial 75 | quantidade_martigale_executado = -1 76 | executar_martingale = False 77 | 78 | print('#:===============================================================:#') 79 | print(f'Executando estratégia MILHAO MINORIA') 80 | print(f"Data: {datetime.now().strftime('%Y-%m-%d %H:M')}") 81 | print(f'Pariedade: {pariedade}') 82 | print(f'Valor Entrada: {format_currency_value(currency_account, valor_entrada_incial)}') 83 | print(f'Stop loss: {format_currency_value(currency_account, stop_loss)}') 84 | print(f'Stop Win: {format_currency_value(currency_account, stop_win)}') 85 | print(f'Maximo Marigales: {quantidade_martigale}') 86 | print('#:===============================================================:#') 87 | 88 | 89 | def verificar_stops(_stop_loss: float, _stop_win: float, _lucro_atual: float, _valor_entrada_atual: float, 90 | _show_message: bool = True) -> bool: 91 | if _lucro_atual >= _stop_win: 92 | if _show_message: 93 | print(f'Stop Win atingido!') 94 | return True 95 | 96 | if _lucro_atual < 0: 97 | if abs(_lucro_atual) + _valor_entrada_atual >= _stop_loss: 98 | if _show_message: 99 | print(f'Stop Loss atingido, ou valor muito próximo!') 100 | return True 101 | 102 | return False 103 | 104 | 105 | def aguardar_horario_entrada(_iq: IQ_Option, _pariedade: str) -> list: 106 | print('>>>>>>>>>>>>>>> Aguardando horário de entrada', end='\r') 107 | print() 108 | while True: 109 | minutos = float(((datetime.now()).strftime('%M.%S'))[1:]) 110 | if (4.59 <= minutos <= 5) or minutos == 9.59: 111 | return _iq.get_candles(_pariedade, 60, 5, time.time()) 112 | 113 | 114 | def validar_estrategia(_candles: list) -> [bool, str]: 115 | print('>>>>>>>>>>>>>>> Validando estratégia', end='\r') 116 | print() 117 | cores = get_color_candle(_candles[0]) + get_color_candle(_candles[1]) + get_color_candle( 118 | _candles[2]) + get_color_candle(_candles[3]) + get_color_candle(_candles[4]) 119 | if cores.count('D'): 120 | return False, "None" 121 | elif cores.count('G') > cores.count('R'): 122 | return True, 'PUT' 123 | else: 124 | return True, 'CALL' 125 | 126 | 127 | def executar_entrada(_iq: IQ_Option, _pariedade: str, _tipo_pariedade: str, _direcao: str, _valor_entrada_atual: float, 128 | _quantidade_martigale_executado: int) -> [str, float]: 129 | status, order_id = _iq.buy_digital_spot(_pariedade, _valor_entrada_atual, _direcao.upper(), 1) \ 130 | if _tipo_pariedade.upper() == 'DIGITAL' else _iq.buy(_valor_entrada_atual, _pariedade, _direcao.upper(), 1) 131 | 132 | if quantidade_martigale_executado == -1: 133 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 134 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 135 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 136 | else: 137 | print(f">>>>>>>>>>>>>>> Executando {'compra' if _direcao.upper() == 'CALL' else 'venda'} " 138 | f"{'em digital,' if _tipo_pariedade.upper() == 'DIGITAL' else 'em binaria,'} " 139 | f"moeda {_pariedade} no valor de {format_currency_value(currency_account, _valor_entrada_atual)}, Martingale nível: {_quantidade_martigale_executado + 1}, " 140 | f"em {datetime.now().strftime('%d/%m/%Y as %H:%M:%S')}") 141 | 142 | if status: 143 | print(f">>>>>>>>>>>>>>> Aguardando resultado da operação") 144 | while True: 145 | status, reusltado = _iq.check_win_digital_v2( 146 | order_id) if _tipo_pariedade.upper() == 'DIGITAL' else _iq.check_win_v4(order_id) 147 | if status: 148 | if reusltado > 0: 149 | return 'WIN', float(reusltado) 150 | else: 151 | return 'LOSS', float(_valor_entrada_atual) 152 | 153 | return 'ERROR', float(0) 154 | 155 | 156 | print('>>>>>>>>>>>>>>> Iniciando operações') 157 | while not verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual): 158 | candles = aguardar_horario_entrada(iq, pariedade) 159 | estrategia_valida, direcao = validar_estrategia(candles) 160 | 161 | if estrategia_valida: 162 | 163 | while True: 164 | 165 | if quantidade_martigale > quantidade_martigale_executado: 166 | resultado, valor = executar_entrada(iq, pariedade, tipo_pariedade, direcao, valor_entrada_atual, 167 | quantidade_martigale_executado) 168 | 169 | if resultado == 'LOSS': 170 | lucro_atual -= valor 171 | print( 172 | f">>>>>>>>>>>>>>> Resulatdo da operação foi LOSS, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 173 | quantidade_martigale_executado += 1 174 | valor_entrada_atual = valor_entrada_atual * 2 175 | else: 176 | lucro_atual += valor 177 | print( 178 | f">>>>>>>>>>>>>>> Resulatdo da operação foi WIN, lucro até o momento {format_currency_value(currency_account, lucro_atual)}") 179 | valor_entrada_atual = valor_entrada_incial 180 | quantidade_martigale_executado = -1 181 | break 182 | else: 183 | quantidade_martigale_executado = -1 184 | valor_entrada_atual = valor_entrada_incial 185 | break 186 | 187 | if verificar_stops(stop_loss, stop_win, lucro_atual, valor_entrada_atual, False): 188 | break 189 | else: 190 | print(">>>>>>>>>>>>>>> Pulando entrada atual, alto risco de LOSS") 191 | time.sleep(5) 192 | --------------------------------------------------------------------------------