mtcli 4.0.0.dev0__tar.gz → 4.0.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-4.0.0.dev1/LICENSE +21 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/PKG-INFO +14 -9
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/README.md +145 -145
- mtcli-4.0.0.dev1/mtcli/__main__.py +3 -0
- mtcli-4.0.0.dev1/mtcli/cli.py +51 -0
- mtcli-4.0.0.dev1/mtcli/commands/bars.py +75 -0
- mtcli-4.0.0.dev1/mtcli/commands/conf.py +44 -0
- mtcli-4.0.0.dev1/mtcli/commands/doctor.py +194 -0
- mtcli-4.0.0.dev1/mtcli/conf.py +125 -0
- mtcli-4.0.0.dev1/mtcli/config_registre.py +41 -0
- mtcli-4.0.0.dev1/mtcli/controllers/bars_controller.py +75 -0
- mtcli-4.0.0.dev1/mtcli/data/base.py +20 -0
- mtcli-4.0.0.dev1/mtcli/data/csv.py +63 -0
- mtcli-4.0.0.dev1/mtcli/data/factory.py +29 -0
- mtcli-4.0.0.dev1/mtcli/data/mt5.py +148 -0
- mtcli-4.0.0.dev1/mtcli/domain/bar.py +40 -0
- mtcli-4.0.0.dev1/mtcli/domain/calculations.py +6 -0
- mtcli-4.0.0.dev1/mtcli/domain/config.py +4 -0
- mtcli-4.0.0.dev1/mtcli/domain/pattern.py +10 -0
- mtcli-4.0.0.dev1/mtcli/domain/price.py +13 -0
- mtcli-4.0.0.dev1/mtcli/domain/result.py +8 -0
- mtcli-4.0.0.dev1/mtcli/domain/session.py +11 -0
- mtcli-4.0.0.dev1/mtcli/domain/structure.py +7 -0
- mtcli-4.0.0.dev1/mtcli/domain/symbol.py +10 -0
- mtcli-4.0.0.dev1/mtcli/domain/tick.py +9 -0
- mtcli-4.0.0.dev1/mtcli/domain/timeframe.py +102 -0
- mtcli-4.0.0.dev1/mtcli/logger.py +136 -0
- mtcli-4.0.0.dev1/mtcli/models/bars_model.py +179 -0
- mtcli-4.0.0.dev1/mtcli/models/rate_model.py +71 -0
- mtcli-4.0.0.dev1/mtcli/models_legado/__init__.py +1 -0
- {mtcli-4.0.0.dev0/mtcli/models → mtcli-4.0.0.dev1/mtcli/models_legado}/bar_model.py +105 -105
- {mtcli-4.0.0.dev0/mtcli/models → mtcli-4.0.0.dev1/mtcli/models_legado}/bars_model.py +1 -1
- mtcli-4.0.0.dev1/mtcli/models_legado/chart.py +26 -0
- mtcli-4.0.0.dev1/mtcli/models_legado/consecutive.py +29 -0
- {mtcli-4.0.0.dev0/mtcli/models → mtcli-4.0.0.dev1/mtcli/models_legado}/rates_model.py +1 -1
- mtcli-4.0.0.dev1/mtcli/plugin.py +18 -0
- mtcli-4.0.0.dev1/mtcli/plugin_loader.py +123 -0
- mtcli-4.0.0.dev1/mtcli/plugin_manager.py +27 -0
- mtcli-4.0.0.dev1/mtcli/plugins/exemplo.py-dist +30 -0
- mtcli-4.0.0.dev1/mtcli/plugins/media_movel/__init__.py +5 -0
- mtcli-4.0.0.dev1/mtcli/plugins/media_movel/cli.py +73 -0
- mtcli-4.0.0.dev1/mtcli/plugins/media_movel/conf.py +75 -0
- mtcli-4.0.0.dev1/mtcli/plugins/media_movel/controller.py +43 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/plugins/media_movel/tests/test_mm.py +13 -13
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/plugins/media_movel/tests/test_model_media_movel.py +9 -9
- mtcli-4.0.0.dev1/mtcli/plugins/media_movel/view.py +15 -0
- mtcli-4.0.0.dev1/mtcli/plugins/range_medio/__init__.py +5 -0
- mtcli-4.0.0.dev0/mtcli/plugins/range_medio/command.py → mtcli-4.0.0.dev1/mtcli/plugins/range_medio/cli.py +32 -33
- mtcli-4.0.0.dev1/mtcli/plugins/range_medio/conf.py +67 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/plugins/range_medio/models/average_range_model.py +29 -29
- mtcli-4.0.0.dev1/mtcli/plugins/range_medio/tests/__init__.py +0 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/plugins/range_medio/tests/test_rm.py +11 -11
- mtcli-4.0.0.dev1/mtcli/plugins/volume_medio/__init__.py +5 -0
- mtcli-4.0.0.dev0/mtcli/plugins/volume_medio/command.py → mtcli-4.0.0.dev1/mtcli/plugins/volume_medio/cli.py +41 -42
- mtcli-4.0.0.dev1/mtcli/plugins/volume_medio/conf.py +67 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/plugins/volume_medio/models/model_average_volume.py +31 -31
- mtcli-4.0.0.dev1/mtcli/plugins/volume_medio/tests/__init__.py +0 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/plugins/volume_medio/tests/test_vm.py +21 -21
- mtcli-4.0.0.dev1/mtcli/utils/__init__.py +0 -0
- mtcli-4.0.0.dev1/mtcli/utils/pidfile.py +35 -0
- mtcli-4.0.0.dev1/mtcli/utils/time.py +65 -0
- mtcli-4.0.0.dev1/mtcli/views/base_view.py +80 -0
- mtcli-4.0.0.dev1/mtcli/views/factory_view.py +30 -0
- mtcli-4.0.0.dev1/mtcli/views/full_view.py +40 -0
- mtcli-4.0.0.dev1/mtcli/views/hl_view.py +32 -0
- mtcli-4.0.0.dev1/mtcli/views/range_view.py +47 -0
- mtcli-4.0.0.dev1/mtcli/views/rate_view.py +18 -0
- mtcli-4.0.0.dev1/mtcli/views/volume_view.py +62 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/pyproject.toml +49 -27
- mtcli-4.0.0.dev0/LICENSE +0 -17
- mtcli-4.0.0.dev0/mtcli/commands/bars.py +0 -153
- mtcli-4.0.0.dev0/mtcli/commands/conf.py +0 -50
- mtcli-4.0.0.dev0/mtcli/commands/logs.py +0 -42
- mtcli-4.0.0.dev0/mtcli/conf.py +0 -96
- mtcli-4.0.0.dev0/mtcli/data/base.py +0 -9
- mtcli-4.0.0.dev0/mtcli/data/csv.py +0 -31
- mtcli-4.0.0.dev0/mtcli/data/mt5.py +0 -95
- mtcli-4.0.0.dev0/mtcli/logger.py +0 -46
- mtcli-4.0.0.dev0/mtcli/models/chart_model.py +0 -155
- mtcli-4.0.0.dev0/mtcli/models/conf_model.py +0 -32
- mtcli-4.0.0.dev0/mtcli/models/consecutive_bars_model.py +0 -75
- mtcli-4.0.0.dev0/mtcli/models/signals_model.py +0 -100
- mtcli-4.0.0.dev0/mtcli/models/unconsecutive_bar_model.py +0 -67
- mtcli-4.0.0.dev0/mtcli/mt.py +0 -45
- mtcli-4.0.0.dev0/mtcli/plugin.py +0 -9
- mtcli-4.0.0.dev0/mtcli/plugins/media_movel/__init__.py +0 -3
- mtcli-4.0.0.dev0/mtcli/plugins/media_movel/command.py +0 -99
- mtcli-4.0.0.dev0/mtcli/plugins/media_movel/conf.py +0 -4
- mtcli-4.0.0.dev0/mtcli/plugins/media_movel/models/__init__.py +0 -1
- mtcli-4.0.0.dev0/mtcli/plugins/range_medio/__init__.py +0 -2
- mtcli-4.0.0.dev0/mtcli/plugins/range_medio/conf.py +0 -1
- mtcli-4.0.0.dev0/mtcli/plugins/volume_medio/__init__.py +0 -3
- mtcli-4.0.0.dev0/mtcli/plugins/volume_medio/conf.py +0 -1
- mtcli-4.0.0.dev0/mtcli/views/close_view.py +0 -37
- mtcli-4.0.0.dev0/mtcli/views/full_view.py +0 -69
- mtcli-4.0.0.dev0/mtcli/views/high_view.py +0 -37
- mtcli-4.0.0.dev0/mtcli/views/low_view.py +0 -37
- mtcli-4.0.0.dev0/mtcli/views/min_view.py +0 -42
- mtcli-4.0.0.dev0/mtcli/views/open_view.py +0 -37
- mtcli-4.0.0.dev0/mtcli/views/ranges_view.py +0 -43
- mtcli-4.0.0.dev0/mtcli/views/rates_view.py +0 -41
- mtcli-4.0.0.dev0/mtcli/views/utils.py +0 -37
- mtcli-4.0.0.dev0/mtcli/views/vars_view.py +0 -46
- mtcli-4.0.0.dev0/mtcli/views/volumes_view.py +0 -55
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/__init__.py +0 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/commands/__init__.py +0 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/conecta.py +0 -0
- {mtcli-4.0.0.dev0/mtcli/plugins → mtcli-4.0.0.dev1/mtcli/controllers}/__init__.py +0 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/data/__init__.py +0 -0
- {mtcli-4.0.0.dev0/mtcli/plugins/media_movel/tests → mtcli-4.0.0.dev1/mtcli/domain}/__init__.py +0 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/models/__init__.py +0 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/mt5_context.py +0 -0
- {mtcli-4.0.0.dev0/mtcli/plugins/range_medio/models → mtcli-4.0.0.dev1/mtcli/plugins}/__init__.py +0 -0
- /mtcli-4.0.0.dev0/mtcli/plugins/media_movel/models/model_media_movel.py → /mtcli-4.0.0.dev1/mtcli/plugins/media_movel/model.py +0 -0
- {mtcli-4.0.0.dev0/mtcli/plugins/range_medio → mtcli-4.0.0.dev1/mtcli/plugins/media_movel}/tests/__init__.py +0 -0
- {mtcli-4.0.0.dev0/mtcli/plugins/volume_medio/tests → mtcli-4.0.0.dev1/mtcli/plugins/range_medio/models}/__init__.py +0 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/plugins/volume_medio/models/__init__.py +0 -0
- {mtcli-4.0.0.dev0 → mtcli-4.0.0.dev1}/mtcli/views/__init__.py +0 -0
mtcli-4.0.0.dev1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Valmir França
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: mtcli
|
|
3
|
-
Version: 4.0.0.
|
|
4
|
-
Summary: Aplicativo CLI para exibir gráficos do MetaTrader 5
|
|
5
|
-
License:
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Version: 4.0.0.dev1
|
|
4
|
+
Summary: Aplicativo CLI para exibir gráficos do MetaTrader 5 screen reader friendly
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: trading,candlestick,metatrader5,mt5,cli,price-action
|
|
8
|
+
Author: Valmir França
|
|
8
9
|
Author-email: vfranca3@gmail.com
|
|
9
10
|
Requires-Python: >=3.10,<3.14.0
|
|
10
|
-
Classifier:
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
11
13
|
Classifier: Programming Language :: Python :: 3
|
|
12
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
16
20
|
Requires-Dist: click (>=8.2.1,<9.0.0)
|
|
17
21
|
Requires-Dist: metatrader5 (>=5.0.5260,<6.0.0)
|
|
22
|
+
Requires-Dist: tzdata (>=2025.3,<2026.0)
|
|
18
23
|
Project-URL: Documentation, https://mtcli.readthedocs.io/pt-br/latest
|
|
19
|
-
Project-URL: Homepage, https://
|
|
24
|
+
Project-URL: Homepage, https://github.com:vfranca/mtcli
|
|
20
25
|
Project-URL: Repository, https://github.com/vfranca/mtcli
|
|
21
26
|
Project-URL: issues, https://github.com/vfranca/mtcli/issues
|
|
22
27
|
Description-Content-Type: text/markdown
|
|
@@ -165,5 +170,5 @@ GitHub: [@vfranca](https://github.com/vfranca)
|
|
|
165
170
|
|
|
166
171
|
## Licença
|
|
167
172
|
|
|
168
|
-
Distribuído sob a licença
|
|
173
|
+
Distribuído sob a licença MIT. Veja `LICENSE` para mais informações.
|
|
169
174
|
|
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
# mtcli
|
|
2
|
-
|
|
3
|
-
*mtcli* é um aplicativo de linha de comando (CLI) acessível para leitura e análise de gráficos do MetaTrader 5, desenvolvido com foco em acessibilidade para usuários com deficiência visual.
|
|
4
|
-
|
|
5
|
-
O projeto é modular e extensível por meio de plugins.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Instalação
|
|
10
|
-
|
|
11
|
-
Você pode instalar o `mtcli` diretamente via *pip*:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
pip install mtcli
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Ou diretamente a partir do código-fonte:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
git clone https://github.com/vfranca/mtcli.git
|
|
21
|
-
cd mtcli
|
|
22
|
-
pip install .
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Como usar
|
|
28
|
-
|
|
29
|
-
Após a instalação, o comando principal é:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
mt
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Você verá uma lista de comandos e plugins disponíveis.
|
|
36
|
-
|
|
37
|
-
Para executar um plugin específico, use:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
mt nome-do-plugin [opções]
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Exemplo com o plugin de média móvel:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
mt mm --symbol WIN$N --periodo 14
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Documentação
|
|
52
|
-
|
|
53
|
-
A documentação completa está disponível em:
|
|
54
|
-
|
|
55
|
-
*https://vfranca.github.io/mtcli*
|
|
56
|
-
|
|
57
|
-
Inclui guias de uso, instalação de plugins, exemplos e estrutura do projeto.
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Como contribuir
|
|
62
|
-
|
|
63
|
-
Contribuições são bem-vindas!
|
|
64
|
-
|
|
65
|
-
Clonar o repositório
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
git clone https://github.com/vfranca/mtcli.git
|
|
69
|
-
cd mtcli
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Instalar dependências para desenvolvimento
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
pip install -e ".[dev]"
|
|
76
|
-
```
|
|
77
|
-
Rodar os testes
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
pymake test
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Estilo de código
|
|
84
|
-
|
|
85
|
-
- `black` para formatação
|
|
86
|
-
- `isort` para ordenação de imports
|
|
87
|
-
- `pydocstyle` para formatação de docstrings
|
|
88
|
-
- `ruff` e `mypy` para linting e verificação estática
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## Criando plugins para o mtcli
|
|
93
|
-
|
|
94
|
-
Plugins permitem estender a funcionalidade do `mtcli`.
|
|
95
|
-
|
|
96
|
-
Estrutura básica de um plugin
|
|
97
|
-
|
|
98
|
-
```toml
|
|
99
|
-
pyproject.toml
|
|
100
|
-
[project.entry-points."mtcli.plugins"]
|
|
101
|
-
nome_do_plugin = "modulo.caminho:funcao_principal"
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Exemplo
|
|
105
|
-
|
|
106
|
-
```toml
|
|
107
|
-
[project.entry-points."mtcli.plugins"]
|
|
108
|
-
volume_medio = "mtcli.plugins.volume_medio:vm"
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
No código Python:
|
|
112
|
-
|
|
113
|
-
```python
|
|
114
|
-
|
|
115
|
-
def vm():
|
|
116
|
-
print("Plugin de volume médio executado.")
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Como empacotar
|
|
120
|
-
|
|
121
|
-
Crie um projeto separado com sua lógica e registre o plugin no `pyproject.toml` ou `setup.py` como acima.
|
|
122
|
-
|
|
123
|
-
Depois, instale com:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
pip install .
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
O `mtcli` reconhecerá o plugin automaticamente.
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Contato
|
|
134
|
-
|
|
135
|
-
Autor: *Valmir França da Silva*
|
|
136
|
-
|
|
137
|
-
Email: vfranca3@gmail.com
|
|
138
|
-
|
|
139
|
-
GitHub: [@vfranca](https://github.com/vfranca)
|
|
140
|
-
|
|
141
|
-
---
|
|
142
|
-
|
|
143
|
-
## Licença
|
|
144
|
-
|
|
145
|
-
Distribuído sob a licença
|
|
1
|
+
# mtcli
|
|
2
|
+
|
|
3
|
+
*mtcli* é um aplicativo de linha de comando (CLI) acessível para leitura e análise de gráficos do MetaTrader 5, desenvolvido com foco em acessibilidade para usuários com deficiência visual.
|
|
4
|
+
|
|
5
|
+
O projeto é modular e extensível por meio de plugins.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Instalação
|
|
10
|
+
|
|
11
|
+
Você pode instalar o `mtcli` diretamente via *pip*:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install mtcli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Ou diretamente a partir do código-fonte:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git clone https://github.com/vfranca/mtcli.git
|
|
21
|
+
cd mtcli
|
|
22
|
+
pip install .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Como usar
|
|
28
|
+
|
|
29
|
+
Após a instalação, o comando principal é:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
mt
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Você verá uma lista de comandos e plugins disponíveis.
|
|
36
|
+
|
|
37
|
+
Para executar um plugin específico, use:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
mt nome-do-plugin [opções]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Exemplo com o plugin de média móvel:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
mt mm --symbol WIN$N --periodo 14
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Documentação
|
|
52
|
+
|
|
53
|
+
A documentação completa está disponível em:
|
|
54
|
+
|
|
55
|
+
*https://vfranca.github.io/mtcli*
|
|
56
|
+
|
|
57
|
+
Inclui guias de uso, instalação de plugins, exemplos e estrutura do projeto.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Como contribuir
|
|
62
|
+
|
|
63
|
+
Contribuições são bem-vindas!
|
|
64
|
+
|
|
65
|
+
Clonar o repositório
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/vfranca/mtcli.git
|
|
69
|
+
cd mtcli
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Instalar dependências para desenvolvimento
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install -e ".[dev]"
|
|
76
|
+
```
|
|
77
|
+
Rodar os testes
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pymake test
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Estilo de código
|
|
84
|
+
|
|
85
|
+
- `black` para formatação
|
|
86
|
+
- `isort` para ordenação de imports
|
|
87
|
+
- `pydocstyle` para formatação de docstrings
|
|
88
|
+
- `ruff` e `mypy` para linting e verificação estática
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Criando plugins para o mtcli
|
|
93
|
+
|
|
94
|
+
Plugins permitem estender a funcionalidade do `mtcli`.
|
|
95
|
+
|
|
96
|
+
Estrutura básica de um plugin
|
|
97
|
+
|
|
98
|
+
```toml
|
|
99
|
+
pyproject.toml
|
|
100
|
+
[project.entry-points."mtcli.plugins"]
|
|
101
|
+
nome_do_plugin = "modulo.caminho:funcao_principal"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Exemplo
|
|
105
|
+
|
|
106
|
+
```toml
|
|
107
|
+
[project.entry-points."mtcli.plugins"]
|
|
108
|
+
volume_medio = "mtcli.plugins.volume_medio:vm"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
No código Python:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
|
|
115
|
+
def vm():
|
|
116
|
+
print("Plugin de volume médio executado.")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Como empacotar
|
|
120
|
+
|
|
121
|
+
Crie um projeto separado com sua lógica e registre o plugin no `pyproject.toml` ou `setup.py` como acima.
|
|
122
|
+
|
|
123
|
+
Depois, instale com:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
pip install .
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
O `mtcli` reconhecerá o plugin automaticamente.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Contato
|
|
134
|
+
|
|
135
|
+
Autor: *Valmir França da Silva*
|
|
136
|
+
|
|
137
|
+
Email: vfranca3@gmail.com
|
|
138
|
+
|
|
139
|
+
GitHub: [@vfranca](https://github.com/vfranca)
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Licença
|
|
144
|
+
|
|
145
|
+
Distribuído sob a licença MIT. Veja `LICENSE` para mais informações.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CLI principal do mtcli.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import click
|
|
7
|
+
from .plugin_loader import load_plugins
|
|
8
|
+
from .logger import setup_logger
|
|
9
|
+
|
|
10
|
+
from .commands.bars import bars
|
|
11
|
+
from .commands.doctor import doctor
|
|
12
|
+
|
|
13
|
+
logger = setup_logger(__name__)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@click.group(context_settings={"max_content_width": 120}, invoke_without_command=True)
|
|
17
|
+
@click.version_option(package_name="mtcli")
|
|
18
|
+
@click.pass_context
|
|
19
|
+
def mt(ctx):
|
|
20
|
+
"""
|
|
21
|
+
CLI principal do mtcli.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
if ctx.invoked_subcommand is None:
|
|
25
|
+
click.echo(ctx.get_help())
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
mt.add_command(doctor, name="doctor")
|
|
29
|
+
mt.add_command(bars, name="bars")
|
|
30
|
+
|
|
31
|
+
loaded_plugins = load_plugins(mt)
|
|
32
|
+
logger.info("Plugins carregados: %s", loaded_plugins)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@mt.command(name="plugins")
|
|
36
|
+
def list_plugins():
|
|
37
|
+
"""
|
|
38
|
+
Lista os plugins carregados no mtcli.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
if not loaded_plugins:
|
|
42
|
+
click.echo("Nenhum plugin carregado.")
|
|
43
|
+
return
|
|
44
|
+
|
|
45
|
+
click.echo("Plugins carregados:\n")
|
|
46
|
+
for name in loaded_plugins:
|
|
47
|
+
click.echo(f" {name}")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
mt()
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Comando CLI `bars`.
|
|
3
|
+
|
|
4
|
+
Responsável por:
|
|
5
|
+
- receber parâmetros via terminal (Click)
|
|
6
|
+
- instanciar a fonte de dados
|
|
7
|
+
- delegar execução ao BarsController
|
|
8
|
+
- imprimir saída no terminal
|
|
9
|
+
|
|
10
|
+
Este comando é a camada de entrada (CLI) no padrão MVC do mtcli.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import click
|
|
14
|
+
|
|
15
|
+
from ..controllers.bars_controller import BarsController
|
|
16
|
+
from ..conf import (
|
|
17
|
+
DATA_SOURCE_NAME,
|
|
18
|
+
SYMBOL,
|
|
19
|
+
TIMEFRAME,
|
|
20
|
+
MAX_BARS,
|
|
21
|
+
VIEW,
|
|
22
|
+
VOLUME_TYPE,
|
|
23
|
+
)
|
|
24
|
+
from ..data.factory import create_data_source
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@click.command()
|
|
28
|
+
@click.option("--symbol", "-s", default=SYMBOL, show_default=True, help="Código do ativo (ex: WINM26)")
|
|
29
|
+
@click.option("--timeframe", "-t", "period", default=TIMEFRAME, show_default=True, help="Timeframe (ex: M1, M5, D1)")
|
|
30
|
+
@click.option("--max-bars", "-mb", "count", default=MAX_BARS, show_default=True, help="Quantidade de barras")
|
|
31
|
+
@click.option("--view", "-v", default=VIEW, show_default=True, help="Formato da view (hl_view, full_view, etc)")
|
|
32
|
+
@click.option("--date", "-d", default=None, show_default=True, help="Filtrar pregão (YYYY-MM-DD)")
|
|
33
|
+
@click.option("--numerator", "-n", is_flag=True, show_default=True, help="Numerar barras")
|
|
34
|
+
@click.option("--show-date", "-sd", is_flag=True, show_default=True, help="Exibir data/hora")
|
|
35
|
+
@click.option("--volume-type", "-vt", "volume", default=VOLUME_TYPE, show_default=True, help="Tipo de volume (tick/real)")
|
|
36
|
+
@click.option("--data-source", "-ds", "source", default=None, show_default=True, help="Fonte de dados (mt5/csv)")
|
|
37
|
+
def bars(symbol, period, count, view, date, numerator, show_date, volume, source):
|
|
38
|
+
"""
|
|
39
|
+
Executa o comando `bars`.
|
|
40
|
+
|
|
41
|
+
Fluxo:
|
|
42
|
+
1. Resolve fonte de dados
|
|
43
|
+
2. Executa controller
|
|
44
|
+
3. Renderiza saída linha a linha
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
symbol (str): Ativo
|
|
48
|
+
period (str): Timeframe
|
|
49
|
+
count (int): Quantidade de barras
|
|
50
|
+
view (str): Nome da view
|
|
51
|
+
date (str | None): Filtro de pregão
|
|
52
|
+
numerator (bool): Numerar barras
|
|
53
|
+
show_date (bool): Mostrar timestamp
|
|
54
|
+
volume (str | None): Tipo de volume
|
|
55
|
+
source (str | None): Fonte de dados
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
source_name = source or DATA_SOURCE_NAME
|
|
59
|
+
data_source = create_data_source(source_name)
|
|
60
|
+
|
|
61
|
+
controller = BarsController(data_source)
|
|
62
|
+
|
|
63
|
+
lines = controller.execute(
|
|
64
|
+
symbol=symbol,
|
|
65
|
+
period=period,
|
|
66
|
+
count=count,
|
|
67
|
+
date=date,
|
|
68
|
+
view=view,
|
|
69
|
+
numerator=numerator,
|
|
70
|
+
show_date=show_date,
|
|
71
|
+
volume=volume,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
for line in lines:
|
|
75
|
+
click.echo(line)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Comando para exibir configurações disponíveis.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
from mtcli.config_registry import registry
|
|
8
|
+
from mtcli.conf import conf
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.command()
|
|
12
|
+
@click.argument("section", required=False)
|
|
13
|
+
def conf_cmd(section):
|
|
14
|
+
"""
|
|
15
|
+
Exibe configurações disponíveis.
|
|
16
|
+
|
|
17
|
+
Exemplos:
|
|
18
|
+
|
|
19
|
+
mt conf
|
|
20
|
+
mt conf renko
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
if section:
|
|
24
|
+
options = registry.get_section(section)
|
|
25
|
+
else:
|
|
26
|
+
options = registry.get_all()
|
|
27
|
+
|
|
28
|
+
if not options:
|
|
29
|
+
click.echo("Nenhuma configuração registrada.")
|
|
30
|
+
return
|
|
31
|
+
|
|
32
|
+
for opt in options:
|
|
33
|
+
|
|
34
|
+
value = conf.get(opt.name, section=opt.section, default=opt.default)
|
|
35
|
+
|
|
36
|
+
click.echo(
|
|
37
|
+
f"{opt.section}.{opt.name} = {value} "
|
|
38
|
+
f"(default={opt.default})"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
if opt.description:
|
|
42
|
+
click.echo(f" {opt.description}")
|
|
43
|
+
|
|
44
|
+
click.echo()
|