From 8ef576b9a1809dd52dacaafe960db456b09e9e0b Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 30 三月 2023 18:24:21 +0800 Subject: [PATCH] 看盘界面调整 --- trade/first_code_score_manager.py | 70 ++++++++++++++++++++++------------ 1 files changed, 45 insertions(+), 25 deletions(-) diff --git a/trade/first_code_score_manager.py b/trade/first_code_score_manager.py index 8629ad8..1b25f63 100644 --- a/trade/first_code_score_manager.py +++ b/trade/first_code_score_manager.py @@ -5,12 +5,13 @@ # bidding 鏄惁婊¤冻绔炰环 # deal_big_money 鎴愪氦澶ч噾棰濇槸鍚︽弧瓒� # code_nature = (鏄惁鏈夋定鍋滐紝鏄惁鏈夋孩浠�) -# hot_block(鏉垮潡涓定鍋滅エ涓暟锛堝寘鍚嚜宸憋級锛屾澘鍧楃偢鏉跨エ涓暟, 鏂版澘鍧楀悕绉�) +# hot_block(鏉垮潡涓定鍋滅エ涓暟锛堝寘鍚嚜宸憋級锛屾澘鍧楃偢鏉跨エ涓暟, 鏂版澘鍧楀悕绉� , 楂樹綅鏉夸俊鎭�) # zyltgb鑷敱娴侀�氬競鍊兼槸鍚﹀ぇ浜�250浜� # limit_price 娑ㄥ仠浠锋槸鍚﹀ぇ浜�100鍧� # limit_up_time 鏄惁10鐐逛箣鍓嶆定鍋� # k_form(15涓氦鏄撴棩鏄惁娑ㄥ箙24.9%,鏄惁鐮村墠楂橈紝鏄惁瓒呰穼锛屾槸鍚︽帴杩戝墠楂橈紝鏄惁N,鏄惁V,鏄惁鏈夊舰鎬�) import code_nature_analyse +import code_volumn_manager import global_data_loader import global_util import gpcode_manager @@ -20,11 +21,11 @@ def __get_score(zyltgb, limit_price, bidding, k_form, code_nature, hot_block, volume_rate, limit_up_time, - deal_big_money): + deal_big_money_rate): score_list = [] if zyltgb: zyltgbs = [0, 10, 31, 51, 101, 150, 250, 1000000] - zyltgb_score = [20, 30, 20, 10, -1000, -1000, -1000] + zyltgb_score = [15, 25, 15, 5, -5, -55, -1000] for i in range(1, len(zyltgbs)): if zyltgbs[i - 1] <= zyltgb / 100000000 < zyltgbs[i]: score_list.append(zyltgb_score[i - 1]) @@ -62,7 +63,7 @@ # 鏄惁鎺ヨ繎鍓嶉珮 if k_form[3]: - k_score.append(-35) + k_score.append(-10) else: k_score.append(0) # 鏄惁N @@ -80,7 +81,14 @@ if k_form[6]: k_score.append(0) else: - k_score.append(-35) + k_score.append(0) + + # 鏄惁澶╅噺澶ч槼 + if k_form[7] and not k_form[1]: + # 澶╅噺澶ч槼涓斾笉鏄獊鐮村墠楂� + k_score.append(30) + else: + k_score.append(0) score_list.append(k_score) @@ -102,13 +110,16 @@ hot_block_score = [] # 鏉垮潡涓彧鏈夎嚜宸辨定鍋滐紝涓旀棤鐐告澘 - if hot_block[1] == 1 and hot_block[2] == 0: - hot_block_score.append(20) - elif hot_block[1] >= 2 and hot_block[2] == 0: + if hot_block[1] >= 2 and hot_block[2] == 0: hot_block_score.append(30) elif hot_block[3] and not k_form[6]: # 鏈夋柊棰樻潗锛屼笖娌℃湁K绾垮舰鎬� hot_block_score.append(30) + elif hot_block[1] == 1 and hot_block[2] == 0: + hot_block_score.append(20) + elif hot_block[4] is not None and not k_form[6]: + # 鏈夐珮浣嶆澘涓旀棤K绾垮舰鎬� + hot_block_score.append(20) else: hot_block_score.append(0) score_list.append(hot_block_score) @@ -135,11 +146,12 @@ else: score_list.append(0) - # 澶у崟鎴愪氦 - if deal_big_money: - score_list.append(35) - else: - score_list.append(0) + # 澶у崟鎴愪氦 + deal_big_money_rates = [0, 0.00001, 0.5, 1, 1.2, 1.5, 10000] + deal_big_money_scores = [0, -20, -10, 20, 30, 40] + for i in range(1, len(deal_big_money_rates)): + if deal_big_money_rate < deal_big_money_rates[i]: + score_list.append(deal_big_money_scores[i - 1]) score = 0 for s in score_list: @@ -175,7 +187,20 @@ k_form = code_nature_analyse.CodeNatureRecordManager.get_k_format(code) if k_form is None: - k_form = [(True, ''), (False, ''), (False, ''), (False, ''), (False, ''), (False, ''), (True, '')] + k_form = [(True, ''), (False, ''), (False, ''), (False, ''), (False, ''), (False, ''), (True, ''), (1, 1)] + today_volume = code_volumn_manager.get_today_volumn(code) + if today_volume: + today_volume = int(today_volume) + if k_form[7][0] < today_volume * 0.7 and k_form[7][1] < today_volume * 0.3: + # 鏈�澶ч噺灏忎簬浠婃棩閲忕殑70%锛屽钩鍧囬噺灏忎簬浠婃棩閲忕殑30% + k_form[7] = (True, f"鏈�澶ч噺锛歿k_form[7][0]} 鍧囬噺锛歿k_form[7][1]}") + else: + k_form[7] = (False, f"鏈�澶ч噺锛歿k_form[7][0]} 鍧囬噺锛歿k_form[7][1]}") + + if not k_form[6][0] and k_form[7][0]: + # 灏嗗ぉ閲忓ぇ闃宠瀺鍚堣繘鍘� + k_form[6] = (True, '') + source_datas.append(k_form) code_nature = code_nature_analyse.CodeNatureRecordManager.get_nature(code) @@ -183,10 +208,10 @@ hot_block = hot_block_data_process.get_info(code) if hot_block is None: - hot_block = ('鏃犳澘鍧�', 1, 0, None) + hot_block = ('鏃犳澘鍧�', 1, 0, None, None) else: # 鍔犱笂鑷繁 - hot_block = (hot_block[0], hot_block[1] + 1, hot_block[2], hot_block[3]) + hot_block = (hot_block[0], hot_block[1] + 1, hot_block[2], hot_block[3], hot_block[4]) source_datas.append(hot_block) @@ -198,18 +223,13 @@ deal_big_num = deal_big_money_manager.get_deal_big_money_num(code) m = l2_trade_factor.L2TradeFactorUtil.get_base_safe_val(zyltgb) source_datas.append((deal_big_num * limit_price * 100, m)) - - if deal_big_num * limit_price * 100 > m: - deal_big_num = True - else: - deal_big_num = False - + deal_big_num_rate = (deal_big_num * limit_price * 100) / m k_form_1 = [] - for d in k_form: - k_form_1.append(d[0]) + for i in range(0, len(k_form)): + k_form_1.append(k_form[i][0]) result = __get_score(zyltgb, limit_price > 100, bidding, k_form_1, code_nature, hot_block, - volume_rate, limit_up_time, deal_big_num) + volume_rate, limit_up_time, deal_big_num_rate) if with_source_data: return result, source_datas return result -- Gitblit v1.8.0