Administrator
2024-08-01 8e4bcab6c531d9f7411ae26c77ea63b8e0c5154c
l2/cancel_buy_strategy.py
@@ -500,6 +500,7 @@
# ---------------------------------G撤-------------------------------
# 已不效
class GCancelBigNumComputer:
    __real_place_order_index_dict = {}
    __trade_progress_index_dict = {}
@@ -962,14 +963,18 @@
            start_index = traded_index + 1
        total_datas = local_today_datas.get(code)
        watch_indexes = set()
        for i in range(start_index, real_order_index):
        # 查找成交进度位到真实下单位置所有的索引
        watch_indexes_info = []
        limit_up_price = gpcode_manager.get_limit_up_price_as_num(code)
        big_num = int(l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code)) / (limit_up_price * 100))
        for i in range(start_index, real_order_index + 1):
            # 判断是否有未撤的大单
            data = total_datas[i]
            val = data["val"]
            if not L2DataUtil.is_limit_up_price_buy(val):
                continue
            if val["num"] * float(val["price"]) < 29900:
            if val["num"] < big_num:
                continue
            # 是否已撤单
            left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(code, i,
@@ -977,14 +982,28 @@
                                                                                                     local_today_canceled_buyno_map.get(
                                                                                                         code))
            if left_count > 0:
                watch_indexes.add(i)
                watch_indexes_info.append((i, val["num"]))
        # 当所有大单≤6笔时则G撤全部囊括
        #  大单>6笔时囊括其三分之一
        if len(watch_indexes_info) > 6:
            watch_indexes = set([x[0] for x in watch_indexes_info[:int(round(len(watch_indexes_info) / 3, 0))]])
            # 找出最大单
            max_info = watch_indexes_info[0]
            for mi in watch_indexes_info:
                if mi[1] > max_info[1]:
                    max_info = mi
            watch_indexes.add(max_info[0])
        else:
            watch_indexes = set([x[0] for x in watch_indexes_info])
        if watch_indexes:
            # 还有300万以上的大单没有撤单
            if from_real_order_index_changed or recompute:
                # 真实下单位改变后才会更新
                final_watch_indexes = origin_watch_index | watch_indexes
                self.__set_watch_index(code, final_watch_indexes)
                l2_log.g_cancel_debug(code, f"大单监听:{final_watch_indexes} 是否重新计算:{recompute}")
                l2_log.g_cancel_debug(code,
                                      f"大单监听:{final_watch_indexes} 是否重新计算:{recompute} 计算范围:{start_index}-{real_order_index}")
    def set_trade_progress(self, code, buy_single_index, index):
        # if self.__trade_progress_index_dict.get(code) != index: