From 87103d9325be0601b6f33eab737fc541b56e9577 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 27 三月 2024 12:32:36 +0800 Subject: [PATCH] bug修复 --- l2/l2_transaction_data_manager.py | 37 +++++++++++++++++++++++++++---------- 1 files changed, 27 insertions(+), 10 deletions(-) diff --git a/l2/l2_transaction_data_manager.py b/l2/l2_transaction_data_manager.py index ca22a67..3540edb 100644 --- a/l2/l2_transaction_data_manager.py +++ b/l2/l2_transaction_data_manager.py @@ -95,6 +95,9 @@ # 澶у崠鍗曠殑鍗栧崟鍙�->鍗栧崟淇℃伅鏄犲皠 __big_sell_order_info_dict = {} + # 澶у崟鍒楄〃 + __big_sell_order_info_list_dict = {} + # 鏈�杩戠殑鍗栧崟, 鏍煎紡{code:[鍗栧崟鍙�,鎬绘墜鏁�,浠锋牸,锛�'寮�濮嬫椂闂�',涔板崟鍙凤級,锛�'缁撴潫鏃堕棿',涔板崟鍙凤級]} __latest_sell_order_dict = {} @@ -110,6 +113,10 @@ cls.__big_sell_order_ids_dict[code] = set() if code not in cls.__big_sell_order_info_dict: cls.__big_sell_order_info_dict[code] = {} + + if code not in cls.__big_sell_order_info_list_dict: + cls.__big_sell_order_info_list_dict[code] = [] + for d in datas: cls.__latest_sell_order_info_list_dict[code].append(d) if code not in cls.__latest_sell_order_dict: @@ -129,13 +136,14 @@ l2_log.info(code, hx_logger_l2_transaction_sell_order, f"{cls.__latest_sell_order_dict[code]}") cls.__big_sell_order_ids_dict[code].add(info[0]) cls.__big_sell_order_info_dict[code][info[0]] = info + cls.__big_sell_order_info_list_dict[code].append(info) cls.__latest_sell_order_dict[code] = [d[7], d[2], d[1], (d[3], d[6]), (d[3], d[6])] latest_time = l2_huaxin_util.convert_time(datas[-1][3], with_ms=True) min_time = tool.trade_time_add_millionsecond(latest_time, -1000) min_time_int = int(min_time.replace(":", "").replace(".", "")) # 璁$畻鏈�杩�1s鐨勫ぇ鍗曟垚浜� - total_datas = cls.__latest_sell_order_info_list_dict.get(code) + total_big_sell_datas = cls.__big_sell_order_info_list_dict.get(code) start_index = 0 total_sell_info = [0, None] # 鎬昏祫閲�,寮�濮嬫垚浜や俊鎭�,缁撴潫鎴愪氦淇℃伅 @@ -144,16 +152,18 @@ # print("澶у崠鍗�", big_sell_order_ids) big_sell_orders = [] temp_sell_order_ids = set() - for i in range(len(datas) - 1, -1, -1): - d = datas[i] - if d[7] != latest_sell_order_info[0]: + # 缁熻宸茬粡缁撶畻鍑虹殑澶у崟 + print(f"鎬诲ぇ鍗曟暟閲忥細{len(total_big_sell_datas)}") + for i in range(len(total_big_sell_datas) - 1, -1, -1): + bd = total_big_sell_datas[i] + if bd[0] != latest_sell_order_info[0]: # 涓嶆槸鏈�杩戠殑鎴愪氦涓斾笉鏄ぇ鍗曠洿鎺ヨ繃婊� - if d[7] not in big_sell_order_ids: + if bd[0] not in big_sell_order_ids: continue else: - if d[7] not in temp_sell_order_ids: - big_sell_orders.append(cls.__big_sell_order_info_dict[code].get(d[7])) - temp_sell_order_ids.add(d[7]) + if bd[0] not in temp_sell_order_ids: + big_sell_orders.append(cls.__big_sell_order_info_dict[code].get(bd[0])) + temp_sell_order_ids.add(bd[0]) else: # 鏄渶杩戠殑浣嗕笉鏄ぇ鍗曢渶瑕佽繃婊� if latest_sell_order_info[1] * latest_sell_order_info[2] < 500000: @@ -163,11 +173,18 @@ big_sell_orders.append(latest_sell_order_info) temp_sell_order_ids.add(latest_sell_order_info[0]) - if min_time_int > int(l2_huaxin_util.convert_time(d[3], with_ms=True).replace(":", "").replace(".", "")): + if min_time_int > int( + l2_huaxin_util.convert_time(bd[3][0], with_ms=True).replace(":", "").replace(".", "")): start_index = i break # 缁熻鏈�杩�1s鐨勫ぇ鍗栧崟鏁版嵁 - total_sell_info[0] += int(d[1] * d[2]) + total_sell_info[0] += int(bd[1] * bd[2]) + # 缁熻鏈�杩戠殑澶у崟 + if latest_sell_order_info[1] * latest_sell_order_info[2] >= 500000: + if latest_sell_order_info[0] not in temp_sell_order_ids: + big_sell_orders.append(latest_sell_order_info) + temp_sell_order_ids.add(latest_sell_order_info[0]) + big_sell_orders.reverse() total_sell_info[1] = big_sell_orders cls.__latest_sell_order_info_list_dict[code] = cls.__latest_sell_order_info_list_dict[code][start_index:] -- Gitblit v1.8.0