Administrator
2025-08-19 89e49e197ec232fc6ae99c22b8ffb2be64108ee4
code_attribute/today_max_price_manager.py
@@ -8,7 +8,7 @@
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 log_module.log import logger_debug, logger_limit_up_record
from utils import global_util, tool
@@ -66,7 +66,7 @@
        tool.CodeDataCacheUtil.set_cache(self.__max_price_info_cache, code, price_info)
        RedisUtils.setex_async(
            self.__db, "max_price_info-{}".format(code), tool.get_expire(), json.dumps(price_info))
        async_log_util.info(logger_debug, f"最大现价:{code}-{price_info}")
        # async_log_util.info(logger_debug, f"最大现价:{code}-{price_info}")
        if self.__is_limit_up(code, price, sell1_info):
            if code not in self.__limit_up_latest_info_cache:
                self.__limit_up_latest_info_cache[code] = time
@@ -74,8 +74,10 @@
            if code not in self.__limit_up_records_cache:
                self.__limit_up_records_cache[code] = []
            if code in self.__limit_up_latest_info_cache:
                self.__limit_up_records_cache[code].append((self.__limit_up_latest_info_cache.get(code), time))
                limit_up_info = (self.__limit_up_latest_info_cache.get(code), time)
                self.__limit_up_records_cache[code].append(limit_up_info)
                self.__limit_up_latest_info_cache.pop(code)
                async_log_util.info(logger_limit_up_record, f"{code}-{limit_up_info}")
    def get_max_limit_up_time(self, code):
        """
@@ -87,14 +89,14 @@
            max_space_time = 0
            if code in self.__limit_up_latest_info_cache:
                max_space_time = tool.trade_time_sub(tool.get_now_time_str(), self.__limit_up_latest_info_cache[code])
            if code in self.__limit_up_records_cache:
            if self.__limit_up_records_cache.get(code):
                max_item = max(self.__limit_up_records_cache[code], key=lambda x: tool.trade_time_sub(x[1], x[0]))
                max_space_time_his = tool.trade_time_sub(max_item[1], max_item[0])
                if max_space_time_his > max_space_time:
                    max_space_time = max_space_time_his
            return max_space_time
        except Exception as e:
            async_log_util.error(logger_debug, f"获取最大涨停时间出错:{str(e)}")
            async_log_util.error(logger_debug, f"获取最大涨停时间出错:{code}-{str(e)}")
        return 0
    def get_price_info_cache(self, code):