PyMtApi5: implemented function SymbolInfoInteger

This commit is contained in:
Vyacheslav Demidyuk
2025-01-16 23:34:53 +02:00
parent 9d2884b608
commit 583aaa9627
2 changed files with 18 additions and 0 deletions
+12
View File
@@ -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"
+6
View File
@@ -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):