"""
|
首板代码评分管理
|
"""
|
|
# bidding 是否满足竞价
|
# deal_big_money 成交大金额是否满足
|
# code_nature = (是否有涨停,是否有溢价)
|
# hot_block(板块中涨停票个数(包含自己),板块炸板票个数)
|
# zyltgb自由流通市值是否大于250亿
|
# limit_price 涨停价是否大于100块
|
# limit_up_time 是否10点之前涨停
|
# k_form(15个交易日是否涨幅24.9%,是否破前高,是否超跌,是否接近前高,是否N,是否V)
|
import code_nature_analyse
|
import global_data_loader
|
import global_util
|
import gpcode_manager
|
import tool
|
from third_data import hot_block_data_process
|
from trade import l2_trade_factor, deal_big_money_manager, bidding_money_manager
|
|
|
def __get_score(zyltgb, limit_price, bidding, k_form, code_nature, hot_block, volume_rate, limit_up_time,
|
deal_big_money):
|
score = 0
|
score_list = []
|
# 开盘前竞价
|
if bidding:
|
score += 25
|
score_list.append(25)
|
else:
|
score_list.append(0)
|
# 大单成交
|
if deal_big_money:
|
score += 30
|
score_list.append(30)
|
else:
|
score_list.append(0)
|
# 量
|
volume_score = [0, 40, 50, 40, 30, 10, -150, -1000]
|
volume_rates = [0, 0.499, 0.649, 0.799, 0.949, 1.099, 1.249, 1.399]
|
for i in range(1, len(volume_rates)):
|
if volume_rates[i - 1] <= volume_rate < volume_rates[i]:
|
score += volume_score[i - 1]
|
score_list.append(volume_score[i - 1])
|
break
|
|
# 15个交易日是否涨幅24.9%
|
if k_form[0]:
|
score += -100
|
score_list.append(-100)
|
else:
|
score_list.append(0)
|
# 是否破前高
|
if k_form[1]:
|
score += 50
|
score_list.append(50)
|
else:
|
score_list.append(0)
|
# 是否超跌
|
if k_form[2]:
|
score += 40
|
score_list.append(40)
|
else:
|
score_list.append(0)
|
|
# 是否接近前高
|
if k_form[3]:
|
score += -50
|
score_list.append(-50)
|
else:
|
score_list.append(0)
|
# 是否N
|
if k_form[4]:
|
score += 35
|
score_list.append(35)
|
else:
|
score_list.append(0)
|
# 是否V
|
if k_form[5]:
|
score += 30
|
score_list.append(30)
|
else:
|
score_list.append(0)
|
|
if not code_nature[0]:
|
score += 5
|
score_list.append(5)
|
else:
|
score_list.append(0)
|
if code_nature[1]:
|
score += 20
|
score_list.append(20)
|
else:
|
score_list.append(0)
|
|
if hot_block[0] >= 2:
|
score += 40
|
score_list.append(40)
|
else:
|
score += 30
|
score_list.append(30)
|
if hot_block[1] > 0:
|
score += 10
|
score_list.append(10)
|
else:
|
score_list.append(0)
|
|
if zyltgb:
|
score += -80
|
score_list.append(-80)
|
else:
|
score_list.append(0)
|
|
if limit_price:
|
score += -1000
|
score_list.append(-1000)
|
else:
|
score_list.append(0)
|
|
if limit_up_time:
|
score += 20
|
score_list.append(20)
|
else:
|
score_list.append(0)
|
|
return score, score_list
|
|
|
def get_score(code, volume_rate, limit_up_time):
|
bidding_money = bidding_money_manager.get_bidding_money(code)
|
bidding = False
|
if bidding_money and bidding_money >= 5000:
|
bidding = True
|
# 获取自由流通股本
|
zyltgb = global_util.zyltgb_map.get(code)
|
if zyltgb is None:
|
zyltgb = 100 * 100000000
|
|
k_form = code_nature_analyse.CodeNatureRecordManager.get_k_format(code)
|
if k_form is None:
|
k_form = [True, False, False, False, False, False]
|
code_nature = code_nature_analyse.CodeNatureRecordManager.get_nature(code)
|
|
hot_block = hot_block_data_process.get_info(code)
|
if hot_block is None:
|
hot_block = (1, 0)
|
else:
|
# 加上自己
|
hot_block = (hot_block[0] + 1, hot_block[1])
|
|
if limit_up_time and tool.trade_time_sub(limit_up_time, "10:00:00") < 0:
|
limit_up_time = True
|
else:
|
limit_up_time = False
|
# 获取成交大单
|
deal_big_num = deal_big_money_manager.get_deal_big_money_num(code)
|
m = l2_trade_factor.L2TradeFactorUtil.get_base_safe_val(zyltgb)
|
limit_price = float(gpcode_manager.get_limit_up_price(code))
|
if deal_big_num * limit_price * 100 > m:
|
deal_big_num = True
|
else:
|
deal_big_num = False
|
|
return __get_score(zyltgb >= 250 * 100000000, limit_price > 100, bidding, k_form, code_nature, hot_block,
|
volume_rate, limit_up_time, deal_big_num)
|
|
|
if __name__ == "__main__":
|
global_data_loader.load_zyltgb()
|
score = get_score("601698", 1.2, "15:00:01")
|
print(score)
|