From 6de59d6e4274ce9ae1ffb154c622da7c1b7144b1 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 23 一月 2025 16:55:04 +0800 Subject: [PATCH] 融入每日新增板块/深圳买入逻辑修改 --- third_data/kpl_data_constant.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/third_data/kpl_data_constant.py b/third_data/kpl_data_constant.py index 8c27707..44efc44 100644 --- a/third_data/kpl_data_constant.py +++ b/third_data/kpl_data_constant.py @@ -2,6 +2,8 @@ import constant from db import redis_manager_delegate as redis_manager from db.redis_manager_delegate import RedisUtils +from log_module import async_log_util +from log_module.log import logger_debug from third_data import kpl_util from third_data.third_blocks_manager import BlockMapManager @@ -68,6 +70,12 @@ # 鍘熷鏁版嵁 __radical_buy_reasons_origin_data_dict = {} + # 鎵�鏈夌殑娑ㄥ仠鍘熷洜 + __all_limit_up_reasons = set() + + # 浠婃棩鐨勬柊姒傚康 + __new_blocks = set() + __instance = None __day = tool.get_now_date_str() @@ -83,6 +91,7 @@ limit_up_reasons_dict = {} limit_up_recommend_block_dict = {} for r in kpl_results: + cls.__all_limit_up_reasons.add(kpl_util.filter_block(r[2])) code = r[0] if code not in limit_up_reasons_dict: limit_up_reasons_dict[code] = [] @@ -190,6 +199,39 @@ return set(self.__radical_buy_reasons_dict.get(code)) return None + def add_new_blocks(self, code, block): + """ + 娣诲姞鏂伴鏉愮殑鏉垮潡 + @param code: + @param block: + @return: + """ + if block in constant.KPL_INVALID_BLOCKS: + return + old_blocks = self.__radical_buy_reasons_dict.get(code) + if old_blocks is None: + old_blocks = set() + if block in old_blocks: + return + self.__new_blocks.add(block) + old_blocks.add(block) + async_log_util.info(logger_debug, f"浠婃棩鏂板姒傚康锛歿code} - {block}") + self.__radical_buy_reasons_dict[code] = old_blocks + + def get_total_before_blocks(self): + """ + 鑾峰彇鎵�鏈変箣鍓嶇殑鏉垮潡 + @return: + """ + return self.__all_limit_up_reasons + + def get_new_blocks(self): + """ + 鑾峰彇鏂版蹇� + @return: + """ + return self.__new_blocks + class TodayLimitUpReasonChangeManager: """ -- Gitblit v1.8.0