| | |
| | | # from huaxin_api import trade_client, l2_client, l1_client |
| | | |
| | | |
| | | def createTradeServer(pipe_server, pipe_trade, pipe_l1, pipe_l2): |
| | | def createTradeServer(pipe_server, pipe_trade, pipe_l1, pipe_l2,ptl2_l2,psl2_l2): |
| | | logger_system.info("策略进程ID:{}", os.getpid()) |
| | | log.close_print() |
| | | # 初始化参数 |
| | |
| | | |
| | | # redis后台服务 |
| | | t1 = threading.Thread(target=redis_manager.RedisUtils.run_loop, daemon=True) |
| | | t1.start() |
| | | |
| | | # 启动L2订阅服务 |
| | | t1 = threading.Thread(target=huaxin_client.l2_client.run, args=(ptl2_l2, psl2_l2, trade_server.my_l2_data_callback), daemon=True) |
| | | t1.start() |
| | | |
| | | # 交易服务 |
| | |
| | | logger_system.info("主进程ID:{}", os.getpid()) |
| | | |
| | | tradeServerProcess = multiprocessing.Process(target=createTradeServer, |
| | | args=(pss_strategy, pst_strategy, pl1t_strategy, psl2_strategy)) |
| | | args=(pss_strategy, pst_strategy, pl1t_strategy, psl2_strategy,ptl2_l2, psl2_l2)) |
| | | tradeServerProcess.start() |
| | | |
| | | # 交易进程与L2进程 |
| | | |
| | | l2Process = multiprocessing.Process(target=huaxin_client.l2_client.run, args=(ptl2_l2, psl2_l2,)) |
| | | l2Process.start() |
| | | # |
| | | tradeProcess = multiprocessing.Process(target=huaxin_client.trade_client.run, args=(ptl2_trade, pst_trade,)) |
| | | tradeProcess.start() |
| | |
| | | # 将tradeServer作为主进程 |
| | | tradeServerProcess.join() |
| | | tradeProcess.join() |
| | | l2Process.join() |