@@ -0,0 +1,2195 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0A    DWX_ZMQ_Execution.py%0A    --%0A    @author: Darwinex Labs (www.darwinex.com)%0A    %0A    Copyright (c) 2019 onwards, Darwinex. All rights reserved.%0A    %0A    Licensed under the BSD 3-Clause License, you may not use this file except %0A    in compliance with the License. %0A    %0A    You may obtain a copy of the License at:    %0A    https://opensource.org/licenses/BSD-3-Clause%0A%22%22%22%0A%0Afrom pandas import to_datetime%0Afrom time import sleep%0A%0Aclass DWX_ZMQ_Execution():%0A    %0A    def __init__(self, _zmq):%0A        self._zmq = _zmq%0A    %0A    ##########################################################################%0A    %0A    def _execute_(self, %0A                  _exec_dict,%0A                  _verbose=False, %0A                  _delay=0.1,%0A                  _wbreak=10):%0A        %0A        _check = ''%0A        %0A        # Reset thread data output%0A        self._zmq._set_response_(None)%0A        %0A        # OPEN TRADE%0A        if _exec_dict%5B'_action'%5D == 'OPEN':%0A            %0A            _check = '_action'%0A            self._zmq._DWX_MTX_NEW_TRADE_(_order=_exec_dict)%0A            %0A        # CLOSE TRADE%0A        elif _exec_dict%5B'_action'%5D == 'CLOSE':%0A            %0A            _check = '_response_value'%0A            self._zmq._DWX_MTX_CLOSE_TRADE_BY_TICKET_(_exec_dict%5B'_ticket'%5D)%0A            %0A        if _verbose:%0A            print('%5Cn%5B%7B%7D%5D %7B%7D -%3E MetaTrader'.format(_exec_dict%5B'_comment'%5D,%0A                                                   str(_exec_dict)))%0A            %0A        # While loop start time reference            %0A        _ws = to_datetime('now')%0A        %0A        # While data not received, sleep until timeout%0A        while self._zmq._valid_response_('zmq') == False:%0A            sleep(_delay)%0A            %0A            if (to_datetime('now') - _ws).total_seconds() %3E (_delay * _wbreak):%0A                break%0A        %0A        # If data received, return DataFrame%0A        if self._zmq._valid_response_('zmq'):%0A            %0A            if _check in self._zmq._get_response_().keys():%0A                return self._zmq._get_response_()%0A                %0A        # Default%0A        return None%0A    %0A    ##########################################################################%0A    %0A

Create DWX_ZMQ_Execution.py