From f11cde17628781e516371cc039e98fa884b808e2 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 03 一月 2025 18:07:49 +0800 Subject: [PATCH] 新版真实下单位寻找 --- third_data/kpl_data_constant.py | 49 +++++++++++++++++++++++++++++-------------------- 1 files changed, 29 insertions(+), 20 deletions(-) diff --git a/third_data/kpl_data_constant.py b/third_data/kpl_data_constant.py index c9fe021..e42055b 100644 --- a/third_data/kpl_data_constant.py +++ b/third_data/kpl_data_constant.py @@ -101,6 +101,7 @@ # 鍔犺浇涓烘壂鍏ヤ拱鍖归厤鐨勪唬鐮佹澘鍧� kpl_results = KPLLimitUpDataUtil.get_latest_block_infos(min_day=tool.date_sub(cls.__day, 365), max_day=cls.__day) + # {"浠g爜":[(鏉垮潡, 鏃ユ湡), (鏉垮潡, 鏃ユ湡)]} kpl_block_dict = {} for r in kpl_results: # 褰撴棩鐐告澘鐨勪笉璁$畻鍘熷洜 @@ -109,25 +110,36 @@ code = r[0] if code not in kpl_block_dict: kpl_block_dict[code] = [] - kpl_block_dict[code].append((r[2], r[1])) # (鏉垮潡, 鏃堕棿) + kpl_block_dict[code].append((r[2], r[1])) # (鏉垮潡, 鏃ユ湡) for code in kpl_block_dict: block_infos = kpl_block_dict.get(code) - block_infos.sort(key=lambda x: x[1], reverse=True) - temp_dict = {} # {"鏉垮潡":[鍑虹幇娆℃暟, 鏈�杩戝嚭鐜版椂闂碷} - for b in block_infos: - if b[0] not in temp_dict: - temp_dict[b[0]] = [0, b[1]] - temp_dict[b[0]][0] += 1 - temp_list = [(k, temp_dict[k][0], temp_dict[k][1]) for k in temp_dict] - # 鎸夌収娑ㄥ仠娆℃暟涓庢渶杩戞定鍋滄椂闂存帓搴� - temp_list.sort(key=lambda x: (x[1], x[2]), reverse=True) - cls.__radical_buy_reasons_origin_data_dict[code] = temp_list - blocks = {temp_list[0][0]} - if len(temp_list) > 1: - if temp_list[1][1] >= 2: - blocks.add(temp_list[1][0]) - blocks -= constant.KPL_INVALID_BLOCKS - cls.__radical_buy_reasons_dict[code] = blocks + cls.__radical_buy_reasons_dict[code] = cls.__compute_limit_up_reasons(code, block_infos) + + @classmethod + def __compute_limit_up_reasons(cls, code, block_infos): + """ + 璁$畻娑ㄥ仠鍘熷洜 + @param code: + @param block_infos: + @return: + """ + # [(鏉垮潡, 鏃ユ湡)] + block_infos.sort(key=lambda x: x[1], reverse=True) + # {"鏉垮潡":[(鍑虹幇娆℃暟, 鏈�杩戝嚭鐜版棩鏈�)]} + temp_dict = {} + for b in block_infos: + if b[0] not in temp_dict: + temp_dict[b[0]] = [0, b[1]] + temp_dict[b[0]][0] += 1 + temp_list = [(k, temp_dict[k][0], temp_dict[k][1]) for k in temp_dict] + # 鎸夌収娑ㄥ仠娆℃暟涓庢渶杩戞定鍋滄椂闂存帓搴� + temp_list.sort(key=lambda x: (x[1], x[2]), reverse=True) + cls.__radical_buy_reasons_origin_data_dict[code] = temp_list + blocks = {temp_list[0][0]} + # 鍙栨定鍋滄鏁版渶澶氱殑鍜屾渶杩戞定鍋滅殑 + blocks.add(block_infos[0][0]) + blocks -= constant.KPL_INVALID_BLOCKS + return blocks def get_limit_up_reasons(self, code): """ @@ -239,9 +251,6 @@ block_codes[b] = set() block_codes[b].add(code) cls.__current_limit_up_block_codes = block_codes - - - @classmethod def set_history_limit_up_datas(cls, history_limit_up_datas_): -- Gitblit v1.8.0