Administrator
2024-04-28 3af02884a1f2e98c899cc2f21ab434fd6062c34f
l2/l2_data_manager_new.py
@@ -927,6 +927,10 @@
        if 130100 >= now_time_int >= 112900:
            return False, True, f"11:29:00-13:01:00不能交易"
        place_order_count = cls.__PlaceOrderCountManager.get_place_order_count(code)
        if place_order_count > 0 and now_time_int >= 140000:
            return False, True, f"14:00:00不打回封"
        limit_up_price = gpcode_manager.get_limit_up_price(code)
        if constant.MIN_CODE_PRICE < float(limit_up_price) < constant.MAX_CODE_PRICE:
@@ -1030,7 +1034,7 @@
        if not cls.__WantBuyCodesManager.is_in_cache(code):
            # if cls.__TradeTargetCodeModeManager.get_mode_cache() == TradeTargetCodeModeManager.MODE_ONLY_BUY_WANT_CODES:
            #     return False, True, f"只买想买单中的代码"
            return cls.can_buy_first(code, limit_up_price)
            return cls.can_buy_first_new(code, limit_up_price)
        else:
            return True, False, "在想买单中"
@@ -1235,6 +1239,48 @@
            #             if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < volume_rate_thresholds[
            #                 0] and not is_special:
            #                 return False, True, f"非强势10分钟,非强势主线后排【主线后排】, 满足自由市值,无辨识度,当日量比({cls.volume_rate_info[code][0]})小于{volume_rate_thresholds[0]}"
            return True, False, can_buy_result[2]
    @classmethod
    def can_buy_first_new(cls, code, limit_up_price):
        now_timestamp = int(tool.get_now_time_str().replace(":", ""))
        # 判断板块
        # (可以买的板块列表, 是否是独苗, 消息简介,可买的强势主线, 板块关键词)
        can_buy_result = cls.__get_can_buy_block(code)
        if can_buy_result is None:
            return False, True, "尚未获取到板块信息"
        # 是否是强势30分钟
        is_in_strong_time_30 = now_timestamp <= int("100000")
        # 获取市场行情
        situation = cls.__MarketSituationManager.get_situation_cache()
        zylt_threshold_as_yi = buy_condition_util.get_zyltgb_threshold(situation)
        zyltgb_as_yi = round(global_util.zyltgb_map.get(code) / 100000000, 2)
        if zyltgb_as_yi >= zylt_threshold_as_yi[1]:
            return False, True, f"{zylt_threshold_as_yi[1]}亿以上的都不买({zyltgb_as_yi})"
        if zyltgb_as_yi < zylt_threshold_as_yi[0]:
            return False, True, f"{zylt_threshold_as_yi[0]}亿以下的都不买({zyltgb_as_yi})"
        msg_list = []
        if is_in_strong_time_30:
            msg_list.append("强势30分钟")
            # 独苗
            if not can_buy_result[0] and can_buy_result[1]:
                msg_list.append("独苗")
                return True, False, "强势30分钟,独苗"
            elif not can_buy_result[0]:
                return False, True, f"强势30分钟,非独苗不满足身位:{can_buy_result[2]}"
            else:
                msg_list.append("非独苗")
                # 后排,满足自由流通市值需要下单
                return True, False, can_buy_result[2]
        else:
            if not can_buy_result[0]:
                return False, True, f"非强势30分钟,不满足身位:{can_buy_result[2]}"
            return True, False, can_buy_result[2]
    @classmethod
@@ -1672,7 +1718,8 @@
                if _val["num"] * float(_val["price"]) < 5000:
                    continue
                return True, i, [refer_sell_data[0], 0], '上证买入',  OrderBeginPosInfo.MODE_ACTIVE if active_buy_blocks else  OrderBeginPosInfo.MODE_FAST
                return True, i, [refer_sell_data[0],
                                 0], '上证买入', OrderBeginPosInfo.MODE_ACTIVE if active_buy_blocks else OrderBeginPosInfo.MODE_FAST
            return False, -1, "未获取到激进买的起始信号", '', OrderBeginPosInfo.MODE_NORMAL
        else:
            # 深证
@@ -1721,13 +1768,15 @@
                    buy_single_index = cls.__get_active_single_start_index(code, start_index, end_index, continue_count,
                                                                           valid_single=True)
                    if buy_single_index is not None:
                        return True, buy_single_index, [refer_sell_data[0], 0], "上板有成交买入信号", OrderBeginPosInfo.MODE_ACTIVE if active_buy_blocks else  OrderBeginPosInfo.MODE_FAST
                        return True, buy_single_index, [refer_sell_data[0],
                                                        0], "上板有成交买入信号", OrderBeginPosInfo.MODE_ACTIVE if active_buy_blocks else OrderBeginPosInfo.MODE_FAST
            else:
                # 板上放量:只需要一笔涨停买可作为信号
                buy_single_index = cls.__get_active_single_start_index(code, start_index, end_index, continue_count,
                                                                       valid_single=False)
                if buy_single_index is not None:
                    return True, buy_single_index, [refer_sell_data[0], 0], "板上放量", OrderBeginPosInfo.MODE_ACTIVE if active_buy_blocks else OrderBeginPosInfo.MODE_NORMAL
                    return True, buy_single_index, [refer_sell_data[0],
                                                    0], "板上放量", OrderBeginPosInfo.MODE_ACTIVE if active_buy_blocks else OrderBeginPosInfo.MODE_NORMAL
        return False, -1, "未获取到激进买的起始信号", '', OrderBeginPosInfo.MODE_NORMAL