| | |
| | | continue |
| | | buy1_money = huaxin_l1_data_manager.get_buy1_money(code) |
| | | # 买1是否大于5000w |
| | | if not buy1_money or buy1_money < 5e7: |
| | | continue |
| | | # TODO 测试 |
| | | if not constant.TEST: |
| | | if not buy1_money or buy1_money < 5e7: |
| | | continue |
| | | if not tool.is_can_buy_code(code): |
| | | continue |
| | | blocks = {d[5]} |
| | |
| | | @return: |
| | | """ |
| | | # 10点之前才能买入 |
| | | if int(tool.get_now_time_str().replace(":", "")) > 100000: |
| | | return False, "超过生效时间" |
| | | # TODO 测试 |
| | | if not constant.TEST: |
| | | if int(tool.get_now_time_str().replace(":", "")) > 100000: |
| | | return False, "超过生效时间" |
| | | |
| | | # 根据板块聚合数据 |
| | | open_limit_up_block_codes = {} |
| | | open_limit_up_block_codes_dict = {} |
| | | for c in kpl_data_constant.open_limit_up_code_dict_for_radical_buy: |
| | | blocks = kpl_data_constant.open_limit_up_code_dict_for_radical_buy[c][1] |
| | | for b in blocks: |
| | | if b not in open_limit_up_block_codes: |
| | | open_limit_up_block_codes[b] = set() |
| | | open_limit_up_block_codes[b].add(c) |
| | | if block not in open_limit_up_block_codes: |
| | | if b not in open_limit_up_block_codes_dict: |
| | | open_limit_up_block_codes_dict[b] = set() |
| | | open_limit_up_block_codes_dict[b].add(c) |
| | | if block not in open_limit_up_block_codes_dict: |
| | | return False, "板块未开1" |
| | | |
| | | count = len(open_limit_up_block_codes.get(block)) |
| | | open_limit_up_block_codes = list(open_limit_up_block_codes_dict.get(block)) |
| | | count = len(open_limit_up_block_codes) |
| | | # ----获取历史身位---- |
| | | history_index, history_before_codes_info = cls.__get_history_index(code, block, yesterday_limit_up_codes) |
| | | # ----获取实时身位---- |
| | | current_index, current_before_codes_info = cls.__get_current_index(code, block, yesterday_limit_up_codes) |
| | | if count >= 2: |
| | | # 买老2 |
| | | if count >= 2 or ( |
| | | count == 1 and kpl_data_constant.open_limit_up_code_dict_for_radical_buy[open_limit_up_block_codes[0]][ |
| | | 0] == 2): |
| | | # 开始数量大于2个或者只有一个2板开1 |
| | | if history_index == 0 and current_index == 0: |
| | | return True, f"开1数量:{count}" |
| | | else: |
| | | return False, f"开1数量:{count},身位不匹配:历史-{history_index} 实时-{current_index}" |
| | | return False, f"开1数量:{count},非开1首板身位不匹配:历史-{history_index+1} 实时-{current_index+1}" |
| | | else: |
| | | # 买老3 |
| | | if history_index == 1 and current_index == 1: |
| | | return True, f"开1数量:{count}" |
| | | else: |
| | | return False, f"开1数量:{count},身位不匹配:历史-{history_index} 实时-{current_index}" |
| | | return False, f"开1数量:{count},非开1首板身位不匹配:历史-{history_index+1} 实时-{current_index+1}" |
| | | |
| | | @classmethod |
| | | def __is_radical_buy_with_block_up(cls, code, block, yesterday_limit_up_codes): |
| | |
| | | """ |
| | | # 获取当前的板块 |
| | | current_index, current_before_codes_info = cls.__get_current_index(code, block, set()) |
| | | if len(current_before_codes_info) < 2: |
| | | return False, f"前排代码小于2个" |
| | | if current_before_codes_info[0][1] >= kpl_block_util.open_limit_up_time_range[1]: |
| | | return False, f"有开1" |
| | | if current_index != 2: |
| | | return False, f"只能买老3,当前身位-{current_index + 1}" |
| | | history_index, history_before_codes_info = cls.__get_history_index(code, block, set()) |
| | | if history_index != current_index or len(current_before_codes_info) != len(history_before_codes_info): |
| | | return False, f"前排代码有炸板" |
| | | if len(current_before_codes_info) < 2: |
| | | return False, f"前排代码小于2个" |
| | | # 老大,老二必须相隔5分钟内 |
| | | if current_before_codes_info[0][1] >= kpl_block_util.open_limit_up_time_range[1]: |
| | | return False, f"有开1" |
| | | |
| | | # 老大,老二必须相隔5分钟内 |
| | | if current_before_codes_info[1][1] - current_before_codes_info[0][1] < 5 * 60: |
| | | # 获取当前代码的涨停时间 |
| | | limit_up_timestamp = LimitUpDataConstant.get_first_limit_up_time(code) |
| | |
| | | keys_, k1_, k11_, k2_, k3_, k4_ = cls.__TargetCodePlateKeyManager.get_plate_keys(code, contains_today=False) |
| | | match_blocks = open_limit_up_blocks & keys_ |
| | | can_buy_blocks = set() |
| | | fmsges = [] |
| | | msges = [] |
| | | for b in match_blocks: |
| | | # 判断板块是否该激进买 |
| | |
| | | if result[0]: |
| | | can_buy_blocks.add(b) |
| | | msges.append(f"【{b}】:{result}") |
| | | if can_buy_blocks: |
| | | return can_buy_blocks, "开1满足条件:" + ",".join(msges) |
| | | fmsges.append("开1判断##" + ",".join(msges)) |
| | | if not can_buy_blocks: |
| | | msges.clear() |
| | | for b in match_blocks: |
| | |
| | | if result[0]: |
| | | can_buy_blocks.add(b) |
| | | msges.append(f"【{b}】:{result}") |
| | | return can_buy_blocks, "开1不满足条件,板块快速启动:" + ",".join(msges) |
| | | fmsges.append("板块快速启动判断##" + ",".join(msges)) |
| | | return can_buy_blocks, " **** ".join(fmsges) |
| | | |
| | | |
| | | if __name__ == "__main__": |