Administrator
2023-08-24 73c75c86b60513e0c8f5d19ccfed78064af5f47c
l2/cancel_buy_strategy.py
@@ -105,6 +105,12 @@
            return cache_result[1]
        return None
    def get_real_place_order_index_cache(self, code):
        cache_result = CodeDataCacheUtil.get_cache(self.__s_cancel_real_place_order_index_cache, code)
        if cache_result[0]:
            return cache_result[1]
        return None
    def __clear_data(self, code):
        CodeDataCacheUtil.clear_cache(self.__s_big_num_cancel_compute_data_cache, code)
        CodeDataCacheUtil.clear_cache(self.__s_cancel_real_place_order_index_cache, code)
@@ -1081,6 +1087,37 @@
        self.clear(code)
# ---------------------------------G撤-------------------------------
class GCancelBigNumComputer:
    __SecondCancelBigNumComputer = SecondCancelBigNumComputer()
    # 开始撤单
    def start_cancel(self, code, buy_no, total_datas, buy_order_no_map, local_operate_map, m_val_num):
        place_order_index = self.__SecondCancelBigNumComputer.get_real_place_order_index_cache(code)
        if place_order_index is None:
            raise Exception("未获取到下单真实位置")
        buy_data = buy_order_no_map.get(buy_no)
        if not buy_data:
            raise Exception("尚未获取到撤买单详情数据")
        # 从成交位置到下单位置计算m值
        transaction_index = buy_data["index"]
        need_cancel = True
        buy_nums = 0
        for index in range(transaction_index + 1, place_order_index):
            data = total_datas[index]
            if L2DataUtil.is_limit_up_price_buy(data["val"]):
                # 获取是否在买入执行信号周围2s
                left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count(code, index, data,
                                                                                                      local_operate_map)
                if left_count > 0:
                    buy_nums += left_count * data["val"]["num"]
                    if buy_nums > m_val_num:
                        break
        if buy_nums > m_val_num:
            need_cancel = False
        return need_cancel, f"成交进度位({transaction_index})-真实下单位({place_order_index})  纯买手数:{buy_nums}/m值手数:{m_val_num}"
# --------------------------------封单额变化撤------------------------
# 涨停封单额统计
class L2LimitUpMoneyStatisticUtil: