| | |
| | | history_index, history_before_codes_info = cls.__get_history_index(code, block, |
| | | yesterday_limit_up_codes, |
| | | exclude_codes=exclude_codes) |
| | | # 过滤不正的原因 |
| | | history_index, history_before_codes_info = cls.__filter_before_codes(block, history_index, history_before_codes_info, yesterday_limit_up_codes) |
| | | |
| | | # 买首板老大/老二 |
| | | # 首板老大不能买时可买老二 |
| | | if history_index > 1: |
| | |
| | | return False, f"开1数量:{count},前排代码可买:{history_before_codes_info[0]}" |
| | | return True, f"开1数量:{count},前排代码不可买:{history_before_codes_info[0]},历史前排-{history_before_codes_info},开1代码-{open_limit_up_block_codes}" |
| | | return True, f"开1数量:{count},历史-{history_index + 1} 实时-{current_index + 1}, 前排代码-{current_before_codes_info}, 开1代码-{open_limit_up_block_codes}" |
| | | |
| | | @classmethod |
| | | def __filter_before_codes(cls, block, index, before_codes_info, yesterday_codes): |
| | | """ |
| | | 过滤前排涨停原因不正的代码 |
| | | @param code: |
| | | @param block:板块 |
| | | @param index: 目标代码位置 |
| | | @param before_codes_info: [(代码, 涨停时间戳)] |
| | | @return: 过滤之后的 (index, before_codes_info) |
| | | """ |
| | | try: |
| | | if index == 0 or not before_codes_info: |
| | | return index, before_codes_info |
| | | temp_index = index |
| | | temp_before_codes_info = [] |
| | | for b in before_codes_info: |
| | | # 当作目标票获取扫入板块 |
| | | blocks = LimitUpCodesBlockRecordManager().get_radical_buy_blocks(b[0]) |
| | | blocks = BlockMapManager().filter_blocks(blocks) |
| | | if block not in blocks and b[0] not in yesterday_codes: |
| | | # 首板涨停原因不正 |
| | | temp_index -= 1 |
| | | else: |
| | | temp_before_codes_info.append(b) |
| | | |
| | | return temp_index, temp_before_codes_info |
| | | except Exception as e: |
| | | async_log_util.error(logger_debug, f"扫入板块过滤出错:{str(e)}") |
| | | return index, before_codes_info |
| | | |
| | | @classmethod |
| | | def __is_radical_buy_with_block_up(cls, code, block, yesterday_limit_up_codes): |
| | |
| | | exclude_codes |= set(open_limit_up_code_dict.keys()) |
| | | history_index, history_before_codes_info = cls.__get_history_index(code, block, yesterday_limit_up_codes, |
| | | exclude_codes) |
| | | |
| | | # 过滤不正的原因 |
| | | history_index, history_before_codes_info = cls.__filter_before_codes(block, history_index, |
| | | history_before_codes_info, |
| | | yesterday_limit_up_codes) |
| | | |
| | | # 获取本板块买入代码的最大数量 |
| | | max_count = RadicalBuyBlockCodeCountManager().get_block_code_count(block) |
| | | if history_index > max_count: |