mtcli 3.4.0.dev1__tar.gz → 4.0.0.dev0__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.
Files changed (64) hide show
  1. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/PKG-INFO +1 -1
  2. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/commands/bars.py +153 -147
  3. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/conf.py +96 -102
  4. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/logger.py +0 -1
  5. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/models/bar_model.py +105 -105
  6. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/models/consecutive_bars_model.py +75 -77
  7. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/models/unconsecutive_bar_model.py +67 -67
  8. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/mt5_context.py +66 -62
  9. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/media_movel/command.py +99 -99
  10. mtcli-4.0.0.dev0/mtcli/plugins/media_movel/conf.py +4 -0
  11. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/range_medio/command.py +33 -33
  12. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/range_medio/models/average_range_model.py +29 -29
  13. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/volume_medio/command.py +42 -42
  14. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/volume_medio/models/model_average_volume.py +31 -31
  15. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/close_view.py +37 -37
  16. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/full_view.py +69 -65
  17. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/high_view.py +37 -37
  18. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/low_view.py +37 -37
  19. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/min_view.py +42 -42
  20. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/open_view.py +37 -37
  21. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/ranges_view.py +43 -41
  22. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/rates_view.py +41 -41
  23. mtcli-4.0.0.dev0/mtcli/views/utils.py +37 -0
  24. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/volumes_view.py +55 -51
  25. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/pyproject.toml +17 -17
  26. mtcli-3.4.0.dev1/mtcli/plugins/media_movel/conf.py +0 -4
  27. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/LICENSE +0 -0
  28. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/README.md +0 -0
  29. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/__init__.py +0 -0
  30. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/commands/__init__.py +0 -0
  31. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/commands/conf.py +0 -0
  32. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/commands/logs.py +0 -0
  33. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/conecta.py +0 -0
  34. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/data/__init__.py +0 -0
  35. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/data/base.py +0 -0
  36. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/data/csv.py +0 -0
  37. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/data/mt5.py +0 -0
  38. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/models/__init__.py +0 -0
  39. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/models/bars_model.py +0 -0
  40. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/models/chart_model.py +0 -0
  41. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/models/conf_model.py +0 -0
  42. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/models/rates_model.py +0 -0
  43. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/models/signals_model.py +0 -0
  44. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/mt.py +0 -0
  45. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugin.py +0 -0
  46. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/__init__.py +0 -0
  47. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/media_movel/__init__.py +0 -0
  48. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/media_movel/models/__init__.py +0 -0
  49. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/media_movel/models/model_media_movel.py +0 -0
  50. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/media_movel/tests/__init__.py +0 -0
  51. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/media_movel/tests/test_mm.py +0 -0
  52. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/media_movel/tests/test_model_media_movel.py +0 -0
  53. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/range_medio/__init__.py +0 -0
  54. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/range_medio/conf.py +0 -0
  55. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/range_medio/models/__init__.py +0 -0
  56. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/range_medio/tests/__init__.py +0 -0
  57. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/range_medio/tests/test_rm.py +0 -0
  58. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/volume_medio/__init__.py +0 -0
  59. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/volume_medio/conf.py +0 -0
  60. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/volume_medio/models/__init__.py +0 -0
  61. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/volume_medio/tests/__init__.py +0 -0
  62. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/plugins/volume_medio/tests/test_vm.py +0 -0
  63. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/__init__.py +0 -0
  64. {mtcli-3.4.0.dev1 → mtcli-4.0.0.dev0}/mtcli/views/vars_view.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mtcli
3
- Version: 3.4.0.dev1
3
+ Version: 4.0.0.dev0
4
4
  Summary: Aplicativo CLI para exibir gráficos do MetaTrader 5 em texto acessível ao leitor de telas
5
5
  License: GPL-3.0
6
6
  Keywords: MetaTrader 5,trading,CLI
@@ -1,147 +1,153 @@
1
- """Exibe o gráfico de barras."""
2
-
3
- import click
4
-
5
- from mtcli.conf import (
6
- BARS,
7
- DATE,
8
- PERIOD,
9
- TIMEFRAMES,
10
- VIEW,
11
- VOLUME,
12
- )
13
- from mtcli.models.bars_model import BarsModel
14
- from mtcli.models.rates_model import RatesModel
15
- from mtcli.views.close_view import CloseView
16
- from mtcli.views.full_view import FullView
17
- from mtcli.views.high_view import HighView
18
- from mtcli.views.low_view import LowView
19
- from mtcli.views.min_view import MinView
20
- from mtcli.views.open_view import OpenView
21
- from mtcli.views.ranges_view import RangesView
22
- from mtcli.views.rates_view import RatesView
23
- from mtcli.views.vars_view import VarsView
24
- from mtcli.views.volumes_view import VolumesView
25
-
26
-
27
- @click.command(
28
- "bars",
29
- help="Mostra o gráfico de candles em texto para o ativo e período especificados.",
30
- )
31
- @click.argument("symbol")
32
- @click.option(
33
- "--view",
34
- "-v",
35
- type=click.Choice(
36
- [
37
- "ch",
38
- "m",
39
- "hl",
40
- "f",
41
- "full",
42
- "r",
43
- "range",
44
- "v",
45
- "volume",
46
- "va",
47
- "percentual",
48
- "oh",
49
- "ohlc",
50
- "o",
51
- "open",
52
- "h",
53
- "high",
54
- "l",
55
- "low",
56
- "c",
57
- "close",
58
- ],
59
- case_sensitive=False,
60
- ),
61
- default=VIEW,
62
- show_default=True,
63
- help="Formato de exibicao. Opcoes: minima ou HL - minima; f - completa; r - ranges; v - volumes; va - variações percentuais; oh - OHLC; o - aberturas; h - maximas; l - minimas; c - fechamentos.",
64
- )
65
- @click.option(
66
- "--period",
67
- "-p",
68
- type=click.Choice(TIMEFRAMES, case_sensitive=False),
69
- default=PERIOD,
70
- show_default=True,
71
- help="Timeframe das barras.",
72
- )
73
- @click.option(
74
- "--count",
75
- "-c",
76
- type=int,
77
- default=BARS,
78
- show_default=True,
79
- help="Numero de barras.",
80
- )
81
- @click.option(
82
- "--date",
83
- "-d",
84
- default=DATE,
85
- show_default=True,
86
- help="Data para intraday, formato AAAA-MM-DD.",
87
- )
88
- @click.option(
89
- "--numerator",
90
- "-n",
91
- is_flag=True,
92
- default=False,
93
- show_default=True,
94
- help="Ativa a numeracao das barras.",
95
- )
96
- @click.option(
97
- "--show-date",
98
- "-sd",
99
- is_flag=True,
100
- default=False,
101
- show_default=True,
102
- help="Ativa a datacao das barras.",
103
- )
104
- @click.option(
105
- "--volume",
106
- "-vo",
107
- type=click.Choice(["tick", "real"], case_sensitive=False),
108
- default=VOLUME,
109
- show_default=True,
110
- help="Tipo de volume.",
111
- )
112
- def bars(symbol, view, period, count, date, numerator, show_date, volume):
113
- """Exibe o grafico do MetaTrader 5."""
114
- period = period.lower()
115
- view = view.lower()
116
- rates = RatesModel(symbol, period, count).get_data()
117
- bars = BarsModel(rates, date).get_bars()
118
- views = []
119
- if view in ["m", "ch", "hl"]: # máximas e mínimas
120
- views = MinView(bars, count, period, date, numerator, show_date).views()
121
- elif view in ["r", "range"]: # ranges
122
- views = RangesView(bars, count, period, date, numerator, show_date).views()
123
- elif view in ["oh", "ohlc"]: # OHLC
124
- views = RatesView(bars, count, period, date, numerator, show_date).views()
125
- elif view in ["va", "percentual"]: # variações percentuais
126
- views = VarsView(bars, count, period, date, numerator, show_date).views()
127
- elif view in ["o", "open"]: # abertura
128
- views = OpenView(bars, count, period, date, numerator, show_date).views()
129
- elif view in ["h", "high"]: # máximas
130
- views = HighView(bars, count, period, date, numerator, show_date).views()
131
- elif view in ["l", "low"]: # mínimas
132
- views = LowView(bars, count, period, date, numerator, show_date).views()
133
- elif view in ["c", "close"]: # fechamentos
134
- views = CloseView(bars, count, period, date, numerator, show_date).views()
135
- elif view in ["v", "volume"]: # volumes
136
- views = VolumesView(
137
- bars, count, period, date, numerator, show_date, volume
138
- ).views()
139
- else: # completo
140
- views = FullView(bars, count, period, date, numerator, show_date).views()
141
- if views:
142
- for view in views:
143
- click.echo(view)
144
-
145
-
146
- if __name__ == "__main__":
147
- bars()
1
+ """Exibe o gráfico de barras."""
2
+
3
+ import click
4
+
5
+ from mtcli.conf import (
6
+ DATE,
7
+ PERIOD,
8
+ PERIODOS,
9
+ SYMBOL,
10
+ TIMEFRAMES,
11
+ VIEW,
12
+ VOLUME,
13
+ )
14
+ from mtcli.models.bars_model import BarsModel
15
+ from mtcli.models.rates_model import RatesModel
16
+ from mtcli.views.close_view import CloseView
17
+ from mtcli.views.full_view import FullView
18
+ from mtcli.views.high_view import HighView
19
+ from mtcli.views.low_view import LowView
20
+ from mtcli.views.min_view import MinView
21
+ from mtcli.views.open_view import OpenView
22
+ from mtcli.views.ranges_view import RangesView
23
+ from mtcli.views.rates_view import RatesView
24
+ from mtcli.views.vars_view import VarsView
25
+ from mtcli.views.volumes_view import VolumesView
26
+
27
+
28
+ @click.command(
29
+ help="Mostra o gráfico de candles em texto para o ativo e período especificados.",
30
+ )
31
+ @click.option(
32
+ "--symbol",
33
+ "-s",
34
+ default=SYMBOL,
35
+ show_default=True,
36
+ help="Codigo ou ticker do ativo.",
37
+ )
38
+ @click.option(
39
+ "--view",
40
+ "-v",
41
+ type=click.Choice(
42
+ [
43
+ "ch",
44
+ "m",
45
+ "hl",
46
+ "f",
47
+ "full",
48
+ "r",
49
+ "range",
50
+ "v",
51
+ "volume",
52
+ "va",
53
+ "percentual",
54
+ "oh",
55
+ "ohlc",
56
+ "o",
57
+ "open",
58
+ "h",
59
+ "high",
60
+ "l",
61
+ "low",
62
+ "c",
63
+ "close",
64
+ ],
65
+ case_sensitive=False,
66
+ ),
67
+ default=VIEW,
68
+ show_default=True,
69
+ help="Formato de exibicao. Opcoes: minima ou HL - minima; f - completa; r - ranges; v - volumes; va - variações percentuais; oh - OHLC; o - aberturas; h - maximas; l - minimas; c - fechamentos.",
70
+ )
71
+ @click.option(
72
+ "--period",
73
+ "-p",
74
+ type=click.Choice(TIMEFRAMES, case_sensitive=False),
75
+ default=PERIOD,
76
+ show_default=True,
77
+ help="Timeframe do grafico.",
78
+ )
79
+ @click.option(
80
+ "--count",
81
+ "-c",
82
+ type=int,
83
+ default=PERIODOS,
84
+ show_default=True,
85
+ help="Quantidade de periodos a serem exibidos.",
86
+ )
87
+ @click.option(
88
+ "--date",
89
+ "-d",
90
+ default=DATE,
91
+ show_default=True,
92
+ help="Data para intraday, formato AAAA-MM-DD.",
93
+ )
94
+ @click.option(
95
+ "--numerator",
96
+ "-n",
97
+ is_flag=True,
98
+ default=False,
99
+ show_default=True,
100
+ help="Ativa a numeracao das barras.",
101
+ )
102
+ @click.option(
103
+ "--show-date",
104
+ "-sd",
105
+ is_flag=True,
106
+ default=False,
107
+ show_default=True,
108
+ help="Ativa a datacao das barras.",
109
+ )
110
+ @click.option(
111
+ "--volume",
112
+ "-vo",
113
+ type=click.Choice(["tick", "real"], case_sensitive=False),
114
+ default=VOLUME,
115
+ show_default=True,
116
+ help="Tipo de volume.",
117
+ )
118
+ def bars(symbol, view, period, count, date, numerator, show_date, volume):
119
+ """Exibe o grafico do MetaTrader 5."""
120
+ period = period.lower()
121
+ view = view.lower()
122
+ rates = RatesModel(symbol, period, count).get_data()
123
+ bars = BarsModel(rates, date).get_bars()
124
+ views = []
125
+ if view in ["m", "ch", "hl"]: # máximas e mínimas
126
+ views = MinView(bars, count, period, date, numerator, show_date).views()
127
+ elif view in ["r", "range"]: # ranges
128
+ views = RangesView(bars, count, period, date, numerator, show_date).views()
129
+ elif view in ["oh", "ohlc"]: # OHLC
130
+ views = RatesView(bars, count, period, date, numerator, show_date).views()
131
+ elif view in ["va", "percentual"]: # variações percentuais
132
+ views = VarsView(bars, count, period, date, numerator, show_date).views()
133
+ elif view in ["o", "open"]: # abertura
134
+ views = OpenView(bars, count, period, date, numerator, show_date).views()
135
+ elif view in ["h", "high"]: # máximas
136
+ views = HighView(bars, count, period, date, numerator, show_date).views()
137
+ elif view in ["l", "low"]: # mínimas
138
+ views = LowView(bars, count, period, date, numerator, show_date).views()
139
+ elif view in ["c", "close"]: # fechamentos
140
+ views = CloseView(bars, count, period, date, numerator, show_date).views()
141
+ elif view in ["v", "volume"]: # volumes
142
+ views = VolumesView(
143
+ bars, count, period, date, numerator, show_date, volume
144
+ ).views()
145
+ else: # completo
146
+ views = FullView(bars, count, period, date, numerator, show_date).views()
147
+ if views:
148
+ for view in views:
149
+ click.echo(view)
150
+
151
+
152
+ if __name__ == "__main__":
153
+ bars()
@@ -1,102 +1,96 @@
1
- import os
2
-
3
- import MetaTrader5 as mt5
4
-
5
- from mtcli.conecta import conectar, shutdown
6
- from mtcli.models.conf_model import ConfModel
7
-
8
- config = ConfModel("mtcli.ini").carregar()
9
-
10
- section = "DEFAULT"
11
- symbol = os.getenv("SYMBOL", config[section].get("symbol", fallback="WIN$N"))
12
- digitos = int(os.getenv("DIGITOS", config[section].getint("digitos", fallback=2)))
13
- PERIOD = period = os.getenv("PERIOD", config[section].get("period", fallback="D1"))
14
- BARS = periodos = count = int(
15
- os.getenv("COUNT", config[section].getint("count", fallback=999))
16
- )
17
- VIEW = view = os.getenv("VIEW", config[section].get("view", fallback="ch"))
18
- VOLUME = volume = os.getenv("VOLUME", config[section].get("volume", fallback="tick"))
19
- DATE = date = os.getenv("DATE", config[section].get("date", fallback=""))
20
-
21
- lateral = os.getenv("LATERAL", config[section].get("lateral", fallback="doji"))
22
- alta = os.getenv("ALTA", config[section].get("alta", fallback="verde"))
23
- baixa = os.getenv("BAIXA", config[section].get("baixa", fallback="vermelho"))
24
- rompimento_alta = os.getenv(
25
- "ROMPIMENTO_ALTA", config[section].get("rompimento_alta", fallback="c")
26
- )
27
- rompimento_baixa = os.getenv(
28
- "ROMPIMENTO_BAIXA", config[section].get("rompimento_baixa", fallback="v")
29
- )
30
- percentual_rompimento = int(
31
- os.getenv(
32
- "PERCENTUAL_ROMPIMENTO",
33
- config[section].getint("percentual_rompimento", fallback=50),
34
- )
35
- )
36
- percentual_doji = int(
37
- os.getenv("PERCENTUAL_DOJI", config[section].getint("percentual_doji", fallback=10))
38
- )
39
- up_bar = os.getenv("UP_BAR", config[section].get("up_bar", fallback="asc"))
40
- down_bar = os.getenv("DOWN_BAR", config[section].get("down_bar", fallback="desc"))
41
- inside_bar = os.getenv("INSIDE_BAR", config[section].get("inside_bar", fallback="ib"))
42
- outside_bar = os.getenv(
43
- "OUTSIDE_BAR", config[section].get("outside_bar", fallback="ob")
44
- )
45
- sombra_superior = os.getenv(
46
- "SOMBRA_SUPERIOR", config[section].get("sombra_superior", fallback="top")
47
- )
48
- sombra_inferior = os.getenv(
49
- "SOMBRA_INFERIOR", config[section].get("sombra_inferior", fallback="bottom")
50
- )
51
- data_source = dados = os.getenv("DADOS", config[section].get("dados", fallback="mt5"))
52
- csv_path = mt5_pasta = os.getenv(
53
- "MT5_PASTA", config[section].get("mt5_pasta", fallback="")
54
- )
55
-
56
-
57
- def get_data_source():
58
- from mtcli.data import CsvDataSource, MT5DataSource
59
-
60
- if data_source.lower() == "csv":
61
- return CsvDataSource()
62
- elif data_source.lower() == "mt5":
63
- return MT5DataSource()
64
- else:
65
- raise ValueError(f"Fonte de dados desconhecida: {data_source}")
66
-
67
-
68
- if not csv_path:
69
- conectar()
70
- terminal_info = mt5.terminal_info()
71
- if terminal_info is None:
72
- raise RuntimeError("Não foi possível obter as informações do terminal.")
73
-
74
- csv_path = terminal_info.data_path + "/MQL5/Files"
75
- shutdown()
76
-
77
- csv_path = csv_path.replace("\\", "/")
78
- csv_path += "/"
79
-
80
- TIMEFRAMES = timeframes = [
81
- "mn1",
82
- "w1",
83
- "d1",
84
- "h12",
85
- "h8",
86
- "h6",
87
- "h4",
88
- "h3",
89
- "h2",
90
- "h1",
91
- "m30",
92
- "m20",
93
- "m15",
94
- "m12",
95
- "m10",
96
- "m6",
97
- "m5",
98
- "m4",
99
- "m3",
100
- "m2",
101
- "m1",
102
- ]
1
+ import os
2
+
3
+ import MetaTrader5 as mt5
4
+
5
+ from mtcli.conecta import conectar, shutdown
6
+ from mtcli.models.conf_model import ConfModel
7
+
8
+ config = ConfModel("mtcli.ini").carregar()
9
+
10
+ section = "DEFAULT"
11
+ SYMBOL = os.getenv("SYMBOL", config[section].get("symbol", fallback="WIN$N"))
12
+ DIGITOS = int(os.getenv("DIGITOS", config[section].getint("digitos", fallback=2)))
13
+ PERIOD = period = os.getenv("PERIOD", config[section].get("period", fallback="D1"))
14
+ PERIODOS = int(os.getenv("COUNT", config[section].getint("count", fallback=999)))
15
+ VIEW = view = os.getenv("VIEW", config[section].get("view", fallback="ch"))
16
+ VOLUME = volume = os.getenv("VOLUME", config[section].get("volume", fallback="tick"))
17
+ DATE = date = os.getenv("DATE", config[section].get("date", fallback=""))
18
+
19
+ DOJI = os.getenv("LATERAL", config[section].get("lateral", fallback="doji"))
20
+ BULL = os.getenv("BULL", config[section].get("bull", fallback="verde"))
21
+ BEAR = os.getenv("BEAR", config[section].get("bear", fallback="vermelho"))
22
+ BULLBREAKOUT = os.getenv(
23
+ "BULLBREAKOUT", config[section].get("bullbreakout", fallback="c")
24
+ )
25
+ BEARBREAKOUT = os.getenv(
26
+ "BEARBREAKOUT", config[section].get("bearbreakout", fallback="v")
27
+ )
28
+ PERCENTUAL_BREAKOUT = int(
29
+ os.getenv(
30
+ "PERCENTUAL_BREAKOUT",
31
+ config[section].getint("percentual_breakout", fallback=50),
32
+ )
33
+ )
34
+ PERCENTUAL_DOJI = int(
35
+ os.getenv("PERCENTUAL_DOJI", config[section].getint("percentual_doji", fallback=10))
36
+ )
37
+ UPBAR = os.getenv("UPBAR", config[section].get("upbar", fallback="asc"))
38
+ DOWNBAR = os.getenv("DOWNBAR", config[section].get("downbar", fallback="desc"))
39
+ INSIDEBAR = os.getenv("INSIDEBAR", config[section].get("insidebar", fallback="ib"))
40
+ OUTSIDEBAR = os.getenv("OUTSIDEBAR", config[section].get("outsidebar", fallback="ob"))
41
+ TOPTAIL = os.getenv("TOPTAIL", config[section].get("toptail", fallback="top"))
42
+ BOTTOMTAIL = os.getenv(
43
+ "BOTTOMTAIL", config[section].get("bottomtail", fallback="bottom")
44
+ )
45
+ data_source = dados = os.getenv("DADOS", config[section].get("dados", fallback="mt5"))
46
+ csv_path = mt5_pasta = os.getenv(
47
+ "MT5_PASTA", config[section].get("mt5_pasta", fallback="")
48
+ )
49
+
50
+
51
+ def get_data_source():
52
+ from mtcli.data import CsvDataSource, MT5DataSource
53
+
54
+ if data_source.lower() == "csv":
55
+ return CsvDataSource()
56
+ elif data_source.lower() == "mt5":
57
+ return MT5DataSource()
58
+ else:
59
+ raise ValueError(f"Fonte de dados desconhecida: {data_source}")
60
+
61
+
62
+ if not csv_path:
63
+ conectar()
64
+ terminal_info = mt5.terminal_info()
65
+ if terminal_info is None:
66
+ raise RuntimeError("Não foi possível obter as informações do terminal.")
67
+
68
+ csv_path = terminal_info.data_path + "/MQL5/Files"
69
+ shutdown()
70
+
71
+ csv_path = csv_path.replace("\\", "/")
72
+ csv_path += "/"
73
+
74
+ TIMEFRAMES = timeframes = [
75
+ "mn1",
76
+ "w1",
77
+ "d1",
78
+ "h12",
79
+ "h8",
80
+ "h6",
81
+ "h4",
82
+ "h3",
83
+ "h2",
84
+ "h1",
85
+ "m30",
86
+ "m20",
87
+ "m15",
88
+ "m12",
89
+ "m10",
90
+ "m6",
91
+ "m5",
92
+ "m4",
93
+ "m3",
94
+ "m2",
95
+ "m1",
96
+ ]
@@ -2,7 +2,6 @@ import logging
2
2
  from logging.handlers import RotatingFileHandler
3
3
  import os
4
4
 
5
-
6
5
  base_dir = os.getenv("APPDATA", os.path.expanduser("~"))
7
6
  LOG_DIR = os.path.join(base_dir, "mtcli", "logs")
8
7
  os.makedirs(LOG_DIR, exist_ok=True)