Administrator
2023-08-15 50e0bf45bb61db544cf334f2a002b1c0dc7b3fff
++++++++++++++++
bug修复-
2个文件已修改
44 ■■■■ 已修改文件
huaxin_api/l2_client.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_api/l2_client.py
@@ -467,7 +467,7 @@
class MyL2ActionCallback(L2ActionCallback):
    def OnSetL2Position(self, client_id, request_id, codes_data):
        print("接受到命令", client_id, request_id, codes_data)
        print("L2订阅数量:", len(codes_data))
        try:
            spi.set_codes_data(codes_data)
        except Exception as e:
l2/l2_data_manager_new.py
@@ -408,7 +408,7 @@
        if round(t.time() * 1000) - __start_time > 10:
            __start_time = l2_data_log.l2_time(code, round(t.time() * 1000) - __start_time,
                                               "获取m值数据耗时")
        if False:  # end_index - start_index < 10:
        if True:  # end_index - start_index < 10:
            cls.__start_compute_buy(code, start_index, end_index, threshold_money, capture_time, is_first_code)
        else:
            # pass
@@ -614,17 +614,17 @@
                l2_log.debug(code, "有虚拟下单,无买撤信号,开始执行买入,执行位置:{},截图时间:{}", unreal_buy_info[0], capture_time)
                # unreal_buy_info 的内容格式为:(触法买操作下标,截图时间)
                # 真实下单
                # cls.__buy(code, unreal_buy_info[1], local_today_datas[code][unreal_buy_info[0]],
                #           unreal_buy_info[0], is_first_code)
                lp = LineProfiler()
                lp.enable()
                lp_wrap = lp(cls.__buy)
                lp_wrap(code, unreal_buy_info[1], local_today_datas[code][unreal_buy_info[0]],
                        unreal_buy_info[0], is_first_code)
                output = io.StringIO()
                lp.print_stats(stream=output)
                lp.disable()
                logger_profile.info(output.getvalue())
                cls.__buy(code, unreal_buy_info[1], local_today_datas[code][unreal_buy_info[0]],
                          unreal_buy_info[0], is_first_code)
                # lp = LineProfiler()
                # lp.enable()
                # lp_wrap = lp(cls.__buy)
                # lp_wrap(code, unreal_buy_info[1], local_today_datas[code][unreal_buy_info[0]],
                #         unreal_buy_info[0], is_first_code)
                # output = io.StringIO()
                # lp.print_stats(stream=output)
                # lp.disable()
                # logger_profile.info(output.getvalue())
                _start_time = l2_data_log.l2_time(code, tool.get_now_timestamp() - _start_time,
                                                  "已虚拟下单-执行真实下单 外部耗时")
@@ -1194,15 +1194,15 @@
                # 数据尚未处理完毕,进行下一步处理
                l2_log.debug(code, "数据尚未处理完毕,进行下一步处理,处理进度:{} end_index:{}", compute_index, compute_end_index)
                # 处理撤单步骤
                # cls.__process_order(code, compute_index + 1, compute_end_index, capture_time, is_first_code, False)
                lp = LineProfiler()
                lp.enable()
                lp_wrap = lp(cls.__process_order)
                lp_wrap(code, compute_index + 1, compute_end_index, capture_time, is_first_code, False)
                output = io.StringIO()
                lp.print_stats(stream=output)
                lp.disable()
                logger_profile.info(output.getvalue())
                cls.__process_order(code, compute_index + 1, compute_end_index, capture_time, is_first_code, False)
                # lp = LineProfiler()
                # lp.enable()
                # lp_wrap = lp(cls.__process_order)
                # lp_wrap(code, compute_index + 1, compute_end_index, capture_time, is_first_code, False)
                # output = io.StringIO()
                # lp.print_stats(stream=output)
                # lp.disable()
                # logger_profile.info(output.getvalue())
                _start_time = l2_data_log.l2_time(code, tool.get_now_timestamp() - _start_time,
                                                  f"处理撤单步骤耗时,范围:{compute_index + 1}-{compute_end_index}", force=True)