From 583aaa9627e8bf48e8aeb5e222b37e1dc9695a6c Mon Sep 17 00:00:00 2001 From: Vyacheslav Demidyuk Date: Thu, 16 Jan 2025 23:34:53 +0200 Subject: [PATCH] PyMtApi5: implemented function SymbolInfoInteger --- PyMtApi5/client.py | 12 ++++++++++++ PyMtApi5/mt5apiclient.py | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/PyMtApi5/client.py b/PyMtApi5/client.py index bbf145a4..6bf6dd8a 100644 --- a/PyMtApi5/client.py +++ b/PyMtApi5/client.py @@ -83,6 +83,8 @@ class Mt5ApiApp: self.process_symbol_is_synchronized(mtapi, params) elif pieces[0] == "SymbolInfoDouble": self.process_symbol_info_double(mtapi, params) + elif pieces[0] == "SymbolInfoInteger": + self.process_symbol_info_integer(mtapi, params) else: print(f"! Unknown command: {pieces[0]}") @@ -202,6 +204,16 @@ class Mt5ApiApp: result = mtapi.symbol_info_double(symbol, prop_id) print(f"> SymbolInfoDouble: response = {result}") + def process_symbol_info_integer(self, mtapi, parameters): + pieces = parameters.split(' ', 1) + if len(pieces) != 2 or not pieces[0] or not pieces[1]: + print(f"! Invalid parameters for command SymbolInfoInteger: {parameters}") + return + symbol = pieces[0] + prop_id = mt5enums.ENUM_SYMBOL_INFO_INTEGER(int(pieces[1])) + result = mtapi.symbol_info_integer(symbol, prop_id) + print(f"> SymbolInfoInteger: response = {result}") + def mtapi_command_thread(self, mtapi): while mtapi.is_connected(): filename = "client.cmd" diff --git a/PyMtApi5/mt5apiclient.py b/PyMtApi5/mt5apiclient.py index 317a3389..d2d5d95c 100644 --- a/PyMtApi5/mt5apiclient.py +++ b/PyMtApi5/mt5apiclient.py @@ -328,6 +328,12 @@ class Mt5ApiClient: return self.__send_command( self.__get_default_expert(), Mt5CommandType.SymbolInfoDouble, cmd_params) + # SymbolInfoInteger + def symbol_info_integer(self, symbol_name: str, prop_id: ENUM_SYMBOL_INFO_INTEGER): + cmd_params = {"Symbol": symbol_name, "PropId": prop_id} + return self.__send_command( + self.__get_default_expert(), Mt5CommandType.SymbolInfoInteger, cmd_params) + # Private methods def __event_thread_func(self):