Administrator
2023-08-15 468431f3d4d65093fc061e01eed2256cf83470bd
++++++++++++++++
bug修复-
3个文件已修改
26 ■■■■■ 已修改文件
huaxin_api/l2_client.py 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_api/trade_client.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.py 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_api/l2_client.py
@@ -523,7 +523,7 @@
def __receive_from_pipe_strategy(pipe_):
    while True:
        print("__receive_from_pipe_strategy")
        # print("__receive_from_pipe_strategy")
        try:
            val = pipe_.recv()
            if val:
@@ -537,22 +537,24 @@
def run(pipe_trade, pipe_strategy):
    __init_l2()
    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=lambda: __receive_from_pipe_strategy(pipe_strategy), daemon=True)
        t1 = threading.Thread(target=__receive_from_pipe_strategy, args=(pipe_strategy,), daemon=True)
        t1.start()
    __init_l2()
    l2_data_manager.run_upload_common()
    global l2CommandManager
    l2CommandManager = command_manager.L2CommandManager()
    l2CommandManager.init(MyL2ActionCallback())
    print("l2_client启动成功")
    while True:
        time.sleep(2)
if __name__ == "__main__":
    run(None,None)
    run(None, None)
    # spi.set_codes_data([("000333", 12000)])
    input()
huaxin_api/trade_client.py
@@ -942,6 +942,8 @@
    tradeCommandManager.init(MyTradeActionCallback(), l2pipe, pipe_strategy)
    tradeCommandManager.run()
    print("trade_client启动成功")
    while True:
        time.sleep(2)
if __name__ == "__main__":
main.py
@@ -76,11 +76,15 @@
    tradeServerProcess.start()
    # 交易进程与L2进程
    tradeProcess = multiprocessing.Process(target=lambda: huaxin_api.trade_client.run(ptl2_trade, pst_trade))
    l2Process = multiprocessing.Process(target=lambda: huaxin_api.l2_client.run(ptl2_l2, psl2_l2))
    tradeProcess.start()
    l2Process = multiprocessing.Process(target=huaxin_api.l2_client.run, args=(ptl2_l2, psl2_l2,))
    l2Process.start()
    #
    tradeProcess = multiprocessing.Process(target=huaxin_api.trade_client.run,args=(ptl2_trade, pst_trade,))
    tradeProcess.start()
    # L1订阅数据
    huaxin_api.l1_client.run_async(pl1t_l1)
    # 将tradeServer作为主进程
    input()
    tradeServerProcess.join()
    tradeProcess.join()
    l2Process.join()