From cf89766b43b7e5601220e5144edab8ee9307a8ad Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 26 三月 2025 17:29:03 +0800 Subject: [PATCH] 新题材拉黑机制修改 --- code_attribute/code_nature_analyse.py | 37 +++++++++++++++++++++++++++++-------- 1 files changed, 29 insertions(+), 8 deletions(-) diff --git a/code_attribute/code_nature_analyse.py b/code_attribute/code_nature_analyse.py index 0984759..e259959 100644 --- a/code_attribute/code_nature_analyse.py +++ b/code_attribute/code_nature_analyse.py @@ -9,7 +9,7 @@ from code_attribute import gpcode_manager # 浠g爜鑲℃�ц褰曠鐞� -from db import redis_manager +from db import redis_manager_delegate as redis_manager from utils import tool from db.redis_manager_delegate import RedisUtils from utils.tool import CodeDataCacheUtil @@ -220,8 +220,8 @@ p11 = __is_latest_open_limit_up(code, record_datas, 5) # 90澶╁唴鏄惁鏈夋定鍋� p12 = __has_limit_up(code, record_datas, 90) - # 鏈�杩�5澶╂槸鍚﹁穼鍋� - p13 = __is_latest_limit_down(code, record_datas, 5) + # 涓婁釜浜ゆ槗鏃ユ槸鍚﹁穼骞呰繃澶� + p13 = __is_pre_day_limit_rate_too_low(code, record_datas) # 60涓氦鏄撴棩鏄惁鏇炬定鍋� p14 = __has_limited_up(code, record_datas, 60) # 鏄ㄦ棩鏄惁娑ㄥ仠杩� @@ -404,7 +404,8 @@ # if max_price > float(limit_up_price): # return False rate = (float(limit_up_price) - min_price_info[1]["close"]) / min_price_info[1]["close"] - if rate >= 0.319: + THRESHOLD_RATE = 0.319*2 if tool.is_ge_code(code) else 0.319 + if rate >= THRESHOLD_RATE: return True, rate return False, rate @@ -471,7 +472,7 @@ def __is_new_top(code, limit_up_price, datas): datas = copy.deepcopy(datas) datas.sort(key=lambda x: x["bob"]) - datas = datas[-80:] + datas = datas[-60:] max_price = 0 for data in datas: if max_price < data["high"]: @@ -574,6 +575,26 @@ limit_down_price = float(gpcode_manager.get_limit_down_price_by_preprice(code, item["pre_close"])) if abs(limit_down_price - item["close"]) < 0.001: # 璺屽仠 + return True + return False + + +def __is_pre_day_limit_rate_too_low(code, datas): + """ + 涓婁釜浜ゆ槗鏃ユ槸鍚﹁穼骞呰繃澶� + @param code: + @param datas: + @return: + """ + datas = copy.deepcopy(datas) + datas.sort(key=lambda x: x["bob"]) + items = datas[-1:] + for item in items: + # 鏄惁鏈夎穼鍋� + # 鑾峰彇褰撴棩娑ㄥ箙 + rate = (item["close"] - item["pre_close"])/item["pre_close"] + threshold_rate_ = round(0 - ((1 - tool.get_limit_down_rate(code))*0.9), 2) + if rate < threshold_rate_: return True return False @@ -738,6 +759,6 @@ if __name__ == "__main__": - HighIncreaseCodeManager().add_code("000333") - print(HighIncreaseCodeManager().is_in("000333")) - print(HighIncreaseCodeManager().is_in("000222")) + code = "000333" + threshold_rate = 0 - ((1 - tool.get_limit_down_rate(code)) * 0.9) + print(threshold_rate) -- Gitblit v1.8.0