| | |
| | | for k in code_blocks_dict: |
| | | fdata[k] = list(code_blocks_dict[k]) |
| | | response_data = json.dumps({"code": 0, "data": fdata}) |
| | | elif url.path == "/get_new_blocks_special_codes": |
| | | # 获取所有辨识度的代码 |
| | | code_blocks_dict = BlockSpecialCodesManager().get_temp_code_blocks_dict() |
| | | fdata = {} |
| | | for k in code_blocks_dict: |
| | | fdata[k] = list(code_blocks_dict[k]) |
| | | response_data = json.dumps({"code": 0, "data": fdata}) |
| | | |
| | | async_log_util.info(logger_request_api, f"结束请求{tool.get_thread_id()}-{url}") |
| | | self.send_response(200) |
| | |
| | | |
| | | def do_limit_up(result_list_): |
| | | |
| | | def request_new_blocks_codes(blocks_info): |
| | | def request_new_blocks_codes(blocks_info, all_new_blocks): |
| | | """ |
| | | 请求新板块的代码 |
| | | @param blocks_info:[(板块名称,板块代码)] |
| | |
| | | code_info_list.append((d[0], d[6])) |
| | | if code_info_list: |
| | | # 将代码加入新题材 |
| | | for x in code_info_list: |
| | | new_block_processor.process_new_block(x[0], bi[0]) |
| | | new_block_processor.process_new_block_by_component_codes(bi[0], set([x[0] for x in code_info_list]), all_new_blocks) |
| | | |
| | | |
| | | try: |
| | |
| | | pass |
| | | |
| | | try: |
| | | records = KPLLimitUpDataRecordManager.total_datas |
| | | # 计算今日新增的题材概念 |
| | | block_codes = {} |
| | | # 统计板块的代码 |
| | | block_plate_code_dict = {} |
| | | for x in records: |
| | | bs = {kpl_util.filter_block(x[2])} |
| | | block_plate_code_dict[kpl_util.filter_block(x[2])] = x[15] |
| | | # if x[6]: |
| | | # bs |= set(x[6].split("、")) |
| | | for b in bs: |
| | | if b not in block_codes: |
| | | block_codes[b] = set() |
| | | block_codes[b].add(x[3]) |
| | | # 所有代码的涨停原因 |
| | | reasons = set(block_codes.keys()) |
| | | reasons -= constant.KPL_INVALID_BLOCKS |
| | | # 原来的老题材 |
| | | reasons -= BeforeBlocksComputer().get_old_blocks() |
| | | if reasons: |
| | | # 新题材 |
| | | new_block_codes = new_block_processor.screen_new_blocks_with_limit_up_datas([(x[0], x[5]) for x in result_list_]) |
| | | if new_block_codes: |
| | | # 统计板块的代码 |
| | | records = KPLLimitUpDataRecordManager.total_datas |
| | | block_plate_code_dict = {} |
| | | for x in records: |
| | | block_plate_code_dict[kpl_util.filter_block(x[2])] = x[15] |
| | | # 新板块 |
| | | update_new_block_plates = [] |
| | | for r in reasons: |
| | | for c in block_codes[r]: |
| | | new_block_processor.process_new_block(c, r) |
| | | for b in new_block_codes: |
| | | for c in new_block_codes[b]: |
| | | new_block_processor.process_new_block_by_limit_up_list(c, b) |
| | | |
| | | for r in reasons: |
| | | for r in new_block_codes: |
| | | if r in block_plate_code_dict: |
| | | update_new_block_plates.append((r, block_plate_code_dict[r])) |
| | | if update_new_block_plates: |
| | | # 需要获取板块下的代码 |
| | | self.__new_blocks_codes_request_thread_pool.submit( |
| | | lambda: request_new_blocks_codes(update_new_block_plates)) |
| | | lambda: request_new_blocks_codes(update_new_block_plates, new_block_codes.keys())) |
| | | except: |
| | | pass |
| | | self.__kplDataManager.save_data(type_, result_list_) |