| | |
| | | if code in cls.unreal_buy_dict: |
| | | cls.unreal_buy_dict.pop(code) |
| | | |
| | | buy_single_index, buy_exec_index, buy_compute_index, num, count, max_num_set, buy_volume_rate = cls.__get_order_begin_pos( |
| | | code) |
| | | buy_single_index, buy_exec_index, buy_compute_index, num, count, max_num_set, buy_volume_rate = cls.__get_order_begin_pos(code) |
| | | if not can: |
| | | l2_log.debug(code, "不可以下单,原因:{}", reason) |
| | | if need_clear_data: |
| | |
| | | for i in range(trade_index + 1, total_data[-1]["index"] + 1): |
| | | if L2DataUtil.is_limit_up_price_buy(total_data[i]["val"]): |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count(code, |
| | | total_data[ |
| | | i][ |
| | | "index"], |
| | | total_data[i]["index"], |
| | | total_data, |
| | | num_operate_map) |
| | | if left_count > 0: |
| | |
| | | |
| | | @classmethod |
| | | def can_buy_first(cls, code, limit_up_price): |
| | | l2_log.debug(code,"can_buy_first start") |
| | | # def is_has_k_format(score_info): |
| | | # # (15个交易日涨幅是否大于24.9%,是否破前高,是否超跌,是否接近前高,是否N,是否V,是否有形态,天量大阳信息,是否具有辨识度) |
| | | # |
| | |
| | | return False, True, f"股价大于{constant.MAX_CODE_PRICE}块" |
| | | |
| | | # 9:35之前买大市值(>=80亿)票 |
| | | if int(tool.get_now_date_str("%Y%m%d")) < int("093500"): |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | if zyltgb is None: |
| | | global_data_loader.load_zyltgb() |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | if zyltgb >= 80 * 100000000: |
| | | return True, False, "{9:30:00-9:35:00}自由市值≥80亿" |
| | | # if int(tool.get_now_date_str("%Y%m%d")) < int("093500"): |
| | | # zyltgb = global_util.zyltgb_map.get(code) |
| | | # if zyltgb is None: |
| | | # global_data_loader.load_zyltgb() |
| | | # zyltgb = global_util.zyltgb_map.get(code) |
| | | # if zyltgb >= 80 * 100000000: |
| | | # return True, False, "{9:30:00-9:35:00}自由市值≥80亿" |
| | | # 判断板块 |
| | | yesterday_codes = kpl_data_manager.get_yesterday_limit_up_codes() |
| | | l2_log.debug(code, "block_can_buy") |
| | | plate_can_buy, msg = CodePlateKeyBuyManager.can_buy(code, |
| | | kpl_data_manager.KPLLimitUpDataRecordManager.latest_origin_datas, |
| | | kpl_data_manager.KPLLimitUpDataRecordManager.total_datas, |
| | | yesterday_codes, |
| | | block_info.get_before_blocks_dict()) |
| | | l2_log.debug(code, "can_buy_first end") |
| | | if not plate_can_buy: |
| | | return False, True, msg |
| | | return True, False, msg |
| | |
| | | |
| | | can_buy_blocks = [] |
| | | for block in keys: |
| | | log.logger_kpl_debug.info(f"判断板块是否可买:{block}") |
| | | is_top_8_record, top_8_record = kpl_block_util.is_record_top_block(code, block, limit_up_record_datas, |
| | | yesterday_current_limit_up_codes, 50) |
| | | is_top_4_current, top_4_current = kpl_block_util.is_current_top_block(code, block, current_limit_up_datas, |
| | |
| | | f"板块-{block}: top4涨停板块,非主板开1,不为主板龙1(实时身位-{current_shsz_rank},历史身位-{record_shsz_rank})") |
| | | continue |
| | | else: |
| | | # 是否满足行业精选流入要求 |
| | | is_in_top_input = RealTimeKplMarketData.is_in_top(set([block]))[0] |
| | | if not is_in_top_input: |
| | | msg_list.append( |
| | | f"板块-{block}: 非top4涨停板块,不满足精选/行业流入要求") |
| | | continue |
| | | else: |
| | | # 是否为主板龙1(实时龙1,历史龙2以内) |
| | | if current_shsz_rank == 0 and record_shsz_rank < 2: |
| | | can_buy_blocks.append((block, f"{block}:不是top4涨停板块,满足精选/行业流入要求,满足主板龙1")) |
| | | continue |
| | | else: |
| | | msg_list.append( |
| | | f"板块-{block}: 不是top4涨停板块,满足精选/行业流入要求,不为主板龙1(实时身位-{current_shsz_rank},历史身位-{record_shsz_rank})") |
| | | continue |
| | | pass |
| | | # # 是否满足行业精选流入要求 |
| | | # is_in_top_input = RealTimeKplMarketData.is_in_top(set([block]))[0] |
| | | # if not is_in_top_input: |
| | | # msg_list.append( |
| | | # f"板块-{block}: 非top4涨停板块,不满足精选/行业流入要求") |
| | | # continue |
| | | # else: |
| | | # # 是否为主板龙1(实时龙1,历史龙2以内) |
| | | # if current_shsz_rank == 0 and record_shsz_rank < 2: |
| | | # can_buy_blocks.append((block, f"{block}:不是top4涨停板块,满足精选/行业流入要求,满足主板龙1")) |
| | | # continue |
| | | # else: |
| | | # msg_list.append( |
| | | # f"板块-{block}: 不是top4涨停板块,满足精选/行业流入要求,不为主板龙1(实时身位-{current_shsz_rank},历史身位-{record_shsz_rank})") |
| | | # continue |
| | | if len(can_buy_blocks) == len(keys): |
| | | blocks = [x[0] for x in can_buy_blocks] |
| | | blocks_msg = "\n".join([x[1] for x in can_buy_blocks]) |
| | |
| | | |
| | | # 开盘啦历史涨停数据管理 |
| | | from db import mysql_data_delegate as mysql_data, redis_manager_delegate as redis_manager |
| | | from log_module.log import logger_kpl_limit_up_reason_change |
| | | from log_module.log import logger_kpl_limit_up_reason_change, logger_debug |
| | | from third_data import kpl_util, kpl_api |
| | | from third_data.code_plate_key_manager import LimitUpCodesPlateKeyManager, CodesHisReasonAndBlocksManager |
| | | |
| | |
| | | if day in __limit_up_list_records_dict: |
| | | datas = __limit_up_list_records_dict[day] |
| | | else: |
| | | logger_debug.info("从文件中获取前几天的实时涨停数据") |
| | | datas = KPLDataManager().get_latest_from_file(KPLDataType.LIMIT_UP, 10) |
| | | if datas: |
| | | # 保存数据 |