mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-28 02:57:56 +00:00
PyMtApi5: implemented function ChartRedraw
This commit is contained in:
@@ -58,6 +58,7 @@ class Mt5ApiApp:
|
||||
"CopySpread": self.process_copy_spread,
|
||||
"CopyTicks": self.process_copy_ticks,
|
||||
"ChartId": self.process_chart_id,
|
||||
"ChartRedraw": self.process_chart_redraw,
|
||||
}
|
||||
|
||||
def on_disconnect(self, error_msg=None):
|
||||
@@ -427,6 +428,10 @@ class Mt5ApiApp:
|
||||
result = mtapi.chart_id(int(parameters))
|
||||
print(f"> ChatId: response = {result}")
|
||||
|
||||
def process_chart_redraw(self, mtapi, parameters):
|
||||
mtapi.chart_redraw(int(parameters))
|
||||
print(f"> ChartRedraw: success")
|
||||
|
||||
def mtapi_command_thread(self, mtapi):
|
||||
while mtapi.is_connected():
|
||||
filename = "client.cmd"
|
||||
|
||||
@@ -458,6 +458,10 @@ class Mt5ApiClient:
|
||||
else:
|
||||
return self.__send_command(expert_handle, Mt5CommandType.ChartId)
|
||||
|
||||
def chart_redraw(self, chart_id = 0):
|
||||
cmd_params = {"ChartId": chart_id}
|
||||
self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartRedraw, cmd_params)
|
||||
|
||||
# Private methods
|
||||
|
||||
def __event_thread_func(self):
|
||||
@@ -489,7 +493,9 @@ class Mt5ApiClient:
|
||||
error_message = response_json["ErrorMessage"]
|
||||
self.__logger.warning(f"send_command: ErrorCode = {error_code}. {error_message}")
|
||||
raise Exception(f"Failed to send command: ErrorCode = {error_code}. {error_message} ")
|
||||
return response_json["Value"]
|
||||
if "Value" in response_json:
|
||||
return response_json["Value"]
|
||||
return None
|
||||
|
||||
def __process_tick_event(self, payload):
|
||||
quote_json = json.loads(payload)
|
||||
|
||||
Reference in New Issue
Block a user