| | |
| | | open_limit_up_code_dict_for_radical_buy = None |
| | | |
| | | |
| | | @tool.singleton |
| | | class ContainsLimitupCodesBlocksManager: |
| | | """ |
| | | 包含涨停代码的板块 |
| | | """ |
| | | __block_codes_dict = {} |
| | | |
| | | def __init__(self): |
| | | self.__load_data() |
| | | |
| | | def __load_data(self): |
| | | records = KPLLimitUpDataUtil.get_latest_block_infos_by_day() |
| | | if records: |
| | | codes = set([r[3] for r in records]) |
| | | for code in codes: |
| | | self.__add_code(code) |
| | | |
| | | def get_block_codes(self, block): |
| | | return self.__block_codes_dict.get(block) |
| | | |
| | | def __add_code(self, code): |
| | | blocks = LimitUpCodesBlockRecordManager().get_radical_buy_blocks(code) |
| | | if blocks: |
| | | for b in blocks: |
| | | if b not in self.__block_codes_dict: |
| | | self.__block_codes_dict[b] = set() |
| | | self.__block_codes_dict[b].add(code) |
| | | |
| | | def set_current_limit_up_datas(self, datas): |
| | | """ |
| | | 设置当前涨停数据 |
| | | @param datas: |
| | | @return: |
| | | """ |
| | | if datas: |
| | | codes = [x[0] for x in datas] |
| | | for code in codes: |
| | | self.__add_code(code) |
| | | |
| | | |
| | | @singleton |
| | | class LimitUpCodesBlockRecordManager: |
| | | """ |
| | |
| | | if code in cls.__history_code_data_dict: |
| | | return int(cls.__history_code_data_dict[code][5]) |
| | | return None |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | ContainsLimitupCodesBlocksManager() |