mtcli-risco 1.1.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
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_risco/conf.py +3 -3
- mtcli_risco/plugin.py +4 -4
- mtcli_risco/risco.py +6 -6
- {mtcli_risco-1.1.0.dist-info → mtcli_risco-1.2.1.dist-info}/METADATA +5 -1
- mtcli_risco-1.2.1.dist-info/RECORD +9 -0
- mtcli_risco-1.1.0.dist-info/RECORD +0 -9
- {mtcli_risco-1.1.0.dist-info → mtcli_risco-1.2.1.dist-info}/LICENSE +0 -0
- {mtcli_risco-1.1.0.dist-info → mtcli_risco-1.2.1.dist-info}/WHEEL +0 -0
- {mtcli_risco-1.1.0.dist-info → mtcli_risco-1.2.1.dist-info}/entry_points.txt +0 -0
mtcli_risco/conf.py
CHANGED
|
@@ -6,7 +6,7 @@ LOSS_LIMIT = float(
|
|
|
6
6
|
os.getenv("LOSS_LIMIT", config["DEFAULT"].getfloat("loss_limit", fallback=-180.00))
|
|
7
7
|
)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
config["DEFAULT"].get("
|
|
9
|
+
STATUS_FILE = os.getenv(
|
|
10
|
+
"STATUS_FILE",
|
|
11
|
+
config["DEFAULT"].get("status_file", fallback="bloqueio.json"),
|
|
12
12
|
)
|
mtcli_risco/plugin.py
CHANGED
|
@@ -4,7 +4,7 @@ import click
|
|
|
4
4
|
from datetime import date
|
|
5
5
|
from mtcli.conecta import conectar, shutdown
|
|
6
6
|
from mtcli.logger import setup_logger
|
|
7
|
-
from .conf import LOSS_LIMIT,
|
|
7
|
+
from .conf import LOSS_LIMIT, STATUS_FILE
|
|
8
8
|
from .risco import (
|
|
9
9
|
carregar_estado,
|
|
10
10
|
salvar_estado,
|
|
@@ -42,12 +42,12 @@ def cli(limite, lucro):
|
|
|
42
42
|
shutdown()
|
|
43
43
|
return
|
|
44
44
|
|
|
45
|
-
estado = carregar_estado(
|
|
45
|
+
estado = carregar_estado(STATUS_FILE)
|
|
46
46
|
hoje = date.today()
|
|
47
47
|
|
|
48
48
|
if estado["data"] != hoje.isoformat():
|
|
49
49
|
estado["bloqueado"] = False
|
|
50
|
-
salvar_estado(
|
|
50
|
+
salvar_estado(STATUS_FILE, hoje, False)
|
|
51
51
|
|
|
52
52
|
if estado["bloqueado"]:
|
|
53
53
|
click.echo("⚠ Bloqueado hoje por risco. Nenhuma ordem deve ser enviada.")
|
|
@@ -60,7 +60,7 @@ def cli(limite, lucro):
|
|
|
60
60
|
)
|
|
61
61
|
encerrar_todas_posicoes()
|
|
62
62
|
cancelar_todas_ordens()
|
|
63
|
-
salvar_estado(
|
|
63
|
+
salvar_estado(STATUS_FILE, hoje, True)
|
|
64
64
|
else:
|
|
65
65
|
click.echo("Dentro do limite de risco.")
|
|
66
66
|
|
mtcli_risco/risco.py
CHANGED
|
@@ -10,18 +10,18 @@ from mtcli.logger import setup_logger
|
|
|
10
10
|
log = setup_logger()
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def carregar_estado(
|
|
13
|
+
def carregar_estado(STATUS_FILE):
|
|
14
14
|
"""Carrega o estado do controle de risco."""
|
|
15
|
-
if os.path.exists(
|
|
16
|
-
with open(
|
|
17
|
-
log.info(f"Carregando dados do arquivo {
|
|
15
|
+
if os.path.exists(STATUS_FILE):
|
|
16
|
+
with open(STATUS_FILE, "r") as f:
|
|
17
|
+
log.info(f"Carregando dados do arquivo {STATUS_FILE}")
|
|
18
18
|
return json.load(f)
|
|
19
19
|
return {"data": None, "bloqueado": False}
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
def salvar_estado(
|
|
22
|
+
def salvar_estado(STATUS_FILE, data, bloqueado):
|
|
23
23
|
"""Salva o estado do controle de risco."""
|
|
24
|
-
with open(
|
|
24
|
+
with open(STATUS_FILE, "w") as f:
|
|
25
25
|
json.dump({"data": data.isoformat(), "bloqueado": bloqueado}, f)
|
|
26
26
|
log.info(f"Salvando o estado: data {data} bloqueado {bloqueado}")
|
|
27
27
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: mtcli-risco
|
|
3
|
-
Version: 1.1
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: Plugin do mtcli
|
|
5
5
|
License: GPL-3.0
|
|
6
6
|
Author: Valmir França da Silva
|
|
@@ -13,6 +13,10 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
15
|
Requires-Dist: mtcli (>=1.18.1)
|
|
16
|
+
Project-URL: Documentation, https://mtcli-risco.readthedocs.io
|
|
17
|
+
Project-URL: Homepage, https://github.com/vfranca/mtcli-risco
|
|
18
|
+
Project-URL: Repository, https://github.com/vfranca/mtcli-risco
|
|
19
|
+
Project-URL: issues, https://github.com/vfranca/mtcli-risco/issues
|
|
16
20
|
Description-Content-Type: text/markdown
|
|
17
21
|
|
|
18
22
|
# mtcli-risco
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
mtcli_risco/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
mtcli_risco/conf.py,sha256=_Urc7ilIB6_CuIzZNNU1hOaoHf_KBtGe4wCn-9PxeiA,279
|
|
3
|
+
mtcli_risco/plugin.py,sha256=r_PvHPopr96FGp1cY5XYGCpR5JoE7jAk3sX51CP_tOw,1805
|
|
4
|
+
mtcli_risco/risco.py,sha256=5N95xJ2Umo7nB1aZIrTamJ19_AeqdDFlpKLyGOSonx4,3490
|
|
5
|
+
mtcli_risco-1.2.1.dist-info/entry_points.txt,sha256=pPmBNOystUidnZ4FoPta9-6sM9u7FCneA-4Cm2RMq4s,52
|
|
6
|
+
mtcli_risco-1.2.1.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
7
|
+
mtcli_risco-1.2.1.dist-info/METADATA,sha256=pNODrbPDLT1lF-mWqObjibl5e9JBdlq2y75QX8LMS1M,2360
|
|
8
|
+
mtcli_risco-1.2.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
9
|
+
mtcli_risco-1.2.1.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
mtcli_risco/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mtcli_risco/conf.py,sha256=nNQUfiQJ-LPzAqMAyDIHUxcjc8wxZ1yVnwJaSualhuk,294
|
|
3
|
-
mtcli_risco/plugin.py,sha256=ebE19l2GuMCsWxR4STvs6BT6Ipoe6vneuoWx8tL7LII,1817
|
|
4
|
-
mtcli_risco/risco.py,sha256=PaPRsGJQT9AcxRN39DcwjaFV5kAecLMYfuDND9K9NYY,3508
|
|
5
|
-
mtcli_risco-1.1.0.dist-info/entry_points.txt,sha256=pPmBNOystUidnZ4FoPta9-6sM9u7FCneA-4Cm2RMq4s,52
|
|
6
|
-
mtcli_risco-1.1.0.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
7
|
-
mtcli_risco-1.1.0.dist-info/METADATA,sha256=O5EPnQeMDg_I5I3Bow4hIp4vm3VI6QAo0FA9CbovH38,2104
|
|
8
|
-
mtcli_risco-1.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
9
|
-
mtcli_risco-1.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|