PyMtApi5: implemented function ChartNext

This commit is contained in:
Vyacheslav Demidyuk
2025-03-07 14:19:53 +02:00
parent f3360cf6d6
commit 80e4886d4f
2 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -66,6 +66,7 @@ class Mt5ApiApp:
"ChartXYToTimePrice": self.process_chart_xy_to_time_price,
"ChartOpen": self.process_chart_open,
"ChartFirst": self.process_chart_first,
"ChartNext": self.process_chart_next,
}
def on_disconnect(self, error_msg=None):
@@ -97,7 +98,6 @@ class Mt5ApiApp:
def process_command(self, mtapi, command):
pieces = command.split(" ", 1)
print(f"pieces count: {len(pieces)}")
if len(pieces) == 0 or len(pieces) > 2:
print(f"! Invalid command format: {command.rstrip()}")
return
@@ -496,6 +496,10 @@ class Mt5ApiApp:
result = mtapi.chart_first()
print(f"> ChartFirst: response = {result}")
def process_chart_next(self, mtapi, parameters):
result = mtapi.chart_next(int(parameters))
print(f"> ChartNext: response = {result}")
def mtapi_command_thread(self, mtapi):
while mtapi.is_connected():
filename = "client.cmd"
+4
View File
@@ -504,6 +504,10 @@ class Mt5ApiClient:
def chart_first(self):
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartFirst)
def chart_next(self, chart_id):
cmd_params = {"ChartId": chart_id}
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartNext, cmd_params)
# Private methods
def __event_thread_func(self):