mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-16 04:08:10 +00:00
PyMtApi5: implemented function ChartPeriod
This commit is contained in:
@@ -69,6 +69,7 @@ class Mt5ApiApp:
|
|||||||
"ChartNext": self.process_chart_next,
|
"ChartNext": self.process_chart_next,
|
||||||
"ChartClose": self.process_chart_close,
|
"ChartClose": self.process_chart_close,
|
||||||
"ChartSymbol": self.process_chart_symbol,
|
"ChartSymbol": self.process_chart_symbol,
|
||||||
|
"ChartPeriod": self.process_chart_period,
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_disconnect(self, error_msg=None):
|
def on_disconnect(self, error_msg=None):
|
||||||
@@ -510,6 +511,10 @@ class Mt5ApiApp:
|
|||||||
result = mtapi.chart_symbol(int(parameters))
|
result = mtapi.chart_symbol(int(parameters))
|
||||||
print(f"> ChartSymbol: response = {result}")
|
print(f"> ChartSymbol: response = {result}")
|
||||||
|
|
||||||
|
def process_chart_period(self, mtapi, parameters):
|
||||||
|
result = mtapi.chart_period(int(parameters))
|
||||||
|
print(f"> ChartPeriod: 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,18 +504,26 @@ 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)
|
||||||
|
|
||||||
|
# ChartNext
|
||||||
def chart_next(self, chart_id):
|
def chart_next(self, chart_id):
|
||||||
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)
|
||||||
|
|
||||||
|
# ChartClose
|
||||||
def chart_close(self, chart_id):
|
def chart_close(self, chart_id):
|
||||||
cmd_params = {"ChartId": chart_id}
|
cmd_params = {"ChartId": chart_id}
|
||||||
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartClose, cmd_params)
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartClose, cmd_params)
|
||||||
|
|
||||||
|
# ChartSymbol
|
||||||
def chart_symbol(self, chart_id):
|
def chart_symbol(self, chart_id):
|
||||||
cmd_params = {"ChartId": chart_id}
|
cmd_params = {"ChartId": chart_id}
|
||||||
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartSymbol, cmd_params)
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartSymbol, cmd_params)
|
||||||
|
|
||||||
|
# ChartPeriod
|
||||||
|
def chart_period(self, chart_id):
|
||||||
|
cmd_params = {"ChartId": chart_id}
|
||||||
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartPeriod, cmd_params)
|
||||||
|
|
||||||
# Private methods
|
# Private methods
|
||||||
|
|
||||||
def __event_thread_func(self):
|
def __event_thread_func(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user