mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-29 11:37:48 +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,
|
||||
"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"
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user