pdmt5 0.1.0__py3-none-any.whl → 0.1.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.
- pdmt5/dataframe.py +7 -10
- pdmt5/mt5.py +0 -3
- {pdmt5-0.1.0.dist-info → pdmt5-0.1.1.dist-info}/METADATA +1 -1
- pdmt5-0.1.1.dist-info/RECORD +9 -0
- pdmt5-0.1.0.dist-info/RECORD +0 -9
- {pdmt5-0.1.0.dist-info → pdmt5-0.1.1.dist-info}/WHEEL +0 -0
- {pdmt5-0.1.0.dist-info → pdmt5-0.1.1.dist-info}/licenses/LICENSE +0 -0
pdmt5/dataframe.py
CHANGED
|
@@ -29,7 +29,6 @@ class Mt5Config(BaseModel):
|
|
|
29
29
|
timeout: int | None = Field(
|
|
30
30
|
default=None, description="Connection timeout in milliseconds"
|
|
31
31
|
)
|
|
32
|
-
portable: bool | None = Field(default=None, description="Use portable mode")
|
|
33
32
|
|
|
34
33
|
|
|
35
34
|
class Mt5DataClient(Mt5Client):
|
|
@@ -51,14 +50,13 @@ class Mt5DataClient(Mt5Client):
|
|
|
51
50
|
description="Number of retry attempts for connection initialization",
|
|
52
51
|
)
|
|
53
52
|
|
|
54
|
-
def
|
|
53
|
+
def initialize_and_login_mt5(
|
|
55
54
|
self,
|
|
56
55
|
path: str | None = None,
|
|
57
56
|
login: int | None = None,
|
|
58
57
|
password: str | None = None,
|
|
59
58
|
server: str | None = None,
|
|
60
59
|
timeout: int | None = None,
|
|
61
|
-
portable: bool | None = None,
|
|
62
60
|
) -> None:
|
|
63
61
|
"""Initialize MetaTrader5 connection with retry logic.
|
|
64
62
|
|
|
@@ -70,18 +68,16 @@ class Mt5DataClient(Mt5Client):
|
|
|
70
68
|
password: Account password (overrides config).
|
|
71
69
|
server: Server name (overrides config).
|
|
72
70
|
timeout: Connection timeout (overrides config).
|
|
73
|
-
portable: Use portable mode (overrides config).
|
|
74
71
|
|
|
75
72
|
Raises:
|
|
76
73
|
Mt5RuntimeError: If initialization fails after retries.
|
|
77
74
|
"""
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
path = path or self.config.path
|
|
76
|
+
login_kwargs = {
|
|
80
77
|
"login": login or self.config.login,
|
|
81
78
|
"password": password or self.config.password,
|
|
82
79
|
"server": server or self.config.server,
|
|
83
80
|
"timeout": timeout or self.config.timeout,
|
|
84
|
-
"portable": portable if portable is not None else self.config.portable,
|
|
85
81
|
}
|
|
86
82
|
for i in range(1 + max(0, self.retry_count)):
|
|
87
83
|
if i:
|
|
@@ -91,11 +87,12 @@ class Mt5DataClient(Mt5Client):
|
|
|
91
87
|
self.retry_count,
|
|
92
88
|
)
|
|
93
89
|
time.sleep(i)
|
|
94
|
-
if self.initialize(**
|
|
95
|
-
|
|
90
|
+
if self.initialize(path=path, **login_kwargs) and (
|
|
91
|
+
(not login_kwargs["login"]) or self.login(**login_kwargs)
|
|
92
|
+
):
|
|
96
93
|
return
|
|
97
94
|
error_message = (
|
|
98
|
-
f"MT5
|
|
95
|
+
f"MT5 initialize and login failed after {self.retry_count} retries:"
|
|
99
96
|
f" {self.last_error()}"
|
|
100
97
|
)
|
|
101
98
|
raise Mt5RuntimeError(error_message)
|
pdmt5/mt5.py
CHANGED
|
@@ -106,7 +106,6 @@ class Mt5Client(BaseModel):
|
|
|
106
106
|
password: str | None = None,
|
|
107
107
|
server: str | None = None,
|
|
108
108
|
timeout: int | None = None,
|
|
109
|
-
portable: bool | None = None,
|
|
110
109
|
) -> bool:
|
|
111
110
|
"""Establish a connection with the MetaTrader 5 terminal.
|
|
112
111
|
|
|
@@ -116,7 +115,6 @@ class Mt5Client(BaseModel):
|
|
|
116
115
|
password: Trading account password.
|
|
117
116
|
server: Trade server address.
|
|
118
117
|
timeout: Connection timeout in milliseconds.
|
|
119
|
-
portable: Use portable mode.
|
|
120
118
|
|
|
121
119
|
Returns:
|
|
122
120
|
True if successful, False otherwise.
|
|
@@ -135,7 +133,6 @@ class Mt5Client(BaseModel):
|
|
|
135
133
|
"password": password,
|
|
136
134
|
"server": server,
|
|
137
135
|
"timeout": timeout,
|
|
138
|
-
"portable": portable,
|
|
139
136
|
}.items()
|
|
140
137
|
if v is not None
|
|
141
138
|
},
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
pdmt5/__init__.py,sha256=QbSFrsi7_bgFzb-ma4DmmUjR90UvrqKMnRZq1wPRmoI,446
|
|
2
|
+
pdmt5/dataframe.py,sha256=rUWtR23hrXBdBqzJhbOlIemNy73RrjSTZZJUhwoL6io,38084
|
|
3
|
+
pdmt5/mt5.py,sha256=KgxHapIrh5b4L0wIOAQIjfXNZafalihbFrh9fhYHmrI,32254
|
|
4
|
+
pdmt5/trading.py,sha256=4rT0WgK0JyLMv8XatXur8-NWqG6gh_8XQ-g5sVX9xq0,6987
|
|
5
|
+
pdmt5/utils.py,sha256=Ll5Q3OE5h1A_sZ_qVEnOPGniFlT6_MmHfuu0zqeLdeU,3913
|
|
6
|
+
pdmt5-0.1.1.dist-info/METADATA,sha256=q-ucK2453_zDdVKufYI03PmkfRqwt3WcNdTdwu1OPkw,9029
|
|
7
|
+
pdmt5-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
+
pdmt5-0.1.1.dist-info/licenses/LICENSE,sha256=iABrdaUGOBWLYotFupB_PGe8arV5o7rVhn-_vK6P704,1073
|
|
9
|
+
pdmt5-0.1.1.dist-info/RECORD,,
|
pdmt5-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
pdmt5/__init__.py,sha256=QbSFrsi7_bgFzb-ma4DmmUjR90UvrqKMnRZq1wPRmoI,446
|
|
2
|
-
pdmt5/dataframe.py,sha256=MumdFp72ZN_394X_viMkovfyb1c8C-LxLFTdymLEMYM,38345
|
|
3
|
-
pdmt5/mt5.py,sha256=rAY7MQalobUWZtMfC_xyTFCDTuU3EkFAyY_geBl6cyg,32379
|
|
4
|
-
pdmt5/trading.py,sha256=4rT0WgK0JyLMv8XatXur8-NWqG6gh_8XQ-g5sVX9xq0,6987
|
|
5
|
-
pdmt5/utils.py,sha256=Ll5Q3OE5h1A_sZ_qVEnOPGniFlT6_MmHfuu0zqeLdeU,3913
|
|
6
|
-
pdmt5-0.1.0.dist-info/METADATA,sha256=MJKmvQctS6kaU_OhqtXOYJNNa1uUutr2smvmUfnUD5g,9029
|
|
7
|
-
pdmt5-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
-
pdmt5-0.1.0.dist-info/licenses/LICENSE,sha256=iABrdaUGOBWLYotFupB_PGe8arV5o7rVhn-_vK6P704,1073
|
|
9
|
-
pdmt5-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|