| | |
| | | def init(cls, trade_action_callback: TradeActionCallback, |
| | | queue_strategy_trade_read_for_trade: multiprocessing.Queue): |
| | | cls.action_callback = trade_action_callback |
| | | cls.queue_strategy_trade_read = queue_strategy_trade_read_for_trade |
| | | cls.queue_strategy_w_trade_r = queue_strategy_trade_read_for_trade |
| | | |
| | | @classmethod |
| | | def process_command(cls, _type, client_id, result_json, sk=None): |
| | |
| | | # 维护连接数的稳定 |
| | | def run(self, blocking=True): |
| | | if blocking: |
| | | self.run_process_command(self.queue_strategy_trade_read) |
| | | self.run_process_command(self.queue_strategy_w_trade_r) |
| | | else: |
| | | # 接受命令 |
| | | t1 = threading.Thread(target=lambda: self.run_process_command(self.queue_strategy_trade_read), daemon=True) |
| | | t1 = threading.Thread(target=lambda: self.run_process_command(self.queue_strategy_w_trade_r), daemon=True) |
| | | t1.start() |
| | | |
| | | |