mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-22 07:08:16 +00:00
PyMtApi5: implemented function CopyBuffer
This commit is contained in:
@@ -45,6 +45,7 @@ class Mt5ApiApp:
|
|||||||
"MarketBookAdd": self.process_market_book_add,
|
"MarketBookAdd": self.process_market_book_add,
|
||||||
"MarketBookRelease": self.process_market_book_release,
|
"MarketBookRelease": self.process_market_book_release,
|
||||||
"MarketBookGet": self.process_market_book_get,
|
"MarketBookGet": self.process_market_book_get,
|
||||||
|
"CopyBuffer": self.process_copy_buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_disconnect(self, error_msg=None):
|
def on_disconnect(self, error_msg=None):
|
||||||
@@ -278,6 +279,18 @@ class Mt5ApiApp:
|
|||||||
result = mtapi.market_book_get(symbol)
|
result = mtapi.market_book_get(symbol)
|
||||||
print(f"> MarketBookGet: response = {result}")
|
print(f"> MarketBookGet: response = {result}")
|
||||||
|
|
||||||
|
def process_copy_buffer(self, mtapi, parameters):
|
||||||
|
pieces = parameters.split(" ", 3)
|
||||||
|
if len(pieces) != 4 or not pieces[0] or not pieces[1] or not pieces[2] or not pieces[3]:
|
||||||
|
print(f"! Invalid parameters for command CopyBuffer: {parameters}")
|
||||||
|
return
|
||||||
|
indicator_handle = int(pieces[0])
|
||||||
|
buffer_num = int(pieces[1])
|
||||||
|
start_pos = int(pieces[2])
|
||||||
|
count = int(pieces[3])
|
||||||
|
result = mtapi.copy_buffer(indicator_handle, buffer_num, start_pos, count)
|
||||||
|
print(f"> CopyBuffer: 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"
|
||||||
|
|||||||
@@ -244,9 +244,9 @@ class Mt5ApiClient:
|
|||||||
return self.__send_command(self.__get_default_expert(), Mt5CommandType.BarsCalculated, cmd_params)
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.BarsCalculated, cmd_params)
|
||||||
|
|
||||||
# CopyBuffer
|
# CopyBuffer
|
||||||
def copy_buffer(self):
|
def copy_buffer(self, indicator_handle: int, buffer_num: int, start_pos: int, count: int):
|
||||||
# TODO
|
cmdParams = {"IndicatorHandle": indicator_handle , "BufferNum": buffer_num, "StartPos": start_pos , "Count": count};
|
||||||
pass
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.CopyBuffer, cmdParams)
|
||||||
|
|
||||||
# CopyRates
|
# CopyRates
|
||||||
def copy_rates(self):
|
def copy_rates(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user