From 3da5d1ef00cf7665c2d37f837e6845c92d22e31c Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 15 十二月 2023 16:02:08 +0800 Subject: [PATCH] 前日炸板策略修改 --- code_attribute/code_nature_analyse.py | 19 ++++++++++++++++--- test/test_code_attribute.py | 5 ++--- l2/l2_data_manager_new.py | 6 ++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/code_attribute/code_nature_analyse.py b/code_attribute/code_nature_analyse.py index 47081b6..bb9951f 100644 --- a/code_attribute/code_nature_analyse.py +++ b/code_attribute/code_nature_analyse.py @@ -198,7 +198,7 @@ # 鑾峰彇K绾垮舰鎬� -# 杩斿洖 (15涓氦鏄撴棩娑ㄥ箙鏄惁澶т簬24.9%,鏄惁鐮村墠楂橈紝鏄惁瓒呰穼锛屾槸鍚︽帴杩戝墠楂橈紝鏄惁N,鏄惁V,鏄惁鏈夊舰鎬�,澶╅噺澶ч槼淇℃伅,鏄惁鍏锋湁杈ㄨ瘑搴�) +# 杩斿洖 (15涓氦鏄撴棩娑ㄥ箙鏄惁澶т簬24.9%,鏄惁鐮村墠楂橈紝鏄惁瓒呰穼锛屾槸鍚︽帴杩戝墠楂橈紝鏄惁N,鏄惁V,鏄惁鏈夊舰鎬�,澶╅噺澶ч槼淇℃伅,鏄惁鍏锋湁杈ㄨ瘑搴�,杩�2澶╂湁10澶╁唴鏈�澶ч噺,涓婁釜浜ゆ槗鏃ユ槸鍚︾偢鏉�) def get_k_format(limit_up_price, record_datas): p1_data = get_lowest_price_rate(record_datas) p1 = p1_data[0] >= 0.249, p1_data[1] @@ -218,13 +218,14 @@ # 鏄惁鍏锋湁杈ㄨ瘑搴� p9 = is_special(record_datas) p10 = is_latest_10d_max_volume_at_latest_2d(record_datas) + p11 = __is_yesterday_open_limit_up(record_datas) - return p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 + return p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 # 鏄惁鍏锋湁K绾垮舰鎬� def is_has_k_format(limit_up_price, record_datas): - is_too_high, is_new_top, is_lowest, is_near_new_top, is_n, is_v, has_format, volume_info, is_special, has_max_volume = get_k_format( + is_too_high, is_new_top, is_lowest, is_near_new_top, is_n, is_v, has_format, volume_info, is_special, has_max_volume, open_limit_up = get_k_format( float(limit_up_price), record_datas) if not has_format: return False, "涓嶆弧瓒矺绾垮舰鎬�" @@ -469,6 +470,18 @@ return False, '' +# 鏄ㄥぉ鏄惁鐐告澘 +def __is_yesterday_open_limit_up(datas): + datas = copy.deepcopy(datas) + datas.sort(key=lambda x: x["bob"]) + item = datas[-1] + limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"])) + if abs(limit_up_price - item["high"]) < 0.001 and abs(limit_up_price - item["close"]) > 0.001: + # 鐐告澘 + return True + return False + + # V瀛楀舰 def __is_v_model(datas): datas = copy.deepcopy(datas) diff --git a/l2/l2_data_manager_new.py b/l2/l2_data_manager_new.py index 174ced4..3bce2ae 100644 --- a/l2/l2_data_manager_new.py +++ b/l2/l2_data_manager_new.py @@ -976,6 +976,12 @@ k_format = code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code) now_timestamp = int(tool.get_now_time_str().replace(":", "")) + + # 鍓嶄竴澶╃偢鏉夸箣鍚庯紝浠婃棩10:00涔嬪墠鎵嶈兘涓嬪崟 + if k_format and len(k_format) >= 11 and k_format[10]: + if now_timestamp > int("100000"): + return False, True, f"涓婁釜浜ゆ槗鏃ョ偢鏉�,褰撴棩閲�10鐐逛互鍚庝笉涓嬪崟" + if can_buy_result[3] and now_timestamp <= int("094000"): # 寮哄娍涓荤嚎涓庡己鍔�10鍒嗛挓涓嶇湅閲� pass diff --git a/test/test_code_attribute.py b/test/test_code_attribute.py index 6dc5160..c3e02ed 100644 --- a/test/test_code_attribute.py +++ b/test/test_code_attribute.py @@ -10,15 +10,14 @@ if __name__ == "__main__": - code_str = "600148" + code_str = "600748" codes = code_str.split(",") for code in codes: if not tool.is_shsz_code(code): continue try: datas = init_data_util.get_volumns_by_code(code, 120) - datas = datas[0:] - result = is_too_high(datas) + result = code_nature_analyse.__is_yesterday_open_limit_up(datas) if result: print(code, result) except: -- Gitblit v1.8.0