From 1dea3d72da9d3d2d55f2e41b611913b0901d8074 Mon Sep 17 00:00:00 2001
From: admin <admin@example.com>
Date: 星期二, 17 六月 2025 19:15:19 +0800
Subject: [PATCH] 增加测试/记录精选流入板块

---
 strategy/plate_strength_analysis.py  |    6 ++----
 strategy/forbidden_plates_manager.py |   16 ++++++++--------
 strategy/buying_strategy.py          |    9 +++++----
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/strategy/buying_strategy.py b/strategy/buying_strategy.py
index bc6be39..08d6fe2 100644
--- a/strategy/buying_strategy.py
+++ b/strategy/buying_strategy.py
@@ -8,6 +8,8 @@
 # from datetime import time
 # from datetime import timedelta
 import time
+
+import constant
 import utils.tool
 from log_module import async_log_util
 from log_module.log import logger_kpl_jingxuan_in, logger_common
@@ -18,6 +20,7 @@
 from strategy import basic_methods
 from strategy import account_management
 from strategy import order_methods
+from strategy.forbidden_plates_manager import ForbiddenPlatesManager
 from strategy.order_methods import TodayBuyCodeManager
 
 from utils import tool, huaxin_util
@@ -218,10 +221,8 @@
                 #     print(f"娌℃湁鍦ㄦ蹇电紦瀛樺垪琛ㄤ腑鎵惧埌:{symbol_to_search}銆�")
 
                 # 澹版槑瑕佹鏌ヨ繃婊や笉鍙敤鐨勬蹇垫澘鍧楀悕绉板父閲�   銆愪唬琛ㄧ潃 鏄惁鏈夋棤姒傚康鍙婅窡闅忔蹇电殑鍙兘鎬�(鏈夋槑鏄句釜鑲$嫭鐗瑰闀跨壒鎬х殑涓嶅彲璺熼殢锛屽洜涓烘蹇垫湰韬槸瀹芥硾鐨勶紝璁稿涓嶅悓姒傚康鐨勪釜鑲¢兘鏈夎繖涓蹇�)銆�
-                check_plate_list = {'鏃�', 'ST鎽樺附', 'ST鏉垮潡', '瓒呰穼', '娆℃柊鑲�', '鍖椾氦鎵�', '绉戝垱鏉�',
-                                    '骞存姤澧為暱', '骞存姤棰勫', '骞惰喘閲嶇粍', '鑲℃潈杞', '閫佽浆濉潈', '楂橀�佽浆', '澹宠祫婧�',
-                                    '璧勪骇绠$悊', '涓剧墝',
-                                    '涓撶敤璁惧', '鍒涙姇'}
+                # check_plate_list = constant.check_plate_list | set(ForbiddenPlatesManager().list_plates())
+                check_plate_list = constant.check_plate_list
 
                 # 鏌ヨ褰撳墠涓偂鐨勪唬鐮佹槸鍚﹀湪鏉垮潡寮哄害涓偂鍒楄〃涓紙浣庡惛浼橀�夌洰鏍囷級
                 strength_list_have_it = False  # 鏄惁鏈夊己搴﹁祴鍒濆��
diff --git a/strategy/forbidden_plates_manager.py b/strategy/forbidden_plates_manager.py
index 920ee96..9c8de9c 100644
--- a/strategy/forbidden_plates_manager.py
+++ b/strategy/forbidden_plates_manager.py
@@ -1,6 +1,8 @@
 """
 榛戝悕鍗曟澘鍧楃鐞�
 """
+import json
+
 from db import redis_manager_delegate as redis_manager
 from db.redis_manager_delegate import RedisUtils
 from utils import tool
@@ -9,15 +11,15 @@
 @tool.singleton
 class ForbiddenPlatesManager:
     def __init__(self):
-        self.forbidden_plates = set()
+        self.forbidden_plates = []
         self.__db = 1
         self.__redisManager = redis_manager.RedisManager(self.__db)
         self.__load_forbidden_plates()
 
     def __load_forbidden_plates(self):
-        plates = RedisUtils.smembers(self.__redisManager.getRedis(), "forbidden_plates")
+        plates = RedisUtils.get(self.__redisManager.getRedis(), "forbidden_plate_list")
         if plates:
-            self.forbidden_plates = set(plates)
+            self.forbidden_plates = json.loads(plates)
 
     def add_plate(self, plate):
         """
@@ -27,9 +29,8 @@
         """
         if plate in self.forbidden_plates:
             return
-        self.forbidden_plates.add(plate)
-        RedisUtils.sadd_async(self.__db, "forbidden_plates", plate)
-        RedisUtils.expire_async(self.__db, "forbidden_plates", tool.get_expire())
+        self.forbidden_plates.append(plate)
+        RedisUtils.setex_async(self.__db, "forbidden_plate_list",tool.get_expire(), json.dumps( self.forbidden_plates))
 
     def remove_plate(self, plate):
         """
@@ -40,8 +41,7 @@
         if plate not in self.forbidden_plates:
             return
         self.forbidden_plates.remove(plate)
-        RedisUtils.srem_async(self.__db, "forbidden_plates", plate)
-        RedisUtils.expire_async(self.__db, "forbidden_plates", tool.get_expire())
+        RedisUtils.setex_async(self.__db, "forbidden_plate_list", tool.get_expire(), json.dumps(self.forbidden_plates))
 
     def list_plates(self):
         """
diff --git a/strategy/plate_strength_analysis.py b/strategy/plate_strength_analysis.py
index 7650689..ce2d05a 100644
--- a/strategy/plate_strength_analysis.py
+++ b/strategy/plate_strength_analysis.py
@@ -83,8 +83,7 @@
     if data_cache.OPENING_TIME < now_time < data_cache.AFTER_CLOSING_TIME:
         logger_kpl_market_sift_plate.info(f"{market_sift_plate['list']}")
     # 鎬绘帶鍒舵椂闂存
-    # TODO 娴嬭瘯
-    if not (data_cache.OPENING_TIME < now_time < data_cache.NOON_MARKET_TIME) and False:
+    if not (data_cache.OPENING_TIME < now_time < data_cache.NOON_MARKET_TIME):
         return
     # ['801235', '鍖栧伐', 6996, 0.027, 2.43, 117836347690, -122548038, 8105997595, -8228545633, 0.92, 8595377775454, 0.09, 332297449, 9954902621130, -192457252, 24.0487, 17.1809, 6996, 0.027]
     # market_sift_plate['list'][0] = ['801062', '鍐涘伐', 3520, -0.49, 0.666, 139133934669, 383864272, 9077352839, -8693488567, 1.183, 6129448037490,-0.12, 168245858, 7088854452019, -290614763, 50.2408, 30.3672, 3520, 0]
@@ -122,8 +121,7 @@
             # print(f"kpl_limit_up_process寮�濮嬩簡{now}")
             start_time = time.time()
             now_time = tool.get_now_time_str()
-            # TODO 娴嬭瘯
-            if data_cache.L1_DATA_START_TIME < now_time < data_cache.CLOSING_TIME or True:
+            if data_cache.L1_DATA_START_TIME < now_time < data_cache.CLOSING_TIME:
                 its_stock_power = get_market_sift_plate_its_stock_power()
                 time_str = datetime.datetime.now().strftime("%H%M%S")
                 if 92900 < int(time_str) < 95000:

--
Gitblit v1.8.0