From c265bb186a6b6e2a31689d599be59b5b6f10cf42 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期三, 30 八月 2023 11:10:32 +0800
Subject: [PATCH] 将交易合并进策略进程

---
 main.py |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/main.py b/main.py
index 1d7e4b2..7cdbfc7 100644
--- a/main.py
+++ b/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("涓昏繘绋婭D锛歿}", 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)
     # 灏唗radeServer浣滀负涓昏繘绋�
     tradeServerProcess.join()
-    tradeProcess.join()

--
Gitblit v1.8.0