Administrator
2023-06-06 751183dcd74207a50834cacc575f0dfccb41658c
l2/l2_data_manager_new.py
@@ -678,19 +678,31 @@
        if zyltgb is None:
            global_data_loader.load_zyltgb()
            zyltgb = global_util.zyltgb_map.get(code)
        buy1_price = code_price_manager.Buy1PriceManager.get_buy1_price(code)
        if buy1_price is None:
            return False, True, f"尚未获取到买1价"
        # buy1_price = code_price_manager.Buy1PriceManager.get_buy1_price(code)
        # if buy1_price is None:
        #     return False, True, f"尚未获取到买1价"
        limit_up_price = gpcode_manager.get_limit_up_price(code)
        dif = float(limit_up_price) - float(buy1_price)
        if zyltgb >= 80 * 100000000:
            # 大于2档
            if dif > 0.02001:
                return False, True, f"买1剩余档数大于2档,买一({buy1_price})涨停({limit_up_price})"
        else:
            if dif > 0.03001:
                return False, True, f"买1剩余档数大于3档,买一({buy1_price})涨停({limit_up_price})"
        # dif = float(limit_up_price) - float(buy1_price)
        # if zyltgb >= 100 * 100000000:
        #     # 大于2档
        #     if dif > 0.01001:
        #         return False, True, f"买1剩余档数大于1档,买一({buy1_price})涨停({limit_up_price})"
        # elif zyltgb >= 80 * 100000000:
        #     # 大于2档
        #     if dif > 0.02001:
        #         return False, True, f"买1剩余档数大于2档,买一({buy1_price})涨停({limit_up_price})"
        # elif zyltgb >= 60 * 100000000:
        #     # 大于2档
        #     if dif > 0.03001:
        #         return False, True, f"买1剩余档数大于3档,买一({buy1_price})涨停({limit_up_price})"
        # elif zyltgb >= 40 * 100000000:
        #     # 大于2档
        #     if dif > 0.04001:
        #         return False, True, f"买1剩余档数大于4档,买一({buy1_price})涨停({limit_up_price})"
        # else:
        #     if dif > 0.05001:
        #         return False, True, f"买1剩余档数大于5档,买一({buy1_price})涨停({limit_up_price})"
        limit_up_info = code_price_manager.Buy1PriceManager.get_limit_up_info(code)
        if limit_up_info[0] is None and False:
@@ -721,50 +733,33 @@
                                      cls.__l2PlaceOrderParamsManagerDict[code].score_info)
        if not gpcode_manager.WantBuyCodesManager.is_in(code):
            if float(limit_up_price) >= 40:
                return False, True, "股价大于40块"
            # 判断板块
            plate_can_buy, msg = CodePlateKeyBuyManager.can_buy(code)
            if not plate_can_buy:
                return False, True, msg
            # 查看分数等级
            score_index = cls.__l2PlaceOrderParamsManagerDict[code].score_index
            score = cls.__l2PlaceOrderParamsManagerDict[code].score
            score_info = cls.__l2PlaceOrderParamsManagerDict[code].score_info
            # 区分大票,小票
            if zyltgb >= 80 * 100000000:
                if cls.volume_rate_info[code][0] < 0.5:
                    return False, True, f"大市值:量大于50%才下单,量比:{cls.volume_rate_info[code][0]}"
            elif zyltgb <= 35 * 100000000:
                # 获取板块中的票的数量
                if score_info[1][5]["limit_up_codes_count"] < 2:
                    return False, True, f"小市值:板块中必须2个涨停才能买,板块{score_info[1][5]['target_block_info'][0]}-涨停数{score_info[1][5]['limit_up_codes_count']}"
            # 尾盘偷跑票
            limit_up_time = score_info[1][7]
            if limit_up_time is None:
                limit_up_time = tool.get_now_time_str()
            # 尾盘偷跑暂时不要
            # if int(limit_up_time.replace(":", "")) > int("143000"):
            #     if not score_info[1][3][6][0]:
            #         return False, True, f"尾盘偷跑:无任何形态"
            #     if score_info[1][5]["limit_up_codes_count"] > 1:
            #         return False, True, f"尾盘偷跑:板块{score_info[1][5]['target_block_info'][0]}-涨停数{score_info[1][5]['limit_up_codes_count']}"
            #     if float(gpcode_manager.get_limit_up_price(code)) > 30:
            #         return False, True, f"尾盘偷跑:股价大于30"
            if score_index < 0:
                return False, True, f"分值:{score}未达到需要买入的分数线"
            # if score_index >= 3:
            #     return False, True, f"分值:{score}未达到主动买入分数线"
            return True, False, ""
            return cls.can_buy_first(code, limit_up_price, score_index, score, score_info, cls.volume_rate_info[code])
        else:
            return True, False, "在想买名单中"
    @classmethod
    def can_buy_first(cls, code, limit_up_price, score_index, score, score_info, volume_rate_info):
        if float(limit_up_price) >= 40:
            return False, True, "股价大于40块"
        # 判断板块
        plate_can_buy, msg = CodePlateKeyBuyManager.can_buy(code)
        if not plate_can_buy:
            return False, True, msg
        if volume_rate_info[0] < 0.4:
            return False, True, f"量大于40%才下单,量比:{volume_rate_info[0]}"
        # 是否有K线形态(有K线形态或者天量大阳)
        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, ""
    @classmethod
    def __cancel_buy(cls, code):
@@ -1092,8 +1087,8 @@
            data = total_datas[i]
            _val = total_datas[i]["val"]
            trigger_buy = False
            # 必须为连续3秒内的数据
            if L2DataUtil.get_time_as_second(_val["time"]) - buy_single_time_seconds > max_space_time:
            # 必须为连续2秒内的数据
            if L2DataUtil.get_time_as_second(_val["time"]) - buy_single_time_seconds + 1 > max_space_time:
                TradePointManager.delete_buy_point(code)
                if i == compute_end_index:
                    # 数据处理完毕