Administrator
2024-04-16 5908302c29d024b2d1563f32bc3e89d6779c287c
S快砸比例限制
2个文件已修改
45 ■■■■■ 已修改文件
l2/cancel_buy_strategy.py 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py
@@ -300,24 +300,25 @@
            else:
                total_deal_money += x[1] * x[2]
        limit_up_price = gpcode_manager.get_limit_up_price(code)
        # 判断是否为激进下单
        threash_money_w = 299
        total_fast_num = 0
        if order_begin_pos.mode == OrderBeginPosInfo.MODE_ACTIVE:
            try:
                # 真实成交位距离真实下单位,10笔以内且金额≤1000万 , 且在180s内
                trade_index, is_default = TradeBuyQueue().get_traded_index(code)
                if trade_index is None:
                    trade_index = 0
                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]
                    start_order_no = big_sell_order_info[1][-1][4][1]
                    sell_time_str = l2_huaxin_util.convert_time(big_sell_order_info[1][-1][4][0], with_ms=False)
                    if tool.trade_time_sub(sell_time_str, total_datas[real_order_index]["val"]["time"]) < 180:
                        total_num = 0
                        total_count = 0
                    # 开始第一笔成交数据
                    fdeal = big_sell_order_info[1][0][3]
                    start_order_no = fdeal[1]
                    sell_time_str = l2_huaxin_util.convert_time(fdeal[0], with_ms=False)
                    is_s_slow_timw = tool.trade_time_sub(sell_time_str, total_datas[real_order_index]["val"]["time"]) < 180
                    total_slow_num = 0
                    total_slow_count = 0
                        # 获取正在成交的数据
                        dealing_info = HuaXinBuyOrderManager.get_dealing_order_info(code)
                        for i in range(trade_index, real_order_index):
@@ -329,7 +330,8 @@
                                    total_datas[trade_index]["val"]["orderNo"]) == str(
                                dealing_info[0]):
                                # 减去当前正在成交的数据中已经成交了的数据
                                total_num -= dealing_info[1] // 100
                            if is_s_slow_timw:
                                total_slow_num -= dealing_info[1] // 100
                            left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(
                                code,
                                i,
@@ -337,14 +339,21 @@
                                local_today_canceled_buyno_map.get(
                                    code))
                            if left_count > 0:
                                total_num += val["num"]
                                total_count += 1
                        if total_count <= 10 and total_num * float(limit_up_price) < 1000 * 100:
                            if is_s_slow_timw:
                                total_slow_num += val["num"]
                                total_slow_count += 1
                            total_fast_num += val['num']
                    if total_slow_num * float(limit_up_price) < 800 * 100:
                            threash_money_w = 200
            except Exception as e:
                l2_log.s_cancel_debug(code, f"S撤激进下单计算大单卖阈值出错:{str(e)}")
        if total_deal_money >= threash_money_w * 10000:
            return True, f"近1s有大卖单({round(total_deal_money / 10000, 1)}万/{threash_money_w}万)"
        total_fast_money = int(total_fast_num*100*float(limit_up_price))
        if total_fast_money == 0:
            # 防止分母为0
            total_fast_money = 1
        rate = round(total_deal_money/total_fast_money ,2)
        if total_deal_money >= threash_money_w * 10000 and  rate >= 0.25:
            return True, f"近1s有大卖单({round(total_deal_money / 10000, 1)}万/{threash_money_w}万,成交占比:{total_deal_money}/{total_fast_money})"
        return False, f"无{threash_money_w}大单"
    #  big_sell_order_info格式:[总共的卖单金额, 大卖单详情列表]
l2/l2_data_manager_new.py
@@ -304,6 +304,13 @@
        trade_record_log_util.add_real_place_order_position_log(code, index, order_begin_pos.buy_single_index)
        l2_log.debug(code, "设置真实下单位:{}", index)
        cancel_buy_strategy.set_real_place_position(code, index, order_begin_pos.buy_single_index, is_default=False)
        # 获取真实下单位置之后需要判断F撤
        try:
            cancel_result = cancel_buy_strategy.FCancelBigNumComputer().need_cancel_for_deal_fast(code)
            if cancel_result[0]:
                L2TradeDataProcessor.cancel_buy(code, f"F撤:{cancel_result[1]}")
        except Exception as e:
            logger_debug.exception(e)
    # 处理华鑫L2数据
    @classmethod
@@ -399,6 +406,7 @@
                                pass
                            async_log_util.info(logger_l2_process, f"code:{code} 获取到下单真实位置:{place_order_index}")
                    # 处理涨停卖与涨停卖撤
                    try:
                        for d in add_datas: