| | |
| | | # 判断板块是否不能买 |
| | | if can_buy_blocks: |
| | | msges.clear() |
| | | forbidden_blocks = set() |
| | | is_first_limit_up = is_first_limit_up_buy(code) |
| | | for b in can_buy_blocks: |
| | | if not is_can_buy_for_forbidden_plate(code, b, yesterday_limit_up_codes): |
| | | msges.append(b) |
| | | if msges: |
| | | result = is_can_buy_for_forbidden_plate(code, b, yesterday_limit_up_codes, is_first_limit_up) |
| | | if not result[0]: |
| | | forbidden_blocks.add(b) |
| | | msges.append(f"【{b}】-{result[1]}") |
| | | if forbidden_blocks: |
| | | fmsges.append("禁止买入的板块##" + ",".join(msges)) |
| | | # 排除禁止买入的板块 |
| | | can_buy_blocks -= set(msges) |
| | | |
| | | can_buy_blocks -= set(forbidden_blocks) |
| | | return can_buy_blocks, " **** ".join(fmsges) |
| | | |
| | | |
| | |
| | | return False |
| | | |
| | | |
| | | def is_can_buy_for_forbidden_plate(code, block, yesterday_limit_up_codes): |
| | | def is_can_buy_for_forbidden_plate(code, block, yesterday_limit_up_codes, is_first_limit_up): |
| | | """ |
| | | 被禁止的板块是否可买 |
| | | @param code: |
| | |
| | | """ |
| | | if not KPLPlateForbiddenManager().is_in_cache(block): |
| | | # 板块没有被禁止 |
| | | return True |
| | | return True, "" |
| | | if is_first_limit_up: |
| | | # 禁止买入的板块只能买汇丰 |
| | | return False, "禁止买入的板块-只能买回封" |
| | | |
| | | special_codes = BlockSpecialCodesManager().get_block_codes(block) |
| | | if not special_codes: |
| | | # 无辨识度 |
| | | return False |
| | | return False, "禁止买入的板块-不具辨识度" |
| | | if code not in special_codes: |
| | | # 当前票无辨识度 |
| | | return False |
| | | return False, "禁止买入的板块-不具辨识度" |
| | | # 买辨识度老大+流入前5的辨识度老2 |
| | | data = RadicalBuyBlockManager().get_history_index(code, block, yesterday_limit_up_codes) |
| | | if data[1]: |
| | |
| | | before_codes &= set(special_codes) |
| | | if len(before_codes) > 1: |
| | | # 辨识度老三及以后不能买 |
| | | return False |
| | | return False, "禁止买入的板块-不能买辨识度老三" |
| | | if len(before_codes) == 1: |
| | | # 辨识度老2需要在流入前5 |
| | | in_blocks: list = RealTimeKplMarketData.get_top_market_jingxuan_blocks() |
| | | if not in_blocks or block not in in_blocks or in_blocks.index(block) >= 5: |
| | | return False |
| | | return True |
| | | return False, "禁止买入的板块辨-识度老2需要在流入前5" |
| | | return True, "" |
| | | |
| | | |
| | | if __name__ == '__main__': |