pdmt5 0.1.1__py3-none-any.whl → 0.1.2__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.
pdmt5/trading.py
CHANGED
|
@@ -32,6 +32,7 @@ class Mt5TradingClient(Mt5DataClient):
|
|
|
32
32
|
def close_open_positions(
|
|
33
33
|
self,
|
|
34
34
|
symbols: str | list[str] | tuple[str, ...] | None = None,
|
|
35
|
+
dry_run: bool | None = None,
|
|
35
36
|
**kwargs: Any, # noqa: ANN401
|
|
36
37
|
) -> dict[str, list[dict[str, Any]]]:
|
|
37
38
|
"""Close all open positions for specified symbols.
|
|
@@ -39,6 +40,8 @@ class Mt5TradingClient(Mt5DataClient):
|
|
|
39
40
|
Args:
|
|
40
41
|
symbols: Optional symbol or list of symbols to filter positions.
|
|
41
42
|
If None, all symbols will be considered.
|
|
43
|
+
dry_run: Optional flag to enable dry run mode. If None, uses the instance's
|
|
44
|
+
`dry_run` attribute.
|
|
42
45
|
**kwargs: Additional keyword arguments for request parameters.
|
|
43
46
|
|
|
44
47
|
Returns:
|
|
@@ -53,18 +56,22 @@ class Mt5TradingClient(Mt5DataClient):
|
|
|
53
56
|
symbol_list = self.symbols_get()
|
|
54
57
|
self.logger.info("Fetching and closing positions for symbols: %s", symbol_list)
|
|
55
58
|
return {
|
|
56
|
-
s: self._fetch_and_close_position(symbol=s, **kwargs)
|
|
59
|
+
s: self._fetch_and_close_position(symbol=s, dry_run=dry_run, **kwargs)
|
|
60
|
+
for s in symbol_list
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
def _fetch_and_close_position(
|
|
60
64
|
self,
|
|
61
65
|
symbol: str | None = None,
|
|
66
|
+
dry_run: bool | None = None,
|
|
62
67
|
**kwargs: Any, # noqa: ANN401
|
|
63
68
|
) -> list[dict[str, Any]]:
|
|
64
69
|
"""Close all open positions for a specific symbol.
|
|
65
70
|
|
|
66
71
|
Args:
|
|
67
72
|
symbol: Optional symbol filter.
|
|
73
|
+
dry_run: Optional flag to enable dry run mode. If None, uses the instance's
|
|
74
|
+
`dry_run` attribute.
|
|
68
75
|
**kwargs: Additional keyword arguments for request parameters.
|
|
69
76
|
|
|
70
77
|
Returns:
|
|
@@ -96,6 +103,7 @@ class Mt5TradingClient(Mt5DataClient):
|
|
|
96
103
|
"position": p["ticket"],
|
|
97
104
|
**kwargs,
|
|
98
105
|
},
|
|
106
|
+
dry_run=dry_run,
|
|
99
107
|
)
|
|
100
108
|
for p in positions_dict
|
|
101
109
|
]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
pdmt5/__init__.py,sha256=QbSFrsi7_bgFzb-ma4DmmUjR90UvrqKMnRZq1wPRmoI,446
|
|
2
2
|
pdmt5/dataframe.py,sha256=rUWtR23hrXBdBqzJhbOlIemNy73RrjSTZZJUhwoL6io,38084
|
|
3
3
|
pdmt5/mt5.py,sha256=KgxHapIrh5b4L0wIOAQIjfXNZafalihbFrh9fhYHmrI,32254
|
|
4
|
-
pdmt5/trading.py,sha256=
|
|
4
|
+
pdmt5/trading.py,sha256=aa4eqRl-xrYqMTdgKgdLJuvg2GIoziE5wA3SRPn0jMs,7377
|
|
5
5
|
pdmt5/utils.py,sha256=Ll5Q3OE5h1A_sZ_qVEnOPGniFlT6_MmHfuu0zqeLdeU,3913
|
|
6
|
-
pdmt5-0.1.
|
|
7
|
-
pdmt5-0.1.
|
|
8
|
-
pdmt5-0.1.
|
|
9
|
-
pdmt5-0.1.
|
|
6
|
+
pdmt5-0.1.2.dist-info/METADATA,sha256=0PTSBNZFHetz9WJZLndgNGUSoxFNXFy18rpNJZK05s4,9029
|
|
7
|
+
pdmt5-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
+
pdmt5-0.1.2.dist-info/licenses/LICENSE,sha256=iABrdaUGOBWLYotFupB_PGe8arV5o7rVhn-_vK6P704,1073
|
|
9
|
+
pdmt5-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|