Administrator
2024-09-09 e9680308bd91bb112c29f03a1316a0fc49e1917a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 当前涨停数据
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