From 8ef576b9a1809dd52dacaafe960db456b09e9e0b Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 30 三月 2023 18:24:21 +0800 Subject: [PATCH] 看盘界面调整 --- code_nature_analyse.py | 27 +++++++++++++++++++++++---- 1 files changed, 23 insertions(+), 4 deletions(-) diff --git a/code_nature_analyse.py b/code_nature_analyse.py index a0fb430..01b405b 100644 --- a/code_nature_analyse.py +++ b/code_nature_analyse.py @@ -63,6 +63,7 @@ p4 = __is_near_new_top(limit_up_price, record_datas) p5 = __is_n_model(record_datas) p6 = __is_v_model(record_datas) + p8 = __get_big_volumn_info(record_datas) # # N瀛楀瀷鍖呭惈浜哊瀛楀瀷 # if p5: @@ -70,15 +71,18 @@ p7 = (p1[0] or p2[0] or p3[0] or p4[0] or p5[0] or p6[0], '') - return p1, p2, p3, p4, p5, p6, p7 + return p1, p2, p3, p4, p5, p6, p7, p8 # 鏄惁鍏锋湁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 = get_k_format(float(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 = get_k_format( + float(limit_up_price), + record_datas) if not has_format: return False, "涓嶆弧瓒矺绾垮舰鎬�" return True, "鏈夊舰鎬�" + # 鑾峰彇鑲℃�� # 杩斿洖锛堟槸鍚︽定鍋滐紝棣栨澘婧环鐜囨槸鍚﹀ぇ浜�0.6锛� @@ -200,8 +204,8 @@ item = datas[i] print(item) limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"])) - if abs(limit_up_price - item["close"]) < 0.001 and abs( - limit_up_price - datas[i - 1]["close"]) >= 0.001: + if abs(limit_up_price - item["high"]) < 0.001 and abs( + limit_up_price - datas[i - 1]["high"]) >= 0.001: # 娑ㄥ仠锛屽墠涓�澶╅潪娑ㄥ仠 max_price = item["close"] elif max_price > 0: @@ -236,6 +240,21 @@ return False, '' +# 鏄惁澶╅噺澶ч槼 +def __get_big_volumn_info(datas): + datas = copy.deepcopy(datas) + datas.sort(key=lambda x: x["bob"]) + datas = datas[-30:] + max_volume = 0 + total_volume = 0 + for data in datas: + if max_volume < data["volume"]: + max_volume = data["volume"] + total_volume += data["volume"] + average_volume = total_volume // len(datas) + return max_volume, average_volume + + # 棣栨澘娑ㄥ仠婧环鐜� def get_limit_up_premium_rate(datas): datas = copy.deepcopy(datas) -- Gitblit v1.8.0