mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-16 20:28:09 +00:00
PyMtApi5: implemented function ChartClose
This commit is contained in:
@@ -67,6 +67,7 @@ class Mt5ApiApp:
|
|||||||
"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,
|
"ChartNext": self.process_chart_next,
|
||||||
|
"ChartClose": self.process_chart_close,
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_disconnect(self, error_msg=None):
|
def on_disconnect(self, error_msg=None):
|
||||||
@@ -500,6 +501,10 @@ class Mt5ApiApp:
|
|||||||
result = mtapi.chart_next(int(parameters))
|
result = mtapi.chart_next(int(parameters))
|
||||||
print(f"> ChartNext: response = {result}")
|
print(f"> ChartNext: response = {result}")
|
||||||
|
|
||||||
|
def process_chart_close(self, mtapi, parameters):
|
||||||
|
result = mtapi.chart_close(int(parameters))
|
||||||
|
print(f"> ChartClose: 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"
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ class Mt5ApiClient:
|
|||||||
|
|
||||||
# ChartOpen
|
# ChartOpen
|
||||||
def chart_open(self, symbol: str, period: ENUM_TIMEFRAMES):
|
def chart_open(self, symbol: str, period: ENUM_TIMEFRAMES):
|
||||||
cmd_params = {"Symbol": symbol, "Timeframe": period};
|
cmd_params = {"Symbol": symbol, "Timeframe": period}
|
||||||
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartOpen, cmd_params)
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartOpen, cmd_params)
|
||||||
|
|
||||||
# ChartFirst
|
# ChartFirst
|
||||||
@@ -508,6 +508,10 @@ class Mt5ApiClient:
|
|||||||
cmd_params = {"ChartId": chart_id}
|
cmd_params = {"ChartId": chart_id}
|
||||||
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartNext, cmd_params)
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartNext, cmd_params)
|
||||||
|
|
||||||
|
def chart_close(self, chart_id):
|
||||||
|
cmd_params = {"ChartId": chart_id}
|
||||||
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartClose, cmd_params)
|
||||||
|
|
||||||
# Private methods
|
# Private methods
|
||||||
|
|
||||||
def __event_thread_func(self):
|
def __event_thread_func(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user