From 418e54d6c6a4b3b4aaab9ef545cdcd458640a7f5 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 31 七月 2025 14:36:03 +0800 Subject: [PATCH] 添加除权接口 --- code_attribute/gpcode_manager.py | 39 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 36 insertions(+), 3 deletions(-) diff --git a/code_attribute/gpcode_manager.py b/code_attribute/gpcode_manager.py index 9ab6e76..1f20dcd 100644 --- a/code_attribute/gpcode_manager.py +++ b/code_attribute/gpcode_manager.py @@ -8,7 +8,7 @@ from db import redis_manager_delegate as redis_manager from db.mysql_data_delegate import Mysqldb from db.redis_manager_delegate import RedisUtils -from log_module import log_export +from log_module import log_export, async_log_util from log_module.log import logger_pre_close_price, logger_debug from trade import trade_record_log_util from utils import tool @@ -401,6 +401,7 @@ class WhiteListCodeManager: __instance = None __redis_manager = redis_manager.RedisManager(2) + __human_remove_codes = set() def __new__(cls, *args, **kwargs): if not cls.__instance: @@ -421,14 +422,21 @@ if data: self.__white_codes_cache |= data - def add_code(self, code): + def add_code(self, code, is_human=False): + + if not is_human and code in self.__human_remove_codes: + # 鏈哄櫒鍔犵櫧锛屼笖琚汉涓虹Щ鐧戒簡灏变笉鑳藉啀鍔犵櫧 + return + self.__white_codes_cache.add(code) RedisUtils.sadd(self.__get_redis(), "white_list_codes", code) RedisUtils.expire(self.__get_redis(), "white_list_codes", tool.get_expire()) - def remove_code(self, code): + def remove_code(self, code, is_human=False): self.__white_codes_cache.discard(code) RedisUtils.srem(self.__get_redis(), "white_list_codes", code) + if is_human: + self.human_remove(code) def is_in(self, code): return RedisUtils.sismember(self.__get_redis(), "white_list_codes", code) @@ -445,6 +453,24 @@ def clear(self): self.__white_codes_cache.clear() RedisUtils.delete(self.__get_redis(), "white_list_codes") + + def human_remove(self, code): + """ + 浜轰负绉荤櫧 + @param code: + @return: + """ + self.__human_remove_codes.add(code) + + def clear_huamn_info(self, code): + """ + 绉婚櫎浜轰负骞查淇℃伅 + @param code: + @return: + """ + if code in self.__human_remove_codes: + self.__human_remove_codes.discard(code) + class BlackListCodeManager: @@ -768,6 +794,9 @@ # 璁剧疆鏀剁洏浠� @classmethod def set_price_pre(cls, code, price, force=False): + if float(price) > 1000: + async_log_util.info(logger_debug, f"鑾峰彇鏄ㄦ棩鏀剁洏浠峰紓甯革細{code}-{price}") + return if code in cls.__price_pre_cache and not force: return price = round(float(price), 2) @@ -790,6 +819,10 @@ __limit_up_price_dict[code] = limit_up_price return limit_up_price +def clear_limit_up_price_cache(code): + if code in __limit_up_price_dict: + __limit_up_price_dict.pop(code) + def get_limit_up_price_as_num(code): limit_up_price = get_limit_up_price(code) -- Gitblit v1.8.0