From 3e3d48294346798c794bbbfee9a3a2ac9b69dc05 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期四, 18 四月 2024 17:02:41 +0800
Subject: [PATCH] 共享内存/zeromq通信测试

---
 utils/data_export_util.py |   62 ++++++++++++++++++-------------
 1 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/utils/data_export_util.py b/utils/data_export_util.py
index ecec461..734dfa1 100644
--- a/utils/data_export_util.py
+++ b/utils/data_export_util.py
@@ -44,8 +44,11 @@
 
     sell_no_dict = log_export.load_huaxin_transaction_sell_no(code=code, date=date)
     sell_nos = sell_no_dict.get(code)
-
-    fdatas = export_l2_data(code, datas, process_indexs, trade_indexs, real_position_indexes, deal_list_dict, sell_nos)
+    active_sell_map = log_export.load_huaxin_active_sell_map(date=date)
+    active_sell_set = active_sell_map.get(code)
+    if not active_sell_set:
+        active_sell_set = set()
+    fdatas = export_l2_data(code, datas, process_indexs, trade_indexs, real_position_indexes, deal_list_dict, sell_nos, active_sell_set)
     return fdatas
 
 
@@ -54,11 +57,11 @@
         date = tool.get_now_date_str()
     sell_no_dict = log_export.load_huaxin_transaction_sell_no(code=code, date=date)
     sell_nos = sell_no_dict.get(code)
-    fdatas = export_l2_transaction_data(code,sell_nos)
+    fdatas = export_l2_transaction_data(code, sell_nos)
     return fdatas
 
 
-def export_l2_data(code, datas, process_indexs, trade_indexs, real_position_indexes, deal_list_dict, sell_nos):
+def export_l2_data(code, datas, process_indexs, trade_indexs, real_position_indexes, deal_list_dict, sell_nos, active_sell_nos):
     def find_process_index(index):
         for i in range(0, len(process_indexs)):
             if process_indexs[i][0] <= index <= process_indexs[i][1]:
@@ -75,7 +78,9 @@
     num_operate_map = {}
     l2.l2_data_util.load_num_operate_map(num_operate_map, code, datas)
     buy_no_map = {}
+    sell_no_map = {}
     l2.l2_data_util.load_buy_no_map(buy_no_map, code, datas)
+    l2.l2_data_util.load_sell_no_map(sell_no_map, code, datas)
 
     l2.l2_data_util.load_canceled_buy_no_map(l2.l2_data_util.local_today_canceled_buyno_map, code, datas)
 
@@ -89,6 +94,11 @@
     fdatas = []
     for data in datas:
         index += 1
+        # 鍏堢Щ闄�
+        if data['val']['orderNo'] in active_sell_nos:
+            # 杩囨护涓诲姩鍗�
+            continue
+
         trade_info = find_trade_index(data["index"])
         if not trade_info:
             # 鑾峰彇鐪熷疄涓嬪崟浣嶇疆
@@ -206,28 +216,28 @@
         order_no_index_map[int(d[10])] = i
     order_no_indexes = [(k, order_no_index_map[k]) for k in order_no_index_map]
     order_no_indexes.sort(key=lambda x: x[0])
-
-    if sell_nos:
-        for sell_info in sell_nos:
-            if sell_info[1] * sell_info[2] < 50 * 10000:
-                continue
-            for i in range(len(order_no_indexes) - 1):
-                if order_no_indexes[i][0] < sell_info[0] < order_no_indexes[i + 1][0]:
-                    item = []
-                    item.append(order_no_indexes[i + 1][1])
-                    item.append(l2_huaxin_util.convert_time(sell_info[3][0], with_ms=True))
-                    item.append("")
-                    item.append(
-                        "{}涓�".format(round(sell_info[1] * sell_info[2] / 10000, 1)))
-                    item.append(sell_info[2])
-                    item.append(sell_info[1] // 100)
-                    item.append("涓诲姩鍗�")
-                    item.append(1)
-                    item.append(l2_huaxin_util.convert_time(sell_info[4][0], with_ms=True))
-                    item.append(None)
-                    item.append(sell_info[0])
-                    fdatas.insert(order_no_indexes[i + 1][1], (0, None, item))
-                    break
+    # 涓嶆坊鍔犱富鍔ㄥ崠鏁版嵁
+    # if sell_nos:
+    #     for sell_info in sell_nos:
+    #         if sell_info[1] * sell_info[2] < 50 * 10000:
+    #             continue
+    #         for i in range(len(order_no_indexes) - 1):
+    #             if order_no_indexes[i][0] < sell_info[0] < order_no_indexes[i + 1][0]:
+    #                 item = []
+    #                 item.append(order_no_indexes[i + 1][1])
+    #                 item.append(l2_huaxin_util.convert_time(sell_info[3][0], with_ms=True))
+    #                 item.append("")
+    #                 item.append(
+    #                     "{}涓�".format(round(sell_info[1] * sell_info[2] / 10000, 1)))
+    #                 item.append(sell_info[2])
+    #                 item.append(sell_info[1] // 100)
+    #                 item.append("涓诲姩鍗�")
+    #                 item.append(1)
+    #                 item.append(l2_huaxin_util.convert_time(sell_info[4][0], with_ms=True))
+    #                 item.append(None)
+    #                 item.append(sell_info[0])
+    #                 fdatas.insert(order_no_indexes[i + 1][1], (0, None, item))
+    #                 break
 
     return fdatas
 

--
Gitblit v1.8.0