mtcli 3.7.0.dev1__tar.gz → 3.7.0.dev2__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.7.0.dev1 → mtcli-3.7.0.dev2}/PKG-INFO +1 -1
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugin_loader.py +35 -35
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/pyproject.toml +1 -1
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/LICENSE +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/README.md +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/cli.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/commands/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/commands/bars.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/commands/conf.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/conecta.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/conf.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/config_registre.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/data/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/data/base.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/data/csv.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/data/mt5.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/database.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/domain/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/domain/timeframe.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/logger.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/marketdata/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/marketdata/tick_cache.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/marketdata/tick_repository.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/models/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/models/bar_model.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/models/bars_model.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/models/chart_model.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/models/conf_model.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/models/consecutive_bars_model.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/models/rates_model.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/models/signals_model.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/models/unconsecutive_bar_model.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/mt5_context.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugin.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugin_manager.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/exemplo.py-dist +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/media_movel/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/media_movel/cli.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/media_movel/conf.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/media_movel/models/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/media_movel/models/model_media_movel.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/media_movel/tests/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/media_movel/tests/test_mm.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/media_movel/tests/test_model_media_movel.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/range_medio/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/range_medio/cli.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/range_medio/conf.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/range_medio/models/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/range_medio/models/average_range_model.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/range_medio/tests/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/range_medio/tests/test_rm.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/volume_medio/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/volume_medio/cli.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/volume_medio/conf.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/volume_medio/models/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/volume_medio/models/model_average_volume.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/volume_medio/tests/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/plugins/volume_medio/tests/test_vm.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/__init__.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/close_view.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/full_view.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/high_view.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/low_view.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/min_view.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/open_view.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/ranges_view.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/rates_view.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/vars_view.py +0 -0
- {mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/mtcli/views/volumes_view.py +0 -0
|
@@ -1,33 +1,12 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Sistema de carregamento de plugins do mtcli.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
instalados via entry points
|
|
4
|
+
Responsável por descobrir e registrar plugins externos
|
|
5
|
+
instalados via entry points.
|
|
6
6
|
|
|
7
7
|
Plugins devem declarar entry points no grupo:
|
|
8
8
|
|
|
9
9
|
mtcli.plugins
|
|
10
|
-
|
|
11
|
-
Um plugin pode expor:
|
|
12
|
-
|
|
13
|
-
1. Uma função ``register(cli)``
|
|
14
|
-
2. Um objeto ``click.Command``
|
|
15
|
-
|
|
16
|
-
Exemplo de entry point no pyproject.toml:
|
|
17
|
-
|
|
18
|
-
[project.entry-points."mtcli.plugins"]
|
|
19
|
-
renko = "mtcli_renko.plugin:register"
|
|
20
|
-
|
|
21
|
-
Ou diretamente um comando:
|
|
22
|
-
|
|
23
|
-
renko = "mtcli_renko.cli:renko"
|
|
24
|
-
|
|
25
|
-
Este loader garante:
|
|
26
|
-
|
|
27
|
-
- compatibilidade com Python 3.8+
|
|
28
|
-
- proteção contra plugins duplicados
|
|
29
|
-
- logging estruturado
|
|
30
|
-
- isolamento de falhas de plugins
|
|
31
10
|
"""
|
|
32
11
|
|
|
33
12
|
from __future__ import annotations
|
|
@@ -55,16 +34,22 @@ def discover_plugins() -> Iterable[EntryPoint]:
|
|
|
55
34
|
Returns
|
|
56
35
|
-------
|
|
57
36
|
Iterable[EntryPoint]
|
|
58
|
-
|
|
37
|
+
Entry points encontrados no grupo ``mtcli.plugins``.
|
|
59
38
|
"""
|
|
60
39
|
|
|
61
40
|
try:
|
|
62
|
-
eps = entry_points()
|
|
63
41
|
|
|
64
|
-
|
|
65
|
-
|
|
42
|
+
# Python moderno
|
|
43
|
+
try:
|
|
44
|
+
return entry_points(group=PLUGIN_GROUP)
|
|
45
|
+
except TypeError:
|
|
46
|
+
# Compatibilidade Python antigo
|
|
47
|
+
eps = entry_points()
|
|
48
|
+
|
|
49
|
+
if hasattr(eps, "select"):
|
|
50
|
+
return eps.select(group=PLUGIN_GROUP)
|
|
66
51
|
|
|
67
|
-
|
|
52
|
+
return eps.get(PLUGIN_GROUP, [])
|
|
68
53
|
|
|
69
54
|
except Exception as exc: # pragma: no cover
|
|
70
55
|
logger.error("Erro ao descobrir plugins: %s", exc)
|
|
@@ -75,15 +60,15 @@ def register_plugin(cli: click.Group, ep: EntryPoint) -> None:
|
|
|
75
60
|
"""
|
|
76
61
|
Carrega e registra um plugin individual.
|
|
77
62
|
|
|
78
|
-
O plugin pode
|
|
63
|
+
O plugin pode expor:
|
|
79
64
|
|
|
80
|
-
- função register(cli)
|
|
81
|
-
- objeto click.Command
|
|
65
|
+
- função ``register(cli)``
|
|
66
|
+
- objeto ``click.Command``
|
|
82
67
|
|
|
83
68
|
Parameters
|
|
84
69
|
----------
|
|
85
70
|
cli : click.Group
|
|
86
|
-
CLI principal
|
|
71
|
+
CLI principal.
|
|
87
72
|
ep : EntryPoint
|
|
88
73
|
Entry point do plugin.
|
|
89
74
|
"""
|
|
@@ -91,14 +76,27 @@ def register_plugin(cli: click.Group, ep: EntryPoint) -> None:
|
|
|
91
76
|
plugin = ep.load()
|
|
92
77
|
|
|
93
78
|
if callable(plugin) and not isinstance(plugin, click.Command):
|
|
79
|
+
|
|
94
80
|
plugin(cli)
|
|
95
|
-
|
|
81
|
+
|
|
82
|
+
logger.debug(
|
|
83
|
+
"Plugin '%s' registrado via função register() (%s)",
|
|
84
|
+
ep.name,
|
|
85
|
+
ep.value,
|
|
86
|
+
)
|
|
96
87
|
|
|
97
88
|
elif isinstance(plugin, click.Command):
|
|
89
|
+
|
|
98
90
|
cli.add_command(plugin)
|
|
99
|
-
|
|
91
|
+
|
|
92
|
+
logger.debug(
|
|
93
|
+
"Plugin '%s' registrado como comando Click (%s)",
|
|
94
|
+
ep.name,
|
|
95
|
+
ep.value,
|
|
96
|
+
)
|
|
100
97
|
|
|
101
98
|
else:
|
|
99
|
+
|
|
102
100
|
raise TypeError(
|
|
103
101
|
f"Plugin '{ep.name}' inválido: "
|
|
104
102
|
"não é click.Command nem função register(cli)"
|
|
@@ -117,7 +115,7 @@ def load_plugins(cli: click.Group) -> List[str]:
|
|
|
117
115
|
Returns
|
|
118
116
|
-------
|
|
119
117
|
list[str]
|
|
120
|
-
Lista
|
|
118
|
+
Lista de plugins carregados com sucesso.
|
|
121
119
|
"""
|
|
122
120
|
|
|
123
121
|
loaded: List[str] = []
|
|
@@ -130,12 +128,14 @@ def load_plugins(cli: click.Group) -> List[str]:
|
|
|
130
128
|
continue
|
|
131
129
|
|
|
132
130
|
try:
|
|
131
|
+
|
|
133
132
|
register_plugin(cli, ep)
|
|
134
133
|
|
|
135
134
|
seen.add(ep.name)
|
|
136
135
|
loaded.append(ep.name)
|
|
137
136
|
|
|
138
137
|
except Exception as exc:
|
|
138
|
+
|
|
139
139
|
logger.error(
|
|
140
140
|
"Falha ao carregar plugin '%s': %s",
|
|
141
141
|
ep.name,
|
|
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
|
|
File without changes
|
|
File without changes
|
{mtcli-3.7.0.dev1 → mtcli-3.7.0.dev2}/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.7.0.dev1 → mtcli-3.7.0.dev2}/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.7.0.dev1 → mtcli-3.7.0.dev2}/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
|