mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-13 10:48:08 +00:00
PyMtApi5: implemented function ChartNext
This commit is contained in:
+5
-1
@@ -66,6 +66,7 @@ class Mt5ApiApp:
|
|||||||
"ChartXYToTimePrice": self.process_chart_xy_to_time_price,
|
"ChartXYToTimePrice": self.process_chart_xy_to_time_price,
|
||||||
"ChartOpen": self.process_chart_open,
|
"ChartOpen": self.process_chart_open,
|
||||||
"ChartFirst": self.process_chart_first,
|
"ChartFirst": self.process_chart_first,
|
||||||
|
"ChartNext": self.process_chart_next,
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_disconnect(self, error_msg=None):
|
def on_disconnect(self, error_msg=None):
|
||||||
@@ -97,7 +98,6 @@ class Mt5ApiApp:
|
|||||||
|
|
||||||
def process_command(self, mtapi, command):
|
def process_command(self, mtapi, command):
|
||||||
pieces = command.split(" ", 1)
|
pieces = command.split(" ", 1)
|
||||||
print(f"pieces count: {len(pieces)}")
|
|
||||||
if len(pieces) == 0 or len(pieces) > 2:
|
if len(pieces) == 0 or len(pieces) > 2:
|
||||||
print(f"! Invalid command format: {command.rstrip()}")
|
print(f"! Invalid command format: {command.rstrip()}")
|
||||||
return
|
return
|
||||||
@@ -496,6 +496,10 @@ class Mt5ApiApp:
|
|||||||
result = mtapi.chart_first()
|
result = mtapi.chart_first()
|
||||||
print(f"> ChartFirst: response = {result}")
|
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):
|
def mtapi_command_thread(self, mtapi):
|
||||||
while mtapi.is_connected():
|
while mtapi.is_connected():
|
||||||
filename = "client.cmd"
|
filename = "client.cmd"
|
||||||
|
|||||||
@@ -504,6 +504,10 @@ class Mt5ApiClient:
|
|||||||
def chart_first(self):
|
def chart_first(self):
|
||||||
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartFirst)
|
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
|
# Private methods
|
||||||
|
|
||||||
def __event_thread_func(self):
|
def __event_thread_func(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user