mtcli-volume 2.0.0.dev1__tar.gz → 2.0.0.dev3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mtcli-volume
3
- Version: 2.0.0.dev1
3
+ Version: 2.0.0.dev3
4
4
  Summary: Plugin mtcli para exibir o volume profile
5
5
  Author: Valmir França da Silva
6
6
  Author-email: vfranca3@gmail.com
@@ -0,0 +1,39 @@
1
+ import click
2
+
3
+ from mtcli_volume.conf import BARS, PERIOD, STEP, SYMBOL, VOLUME
4
+ from mtcli_volume.controllers.volume_controller import calcular_volume_profile
5
+ from mtcli_volume.views.volume_view import exibir_volume_profile
6
+
7
+
8
+ @click.command(
9
+ "volume",
10
+ help="Exibe o Volume Profile, agrupando volumes por faixa de preço no histórico recente.",
11
+ )
12
+ @click.version_option(package_name="mtcli-volume")
13
+ @click.option(
14
+ "--symbol", "-s", default=SYMBOL, show_default=True, help="Simbolo do ativo."
15
+ )
16
+ @click.option("--period", "-p", default=PERIOD, show_default=True, help="Timeframe (ex: M1, M5, H1).")
17
+ @click.option("--bars", "-b", default=BARS, show_default=True, help="Numero de barras.")
18
+ @click.option(
19
+ "--step",
20
+ "-e",
21
+ type=float,
22
+ default=STEP, show_default=True,
23
+ help="Tamanho do agrupamento de precos.",
24
+ )
25
+ @click.option(
26
+ "--volume",
27
+ "-v",
28
+ default=VOLUME,
29
+ show_default=True,
30
+ help="Tipo de volume (tick ou real).",
31
+ )
32
+ def volume(symbol, period, bars, step, volume):
33
+ """Exibe o Volume Profile agrupando volumes por faixa de preço."""
34
+ profile, stats = calcular_volume_profile(symbol, period, bars, step, volume)
35
+ exibir_volume_profile(profile, stats, symbol)
36
+
37
+
38
+ if __name__ == "__main__":
39
+ volume()
@@ -1,6 +1,6 @@
1
1
  import os
2
- from mtcli.conf import config
3
2
 
3
+ from mtcli.conf import config
4
4
 
5
5
  SYMBOL = os.getenv("SYMBOL", config["DEFAULT"].get("symbol", fallback="WIN$N"))
6
6
  DIGITOS = int(os.getenv("DIGITOS", config["DEFAULT"].getint("digitos", fallback=0)))
@@ -1,5 +1,9 @@
1
1
  from mtcli.logger import setup_logger
2
- from mtcli_volume.models.volume_model import obter_rates, calcular_profile, calcular_estatisticas
2
+ from mtcli_volume.models.volume_model import (
3
+ calcular_estatisticas,
4
+ calcular_profile,
5
+ obter_rates,
6
+ )
3
7
 
4
8
  log = setup_logger()
5
9
 
@@ -1,8 +1,10 @@
1
1
  from collections import defaultdict
2
+
2
3
  import MetaTrader5 as mt5
3
- from mtcli.mt5_context import mt5_conexao
4
+
4
5
  from mtcli.logger import setup_logger
5
6
  from mtcli.models.rates_model import RatesModel
7
+ from mtcli.mt5_context import mt5_conexao
6
8
  from mtcli_volume.conf import DIGITOS
7
9
 
8
10
  log = setup_logger()
@@ -57,6 +59,7 @@ def calcular_profile(rates, step, volume="tick"):
57
59
 
58
60
  return dict(profile)
59
61
 
62
+
60
63
  def calcular_estatisticas(profile):
61
64
  """Calcula POC, área de valor (70%), HVNs e LVNs."""
62
65
  if profile is None or len(profile) == 0:
@@ -93,4 +96,3 @@ def calcular_estatisticas(profile):
93
96
  "hvns": hvns,
94
97
  "lvns": lvns,
95
98
  }
96
-
@@ -1,4 +1,5 @@
1
1
  import click
2
+
2
3
  from mtcli_volume.conf import DIGITOS
3
4
 
4
5
  BARRA_CHAR = "#" # Pode mudar para "■" ou "=" se UTF-8 for garantido
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mtcli-volume"
3
- version = "2.0.0.dev1"
3
+ version = "2.0.0.dev3"
4
4
  description = "Plugin mtcli para exibir o volume profile"
5
5
  authors = [
6
6
  {name = "Valmir França da Silva",email = "vfranca3@gmail.com"}
@@ -27,8 +27,34 @@ build-backend = "poetry.core.masonry.api"
27
27
  [tool.poetry.group.dev.dependencies]
28
28
  pytest = "^8.4.2"
29
29
  pytest-cov = "^6.2.1"
30
- black = "^25.1.0"
31
30
  pytest-mock = "^3.15.1"
31
+ ruff = "^0.14.1"
32
32
 
33
33
  [tool.poetry.group.docs.dependencies]
34
34
  mkdocs = "^1.6.1"
35
+
36
+ [tool.ruff]
37
+ line-length = 88
38
+ target-version = "py311"
39
+
40
+ [tool.ruff.lint]
41
+ select = [
42
+ "E", # Estilo
43
+ "F", # Lógica
44
+ "B", # Boas práticas
45
+ "I", # Imports
46
+ "UP", # Upgrade
47
+ "N", # Naming
48
+ ]
49
+ ignore = ["E501"]
50
+
51
+ [tool.ruff.lint.isort]
52
+ known-first-party = ["mtcli", "mtcli_volume"]
53
+ combine-as-imports = true
54
+ force-sort-within-sections = true
55
+
56
+ [tool.ruff.format]
57
+ quote-style = "double"
58
+ indent-style = "space"
59
+ line-ending = "auto"
60
+ skip-magic-trailing-comma = false
@@ -1,30 +0,0 @@
1
- import click
2
- from mtcli_volume.controllers.volume_controller import calcular_volume_profile
3
- from mtcli_volume.views.volume_view import exibir_volume_profile
4
- from mtcli_volume.conf import SYMBOL, PERIOD, BARS, STEP, VOLUME
5
-
6
-
7
- @click.command(
8
- "volume",
9
- help="Exibe o Volume Profile, agrupando volumes por faixa de preço no histórico recente."
10
- )
11
- @click.version_option(package_name="mtcli-volume")
12
- @click.option("--symbol", "-s", default=SYMBOL, help="Símbolo do ativo (default WIN$N).")
13
- @click.option("--period", "-p", default=PERIOD, help="Timeframe (ex: M1, M5, H1).")
14
- @click.option("--bars", "-b", default=BARS, help="Número de barras (default 566).")
15
- @click.option(
16
- "--step", "-e", type=float, default=STEP,
17
- help="Tamanho do agrupamento de preços (default 100)."
18
- )
19
- @click.option(
20
- "--volume", "-v", default=VOLUME,
21
- help="Tipo de volume (tick ou real), default tick."
22
- )
23
- def volume(symbol, period, bars, step, volume):
24
- """Exibe o Volume Profile agrupando volumes por faixa de preço."""
25
- profile, stats = calcular_volume_profile(symbol, period, bars, step, volume)
26
- exibir_volume_profile(profile, stats, symbol)
27
-
28
-
29
- if __name__ == "__main__":
30
- volume()