From aacc6148dd43a9cffbff9a23a273a55b64bf3d8c Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期六, 12 十月 2024 17:21:42 +0800 Subject: [PATCH] bug修复 --- l2/l2_transaction_data_manager.py | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/l2/l2_transaction_data_manager.py b/l2/l2_transaction_data_manager.py index ae0223b..3a84c7e 100644 --- a/l2/l2_transaction_data_manager.py +++ b/l2/l2_transaction_data_manager.py @@ -45,12 +45,11 @@ for code in sell_order_map: cls.__total_sell_datas_dict[code] = sell_order_map[code] - def add_buy_datas(self, code, datas): """ 娣诲姞澶т拱鍗曟暟鎹� @param code: 浠g爜 - @param datas:[(涔板崟鍙�,鎬昏偂鏁�,鎬绘垚浜ら)] + @param datas:[(涔板崟鍙�,鎬昏偂鏁�,鎬绘垚浜ら,鎴愪氦寮�濮嬫椂闂�,鎴愪氦缁撴潫鏃堕棿)] @return: """ if not datas: @@ -104,6 +103,14 @@ if code not in self.__total_buy_datas_dict: return [] return [x[2] for x in self.__total_buy_datas_dict[code]] + + def get_total_buy_data_list(self, code): + """ + 鑾峰彇鎵�鏈夌殑涔板崟鏁版嵁鍒楄〃 + @param code: + @return:[(涔板崟鍙�,鎬昏偂鏁�,鎬绘垚浜ら,鎴愪氦寮�濮嬫椂闂�,鎴愪氦缁撴潫鏃堕棿)] + """ + return self.__total_buy_datas_dict.get(code) def get_total_sell_money(self, code): """ @@ -301,11 +308,11 @@ # 缁熻鎵�鏈夌殑鎴愪氦閲� __deal_volume_list_dict = {} - # 缁熻涓诲姩涔扮殑鎴愪氦閲� + # 缁熻娑ㄥ仠涓诲姩涔扮殑鎴愪氦閲� __deal_active_buy_volume_list_dict = {} @classmethod - def statistic_total_deal_volume(cls, code, datas): + def statistic_total_deal_volume(cls, code, datas, limit_up_price): # 鍙粺璁¤鍔ㄤ拱 if code not in cls.__deal_volume_list_dict: cls.__deal_volume_list_dict[code] = [] @@ -342,7 +349,9 @@ # 鍙粺璁′富鍔ㄤ拱 if d[7] > d[6]: continue - time_str = '' + # 鍙粺璁℃定鍋滀拱 + if d[1] != limit_up_price: + continue if d[3] in time_dict: time_str = time_dict[d[3]] else: @@ -409,10 +418,11 @@ deal_list = cls.__deal_active_buy_volume_list_dict.get(code) if not deal_list: return [] - fdatas = [deal_list[-1]] + latest_time = deal_list[-1][0] + fdatas = [] # 浠庡�掓暟绗簩涓暟鎹绠� for i in range(len(deal_list) - 1, -1, -1): - if tool.trade_time_sub(fdatas[0][0], deal_list[i][0]) < 6: + if tool.trade_time_sub(latest_time, deal_list[i][0]) < 6: fdatas.append(deal_list[i]) return fdatas @@ -555,6 +565,7 @@ total_sell_info[1] = big_sell_orders # ----------------缁熻娑ㄥ仠涓诲姩涔�----------------- try: + limit_up_active_buy_datas = [] for d in datas: if is_active_sell(d[7], d[6]): # 琚姩涔� @@ -562,8 +573,8 @@ # 鏄惁鏄定鍋� if d[1] == limit_up_price: # 鏈夋定鍋滀富鍔ㄤ拱 - L2TradeSingleDataManager.set_limit_up_active_buy(code, datas[-1][3]) - break + limit_up_active_buy_datas.append(d) + L2TradeSingleDataManager.set_limit_up_active_buy(code, limit_up_active_buy_datas) except: pass -- Gitblit v1.8.0