| | |
| | | import threading |
| | | import time |
| | | |
| | | from huaxin_client import command_manager |
| | | from huaxin_client import command_manager, l2_data_transaction_protocol |
| | | from huaxin_client import constant |
| | | from huaxin_client import l2_data_manager |
| | | import lev2mdapi |
| | |
| | | for c in del_codes: |
| | | l2_data_manager.target_codes.discard(c) |
| | | for c in add_codes: |
| | | l2_data_manager.run_upload_task(c) |
| | | l2_data_manager.run_upload_task(c, pipe_strategy) |
| | | self.__subscribe(add_codes) |
| | | self.__unsubscribe(del_codes) |
| | | |
| | |
| | | data = json.loads(val) |
| | | if data["data"]["type"] == "l2_cmd": |
| | | l2CommandManager.process_command(command_manager.CLIENT_TYPE_CMD_L2, None, data) |
| | | else: |
| | | l2_data_transaction_protocol.set_write_rece_data(data) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | |
| | | |
| | | def run(pipe_trade, pipe_strategy): |
| | | pipe_strategy = None |
| | | |
| | | |
| | | def run(pipe_trade, _pipe_strategy): |
| | | logger_system.info("L2进程ID:{}", os.getpid()) |
| | | log.close_print() |
| | | if pipe_trade is not None: |
| | | t1 = threading.Thread(target=lambda: __receive_from_pipe_trade(pipe_trade), daemon=True) |
| | | t1.start() |
| | | if pipe_strategy is not None: |
| | | t1 = threading.Thread(target=__receive_from_pipe_strategy, args=(pipe_strategy,), daemon=True) |
| | | if _pipe_strategy is not None: |
| | | global pipe_strategy |
| | | pipe_strategy = _pipe_strategy |
| | | t1 = threading.Thread(target=__receive_from_pipe_strategy, args=(_pipe_strategy,), daemon=True) |
| | | t1.start() |
| | | __init_l2() |
| | | l2_data_manager.run_upload_common() |
| | | l2_data_manager.run_upload_trading_canceled() |
| | | l2_data_manager.run_log() |
| | | # l2_data_manager.run_test() |
| | | l2_data_manager.run_test() |
| | | global l2CommandManager |
| | | l2CommandManager = command_manager.L2CommandManager() |
| | | l2CommandManager.init(MyL2ActionCallback()) |