mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-04 22:47:46 +00:00
PyMtApi5: implemented function ChartGetDouble
This commit is contained in:
@@ -73,6 +73,7 @@ class Mt5ApiApp:
|
|||||||
"ChartSetDouble": self.process_chart_set_double,
|
"ChartSetDouble": self.process_chart_set_double,
|
||||||
"ChartSetInteger": self.process_chart_set_integer,
|
"ChartSetInteger": self.process_chart_set_integer,
|
||||||
"ChartSetString": self.process_chart_set_string,
|
"ChartSetString": self.process_chart_set_string,
|
||||||
|
"ChartGetDouble": self.process_chart_get_double,
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_disconnect(self, error_msg=None):
|
def on_disconnect(self, error_msg=None):
|
||||||
@@ -545,6 +546,15 @@ class Mt5ApiApp:
|
|||||||
result = mtapi.chart_set_string(int(pieces[0]), prop_id, pieces[2])
|
result = mtapi.chart_set_string(int(pieces[0]), prop_id, pieces[2])
|
||||||
print(f"> ChartSetString: response = {result}")
|
print(f"> ChartSetString: response = {result}")
|
||||||
|
|
||||||
|
def process_chart_get_double(self, mtapi, parameters):
|
||||||
|
pieces = parameters.split(" ", 2)
|
||||||
|
if len(pieces) != 3 or not pieces[0] or not pieces[1] or not pieces[2]:
|
||||||
|
print(f"! Invalid parameters for command ChartGetDouble: {parameters}")
|
||||||
|
return
|
||||||
|
prop_id = mt5enums.ENUM_CHART_PROPERTY_DOUBLE(int(pieces[1]))
|
||||||
|
result = mtapi.chart_get_double(int(pieces[0]), prop_id, int(pieces[2]))
|
||||||
|
print(f"> ChartGetDouble: 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"
|
||||||
|
|||||||
@@ -357,6 +357,8 @@ class Mt5ApiClient:
|
|||||||
"Count": count,
|
"Count": count,
|
||||||
}
|
}
|
||||||
res = self.__send_command(self.__get_default_expert(), Mt5CommandType.CopyTicks, cmd_params)
|
res = self.__send_command(self.__get_default_expert(), Mt5CommandType.CopyTicks, cmd_params)
|
||||||
|
if res is None:
|
||||||
|
return None
|
||||||
ticks = [MqlTick(obj) for obj in res]
|
ticks = [MqlTick(obj) for obj in res]
|
||||||
return ticks
|
return ticks
|
||||||
|
|
||||||
@@ -539,6 +541,11 @@ class Mt5ApiClient:
|
|||||||
cmd_params = {"ChartId": chart_id, "PropId": prop_id, "Value": value}
|
cmd_params = {"ChartId": chart_id, "PropId": prop_id, "Value": value}
|
||||||
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartSetString, cmd_params)
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartSetString, cmd_params)
|
||||||
|
|
||||||
|
# ChartGetDouble
|
||||||
|
def chart_get_double(self, chart_id, prop_id: ENUM_CHART_PROPERTY_DOUBLE, sub_window=0):
|
||||||
|
cmd_params = {"ChartId": chart_id, "PropId": prop_id, "SubWindow": sub_window}
|
||||||
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartGetDouble, cmd_params)
|
||||||
|
|
||||||
# Private methods
|
# Private methods
|
||||||
|
|
||||||
def __event_thread_func(self):
|
def __event_thread_func(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user