# 当前涨停数据
|
import constant
|
from third_data import kpl_block_util
|
|
# 用于计算激进买开1的板数:{"代码":(几版,{板块})}
|
open_limit_up_code_dict_for_radical_buy = None
|
|
|
class LimitUpDataConstant:
|
"""
|
当前涨停数据的数据
|
"""
|
__history_code_blocks_dict = {}
|
__history_code_data_dict = {}
|
history_limit_up_datas = []
|
current_limit_up_datas = []
|
|
@classmethod
|
def set_current_limit_up_datas(cls, current_limit_up_datas):
|
cls.current_limit_up_datas = current_limit_up_datas
|
|
@classmethod
|
def set_history_limit_up_datas(cls, history_limit_up_datas_):
|
cls.history_limit_up_datas = history_limit_up_datas_
|
for d in cls.history_limit_up_datas:
|
blocks = {d[2]}
|
# 开1才能包含推荐原因
|
if d[6] and kpl_block_util.open_limit_up_time_range[0] <= int(d[5]) < \
|
kpl_block_util.open_limit_up_time_range[1]:
|
blocks |= set(d[6].split("、"))
|
blocks -= constant.KPL_INVALID_BLOCKS
|
cls.__history_code_blocks_dict[d[3]] = blocks
|
cls.__history_code_data_dict[d[3]] = d
|
|
@classmethod
|
def get_blocks_with_history(cls, code):
|
"""
|
根据历史涨停获取板块
|
@param code:
|
@return:
|
"""
|
return cls.__history_code_blocks_dict.get(code)
|
|
@classmethod
|
def get_limit_up_reason_with_history(cls, code):
|
d = cls.__history_code_data_dict.get(code)
|
if d:
|
return d[2]
|
return None
|
|
@classmethod
|
def get_first_limit_up_time(cls, code):
|
if code in cls.__history_code_data_dict:
|
return int(cls.__history_code_data_dict[code][5])
|
return None
|