| | |
| | | import cProfile |
| | | import io |
| | | import logging |
| | | import time as t |
| | | |
| | |
| | | |
| | | # TODO l2数据管理 |
| | | from trade.trade_data_manager import CodeActualPriceProcessor |
| | | |
| | | from line_profiler import LineProfiler |
| | | |
| | | |
| | | import dask |
| | | |
| | |
| | | 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) |