Administrator
2023-07-28 505c311389bd7ba203ee16b470259928c9f4ebe0
bug修复
1个文件已修改
20 ■■■■■ 已修改文件
l2/l2_data_manager_new.py 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py
@@ -1,4 +1,4 @@
import cProfile
import io
import logging
import time as t
@@ -26,6 +26,9 @@
# TODO l2数据管理
from trade.trade_data_manager import CodeActualPriceProcessor
from line_profiler import LineProfiler
import dask
@@ -240,15 +243,16 @@
            if place_order_index:
                logger_l2_process.info("code:{} 获取到下单真实位置:{}", code, place_order_index)
                DCancelBigNumComputer.set_real_order_index(code, place_order_index)
            __start_time = round(t.time() * 1000)
            pr = cProfile.Profile()
            pr.enable()
            cls.process_add_datas(code, datas, 0, __start_time)
            pr.disable()
            pr.print_stats()
            pr.dump_stats(f"/home/logs/profile/{code}_{round(t.time() * 1000)}.log")
            lp = LineProfiler()
            lp_wrap = lp(cls.process_add_datas)
            lp_wrap(code, datas, 0, __start_time)
            output = io.StringIO()
            lp.print_stats(stream=output)
            with open(f"/home/logs/profile/{code}_{round(t.time() * 1000)}.txt",'w') as f:
                f.write(output.getvalue())
            # lp.dump_stats(f"/home/logs/profile/{code}_{round(t.time() * 1000)}.txt")
        except Exception as e:
            print("huaxin L2数据处理异常", code, str(e))
            logging.exception(e)