Administrator
2023-08-30 c265bb186a6b6e2a31689d599be59b5b6f10cf42
main.py
@@ -23,7 +23,7 @@
# from huaxin_api import trade_client, l2_client, l1_client
def createTradeServer(pipe_server, pipe_trade, pipe_l1, pipe_l2,ptl2_l2,psl2_l2):
def createTradeServer(pipe_server, pipe_trade, pipe_l1, pipe_l2, ptl2_l2, psl2_l2, ptl2_trade, pst_trade):
    logger_system.info("策略进程ID:{}", os.getpid())
    log.close_print()
    # 初始化参数
@@ -45,8 +45,13 @@
    t1 = threading.Thread(target=huaxin_client.l2_client.run, args=(ptl2_l2, psl2_l2, trade_server.my_l2_data_callback), daemon=True)
    t1.start()
    # 启动华鑫交易服务
    t1 = threading.Thread(target=huaxin_client.trade_client.run, args=(trade_server.my_trade_response, ptl2_trade, pst_trade),
                          daemon=True)
    t1.start()
    # 交易服务
    trade_server.run(pipe_trade, pipe_l1, pipe_l2)
    trade_server.run(pipe_trade, pipe_l1, pipe_l2, huaxin_client.trade_client.process_cmd)
# 主服务
@@ -94,14 +99,10 @@
    logger_system.info("主进程ID:{}", os.getpid())
    tradeServerProcess = multiprocessing.Process(target=createTradeServer,
                                                 args=(pss_strategy, pst_strategy, pl1t_strategy, psl2_strategy,ptl2_l2, psl2_l2))
                                                 args=(pss_strategy, pst_strategy, pl1t_strategy, psl2_strategy,ptl2_l2, psl2_l2,ptl2_trade,pst_trade))
    tradeServerProcess.start()
    #
    tradeProcess = multiprocessing.Process(target=huaxin_client.trade_client.run, args=(ptl2_trade, pst_trade,))
    tradeProcess.start()
    # L1订阅数据
    huaxin_client.l1_client.run(pl1t_l1)
    # 将tradeServer作为主进程
    tradeServerProcess.join()
    tradeProcess.join()