mtcli 3.2.0.dev0__tar.gz → 3.2.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/PKG-INFO +1 -1
- mtcli-3.2.0.dev1/mtcli/conecta.py +41 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/pyproject.toml +1 -1
- mtcli-3.2.0.dev0/mtcli/conecta.py +0 -18
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/LICENSE +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/README.md +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/commands/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/commands/bars.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/commands/conf.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/commands/logs.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/conf.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/data/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/data/base.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/data/csv.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/data/mt5.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/logger.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/models/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/models/bar_model.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/models/bars_model.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/models/chart_model.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/models/conf_model.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/models/consecutive_bars_model.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/models/rates_model.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/models/signals_model.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/models/unconsecutive_bar_model.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/mt.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/mt5_context.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugin.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/agressao/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/agressao/command.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/agressao/conf.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/agressao/models/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/agressao/models/model_agressao.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/agressao/views/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/agressao/views/view_agressao.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/media_movel/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/media_movel/command.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/media_movel/conf.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/media_movel/models/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/media_movel/models/model_media_movel.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/media_movel/tests/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/media_movel/tests/test_mm.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/media_movel/tests/test_model_media_movel.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/range_medio/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/range_medio/command.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/range_medio/conf.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/range_medio/models/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/range_medio/models/average_range_model.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/range_medio/tests/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/range_medio/tests/test_rm.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/volume_medio/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/volume_medio/command.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/volume_medio/conf.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/volume_medio/models/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/volume_medio/models/model_average_volume.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/volume_medio/tests/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/volume_medio/tests/test_vm.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/__init__.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/close_view.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/full_view.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/high_view.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/low_view.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/min_view.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/open_view.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/ranges_view.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/rates_view.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/vars_view.py +0 -0
- {mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/views/volumes_view.py +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Gerencia a conexão direta com o terminal MetaTrader 5.
|
|
3
|
+
Usado internamente pelo contexto mt5_conexao().
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import MetaTrader5 as mt5
|
|
7
|
+
from mtcli.logger import setup_logger
|
|
8
|
+
|
|
9
|
+
log = setup_logger()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def conectar() -> bool:
|
|
13
|
+
"""
|
|
14
|
+
Inicializa a conexão com o MetaTrader 5.
|
|
15
|
+
|
|
16
|
+
Retorna:
|
|
17
|
+
bool: True se conectado com sucesso, False caso contrário.
|
|
18
|
+
|
|
19
|
+
Levanta:
|
|
20
|
+
ConnectionError: se a inicialização do MT5 falhar.
|
|
21
|
+
"""
|
|
22
|
+
log.debug("Tentando inicializar conexão com MetaTrader 5...")
|
|
23
|
+
|
|
24
|
+
if not mt5.initialize():
|
|
25
|
+
erro = mt5.last_error()
|
|
26
|
+
log.error(f"Erro ao conectar ao MetaTrader 5: {erro}")
|
|
27
|
+
raise ConnectionError(f"Falha ao conectar ao MetaTrader 5: {erro}")
|
|
28
|
+
|
|
29
|
+
log.info("Conexão com MetaTrader 5 estabelecida com sucesso.")
|
|
30
|
+
return True
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def shutdown():
|
|
34
|
+
"""
|
|
35
|
+
Encerra a conexão com o MetaTrader 5 de forma segura.
|
|
36
|
+
"""
|
|
37
|
+
try:
|
|
38
|
+
mt5.shutdown()
|
|
39
|
+
log.debug("Conexão com MetaTrader 5 encerrada.")
|
|
40
|
+
except Exception as e:
|
|
41
|
+
log.error(f"Erro ao encerrar conexão com MetaTrader 5: {e}")
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"""Módulo de conexão com o MetaTrader 5."""
|
|
2
|
-
|
|
3
|
-
import MetaTrader5 as mt5
|
|
4
|
-
from mtcli.logger import setup_logger
|
|
5
|
-
|
|
6
|
-
logger = setup_logger()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def conectar():
|
|
10
|
-
if not mt5.initialize():
|
|
11
|
-
click.echo(f"❌ Erro ao conectar ao MT5: {mt5.last_error()}")
|
|
12
|
-
logger.error(f"Erro ao conectar ao MT5: {mt5.last_error()}")
|
|
13
|
-
exit()
|
|
14
|
-
return True
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def shutdown():
|
|
18
|
-
mt5.shutdown()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/media_movel/tests/test_model_media_movel.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/range_medio/models/average_range_model.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mtcli-3.2.0.dev0 → mtcli-3.2.0.dev1}/mtcli/plugins/volume_medio/models/model_average_volume.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|