Administrator
2024-04-10 9a8a924d75fd4e29c4c14c86c041c00ba89f615a
l2/cancel_buy_strategy.py
@@ -235,17 +235,34 @@
    # 是否有大卖单需要撤
    def __need_cancel_for_big_sell_order(self, code, big_sell_order_info, order_begin_pos: OrderBeginPosInfo):
        total_deal_money = sum([x[1] * x[2] for x in big_sell_order_info[1]])
        # 需要排除成交时间在下单时间之前的
        total_deal_money = 0
        total_datas = local_today_datas.get(code)
        real_order_index_info = self.__get_real_place_order_index_info_cache(code)
        real_order_time_ms = None
        if real_order_index_info and not real_order_index_info[1]:
            real_order_index = real_order_index_info[0]
            real_order_time_ms = total_datas[real_order_index]["val"]["time"] + ".{0:0>3}".format(
                total_datas[real_order_index]["val"]["tms"])
        for x in big_sell_order_info[1]:
            deal_time = l2_huaxin_util.convert_time(x[4][0], with_ms=True)
            if real_order_time_ms:
                if tool.trade_time_sub_with_ms(deal_time, real_order_time_ms) >= 0:
                    total_deal_money += x[1] * x[2]
            else:
                total_deal_money += x[1] * x[2]
        # 判断是否为激进下单
        threash_money_w = 299
        if order_begin_pos.mode == OrderBeginPosInfo.MODE_ACTIVE:
            try:
                total_datas = local_today_datas.get(code)
                # 真实成交位距离真实下单位,10笔以内且金额≤1000万 , 且在180s内
                trade_index, is_default = TradeBuyQueue().get_traded_index(code)
                if trade_index is None:
                    trade_index = 0
                real_order_index_info = self.__get_real_place_order_index_info_cache(code)
                limit_up_price = gpcode_manager.get_limit_up_price(code)
                if real_order_index_info and not real_order_index_info[1]:
                    real_order_index = real_order_index_info[0]
@@ -1694,7 +1711,8 @@
                if dealing_info and str(dealing_info[0]) == str(val["orderNo"]):
                    total_left_num -= dealing_info[1] // 100
        limit_up_price = gpcode_manager.get_limit_up_price(code)
        if total_left_count <= THRESHOLD_COUNT and limit_up_price and total_left_num * float(limit_up_price) < 300 * 100:
        if total_left_count <= THRESHOLD_COUNT and limit_up_price and total_left_num * float(
                limit_up_price) < 300 * 100:
            return True, f"剩余笔数({total_left_count})/金额({round(total_left_num * float(limit_up_price) * 100)})不足,成交进度:{trade_index},真实下单位置:{real_order_index}"
        return False, "不满足撤单条件"