| | |
| | | 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: |
| | |
| | | float(open_limit_up_lowest_price) - price_pre_close) / price_pre_close < 0.05: |
| | | return False, True, f"炸板后最低价跌至5%以下" |
| | | |
| | | limit_up_info = cls.__Buy1PriceManager.get_limit_up_info(code) |
| | | if limit_up_info[0] is None and False: |
| | | total_data = local_today_datas.get(code) |
| | | buy_single_index, buy_exec_index, buy_compute_index, num, count, max_num_set, buy_volume_rate = cls.__get_order_begin_pos( |
| | | code) |
| | | # 之前没有涨停过 |
| | | # 统计买入信号位到当前位置没有撤的大单金额 |
| | | min_money_w = l2_data_util.get_big_money_val(float(total_data[buy_single_index]["val"]["price"])) // 10000 |
| | | left_big_num = cls.__SecondCancelBigNumComputer.compute_left_big_num(code, |
| | | buy_single_index, |
| | | buy_exec_index, |
| | | total_data[-1][ |
| | | "index"], |
| | | total_data, |
| | | 0, min_money_w) |
| | | if left_big_num > 0: |
| | | # 重新获取分数与分数索引 |
| | | limit_up_time = cls.__LimitUpTimeManager.get_limit_up_time_cache(code) |
| | | if limit_up_time is None: |
| | | limit_up_time = tool.get_now_time_str() |
| | | score = first_code_score_manager.get_score(code, cls.volume_rate_info[code][0], limit_up_time, True, |
| | | left_big_num) |
| | | cls.__l2PlaceOrderParamsManagerDict[code].set_score(score) |
| | | # limit_up_info = cls.__Buy1PriceManager.get_limit_up_info(code) |
| | | # if limit_up_info[0] is None and False: |
| | | # total_data = local_today_datas.get(code) |
| | | # buy_single_index, buy_exec_index, buy_compute_index, num, count, max_num_set, buy_volume_rate = cls.__get_order_begin_pos( |
| | | # code) |
| | | # # 之前没有涨停过 |
| | | # # 统计买入信号位到当前位置没有撤的大单金额 |
| | | # min_money_w = l2_data_util.get_big_money_val(float(total_data[buy_single_index]["val"]["price"])) // 10000 |
| | | # left_big_num = cls.__SecondCancelBigNumComputer.compute_left_big_num(code, |
| | | # buy_single_index, |
| | | # buy_exec_index, |
| | | # total_data[-1][ |
| | | # "index"], |
| | | # total_data, |
| | | # 0, min_money_w) |
| | | # if left_big_num > 0: |
| | | # # 重新获取分数与分数索引 |
| | | # limit_up_time = cls.__LimitUpTimeManager.get_limit_up_time_cache(code) |
| | | # if limit_up_time is None: |
| | | # limit_up_time = tool.get_now_time_str() |
| | | # score = first_code_score_manager.get_score(code, cls.volume_rate_info[code][0], limit_up_time, True, |
| | | # left_big_num) |
| | | # cls.__l2PlaceOrderParamsManagerDict[code].set_score(score) |
| | | |
| | | # logger_place_order_score.info("code={},data='score_index':{},'score_info':{}", code, |
| | | # cls.__l2PlaceOrderParamsManagerDict[code].score_index, |
| | |
| | | # f.write(output.getvalue()) |
| | | # return results |
| | | return cls.can_buy_first(code, limit_up_price) |
| | | |
| | | else: |
| | | return True, False, "在想买名单中" |
| | | |
| | | @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,是否有形态,天量大阳信息,是否具有辨识度) |
| | | # |
| | | # if score_info[1][3][6][0] and not score_info[1][3][3][0]: |
| | | # return True |
| | | # if score_info[1][3][7][0]: |
| | | # return True |
| | | # return False |
| | | |
| | | if float(limit_up_price) >= constant.MAX_CODE_PRICE: |
| | | 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亿" |
| | | # 判断板块 |
| | | can_buy_result = CodePlateKeyBuyManager.can_buy(code) |
| | | if can_buy_result is None: |
| | | logger_debug.warning("没有获取到板块缓存,将获取板块") |
| | | 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, |
| | | CodePlateKeyBuyManager.update_can_buy_blocks(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_result = CodePlateKeyBuyManager.can_buy(code) |
| | | |
| | | # if volume_rate_info[0] < 0.4: |
| | | # return False, True, f"量大于40%才下单,量比:{volume_rate_info[0]}" |
| | | |
| | | # 是否有K线形态(有K线形态或者天量大阳),10点后才需要判断是否有K线形态与分值 |
| | | # if int(tool.get_now_time_str().replace(":", "")) > int("100000"): |
| | | # has_k_format = score_info[1][3][6][0] or score_info[1][3][7][0] |
| | | # if not has_k_format: |
| | | # return False, True, f"无K线形态" |
| | | # |
| | | # if score_index < 0: |
| | | # return False, True, f"分值:{score}未达到需要买入的分数线" |
| | | # return True, False, "" |
| | | if can_buy_result is None: |
| | | return False, True, "尚未获取到板块信息" |
| | | if not can_buy_result[0]: |
| | | return False, True, can_buy_result[1] |
| | | return True, False, can_buy_result[1] |
| | | |
| | | @classmethod |
| | | def __cancel_buy(cls, code): |
| | |
| | | _start_time = tool.get_now_timestamp() |
| | | total_datas = local_today_datas[code] |
| | | # 处理安全笔数 |
| | | cls.__buyL2SafeCountManager.compute_left_rate(code, compute_start_index, compute_end_index, total_datas, |
| | | local_today_num_operate_map.get(code)) |
| | | # cls.__buyL2SafeCountManager.compute_left_rate(code, compute_start_index, compute_end_index, total_datas, |
| | | # local_today_num_operate_map.get(code)) |
| | | |
| | | # 获取买入信号计算起始位置 |
| | | buy_single_index, buy_exec_index, buy_compute_index, num, count, max_num_set, buy_volume_rate = cls.__get_order_begin_pos( |