Administrator
2025-07-02 7b788df374ddbbaa0701b4b39ac5826ed473dfce
真实下单位置修改
1个文件已修改
22 ■■■■ 已修改文件
l2/huaxin/huaxin_delegate_postion_manager.py 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/huaxin/huaxin_delegate_postion_manager.py
@@ -227,15 +227,26 @@
            # 最大的时间差,最大的索引差, 数据
            # 深证与执行位置相差时间>=10ms以上,上证与执行位置相差时间>=100ms以上
            data_ = temp_volumes_info_list[0][2]
            MIN_SPCE_MS = 30 if tool.is_sh_code(code) else 10
            if tool.trade_time_sub_with_ms(L2DataUtil.get_time_with_ms(data_["val"]), exec_time_with_ms) < MIN_SPCE_MS:
                continue
            match_list.append((max_sub_time, max_sub_index, data_))
        if not match_list:
            # 没有找到真实下单位
            return None
        THRESHOLD_MIN_MS = 0 if tool.is_sz_code(code) else 70
        if strict_match and tool.is_sz_code(code) and len(match_list) == 1:
            # 防止下单下在本10ms
            # 严格匹配,且只匹配到1个数据
            pass
        else:
            MIN_SPCE_MS = 30 if tool.is_sh_code(code) else 10
            new_match_list = []
            for m in match_list:
                if tool.trade_time_sub_with_ms(L2DataUtil.get_time_with_ms(m[2]["val"]),
                                               exec_time_with_ms) < MIN_SPCE_MS:
                    # 与执行时间相差指定时间
                    continue
                new_match_list.append(m)
            match_list = new_match_list
        # 最合适的是时间相差为0,索引相差为1
        for m in match_list:
            if m[0] == 0 and m[1] == 1:
@@ -337,7 +348,8 @@
        order_info_list = order_info[0]  # [(量,价格, order_ref)]
        exec_data = order_info[1]
        place_order_data = cls.__compute_real_place_order_position(code, exec_data, order_info_list,
                                                                   total_datas[trade_index + 1:end_index], strict_match= True)
                                                                   total_datas[trade_index + 1:end_index],
                                                                   strict_match=True)
        if not place_order_data:
            return None
        real_place_index_info = place_order_data["index"], RELIABILITY_TYPE_REAL