From c62187f349fdb90fc3f525522a512af5a0a83a54 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期三, 28 五月 2025 15:17:10 +0800
Subject: [PATCH] 大单解析修改

---
 data_parser/transaction_big_order_parser.py |   40 +++++++++++++++++++++-------------------
 1 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/data_parser/transaction_big_order_parser.py b/data_parser/transaction_big_order_parser.py
index 31f3eb9..4a68883 100644
--- a/data_parser/transaction_big_order_parser.py
+++ b/data_parser/transaction_big_order_parser.py
@@ -194,7 +194,21 @@
     ))
 
 
-def extract_big_order_of_code(dir_path, code=None):
+__combined_df_cache = {}
+
+
+def extract_big_order_of_all(dir_path):
+    combined_path = os.path.join(dir_path, 'combined.csv')
+    if not os.path.exists(combined_path):
+        print("鎷兼帴鏁版嵁涓嶅瓨鍦�")
+        return
+    codes = extract_big_order_codes(dir_path)
+    print("鎬讳唬鐮佹暟閲忥細", len(codes))
+    for code in codes:
+        extract_big_order_of_code(dir_path, code)
+
+
+def extract_big_order_of_code(dir_path, code):
     """
     鎻愬彇浠g爜鐨勫ぇ鍗�
     @param dir_path: 鏁版嵁鐩綍
@@ -223,16 +237,14 @@
     if not os.path.exists(combined_path):
         print("鎷兼帴鏁版嵁涓嶅瓨鍦�")
         return
-
-    if code:
-        output_path = os.path.join(dir_path, f"big_buy_{code}.csv")
-    else:
-        output_path = os.path.join(dir_path, f"big_buy.csv")
-
+    output_path = os.path.join(dir_path, f"big_buy_{code}.csv")
     if os.path.exists(output_path):
-        print("璺緞宸插瓨鍦�")
+        print("璺緞宸插瓨鍦�:", output_path)
         return
-    df = pd.read_csv(combined_path)
+    df = __combined_df_cache.get(combined_path, None)
+    if df is None:
+        df = pd.read_csv(combined_path)
+        __combined_df_cache[combined_path] = df
     df_copy = df.copy()
     if code:
         df_copy = df_copy[df_copy["SecurityID"] == int(code)]
@@ -257,16 +269,6 @@
     @param code:
     @return:
     """
-
-    def first_last(group):
-        """
-            鑾峰彇绗竴鏉℃暟鎹笌鏈�鍚庝竴鏉�
-            @param group:
-            @return:
-            """
-        return pd.Series({
-        })
-
     combined_path = os.path.join(dir_path, 'combined.csv')
     if not os.path.exists(combined_path):
         print("鎷兼帴鏁版嵁涓嶅瓨鍦�")

--
Gitblit v1.8.0