PyMtApi5: implemented function ChartId

This commit is contained in:
Vyacheslav Demidyuk
2025-01-26 12:01:14 +02:00
parent d728e10923
commit beacad1a10
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -57,6 +57,7 @@ class Mt5ApiApp:
"CopyRealVolume": self.process_copy_real_volume,
"CopySpread": self.process_copy_spread,
"CopyTicks": self.process_copy_ticks,
"ChartId": self.process_chart_id,
}
def on_disconnect(self, error_msg=None):
@@ -422,6 +423,10 @@ class Mt5ApiApp:
result = mtapi.copy_ticks(symbol_name, timeframe, from_date, count)
print(f"> CopyTicks: response = {result}")
def process_chart_id(self, mtapi, parameters):
result = mtapi.chart_id(int(parameters))
print(f"> ChatId: response = {result}")
def mtapi_command_thread(self, mtapi):
while mtapi.is_connected():
filename = "client.cmd"
+6
View File
@@ -452,6 +452,12 @@ class Mt5ApiClient:
cmd_params = {"Symbol": symbol}
return self.__send_command(self.__get_default_expert(), Mt5CommandType.MarketBookGet, cmd_params)
def chart_id(self, expert_handle = 0):
if expert_handle == 0:
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartId)
else:
return self.__send_command(expert_handle, Mt5CommandType.ChartId)
# Private methods
def __event_thread_func(self):