File tree Expand file tree Collapse file tree 1 file changed +43
-1
lines changed Expand file tree Collapse file tree 1 file changed +43
-1
lines changed Original file line number Diff line number Diff line change 26
26
27
27
ERROR_DICT ['01101' ] = 'Undefined check terminal connection error'
28
28
29
+ ERROR_DICT ['01201' ] = 'Undefined check MT type error'
30
+
29
31
ERROR_DICT ['00401' ] = 'Instrument not in demo'
30
32
ERROR_DICT ['00402' ] = 'Instrument not exists for broker'
31
33
@@ -286,7 +288,7 @@ def Check_terminal_server_connection(self) -> bool:
286
288
x = dataString .split ('^' )
287
289
288
290
if x [2 ] == 'OK' :
289
- self .timeout = True
291
+ self .timeout = False
290
292
self .command_OK = True
291
293
return True
292
294
else :
@@ -298,6 +300,45 @@ def Check_terminal_server_connection(self) -> bool:
298
300
self .command_return_error = ERROR_DICT ['01101' ]
299
301
self .command_OK = False
300
302
return False
303
+
304
+ def Check_terminal_type (self ) -> str :
305
+ """
306
+ Checks for MT4 or MT5 terminal.
307
+ Args:
308
+ None
309
+ Returns:
310
+ string: if function for MT4 terminal answer would be 'MT4', for MT5 terminal 'MT5'
311
+
312
+ """
313
+
314
+ self .command = 'F012^1^'
315
+ self .command_return_error = ''
316
+ ok , dataString = self .send_command (self .command )
317
+
318
+ try :
319
+ if (ok == False ):
320
+ self .command_OK = False
321
+ return False
322
+
323
+ x = dataString .split ('^' )
324
+
325
+ if x [3 ] == 'MT4' :
326
+ self .timeout = False
327
+ self .command_OK = True
328
+ return 'MT4'
329
+ elif x [3 ] == 'MT5' :
330
+ self .timeout = False
331
+ self .command_OK = True
332
+ return 'MT5'
333
+ else :
334
+ self .timeout = False
335
+ self .command_return_error = ERROR_DICT ['99900' ]
336
+ self .command_OK = True
337
+ return False
338
+ except :
339
+ self .command_return_error = ERROR_DICT ['01201' ]
340
+ self .command_OK = False
341
+ return False
301
342
302
343
@property
303
344
def IsConnected (self ) -> bool :
@@ -2291,3 +2332,4 @@ def create_empty_DataFrame(self,
2291
2332
('comment' , str ) ]
2292
2333
2293
2334
2335
+
You can’t perform that action at this time.
0 commit comments