Administrator
2024-04-24 4b5c55d014c37e5b7538f7071053f608d25630c2
日志调整
1个文件已修改
12 ■■■■ 已修改文件
log_module/log_export.py 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
log_module/log_export.py
@@ -149,6 +149,7 @@
    pos_list = []
    with open("{}/logs/gp/l2/l2_trade.{}.log".format(constant.get_path_prefix(), date), mode='r',
              encoding="utf-8") as f:
        latest_single=[None, None]
        while True:
            line = f.readline()
            if not line:
@@ -164,13 +165,20 @@
                str_ = line.split("获取到买入信号起始点:")[1].strip()
                index = str_[0:str_.find(" ")].strip()
                # print("信号起始位置:", index)
                pos_list.append((0, int(index), ""))
                latest_single = [None, None]
                latest_single[0] = (0, int(index), "")
            elif line.find("获取到买入执行位置") > 0:
                str_ = line.split("获取到买入执行位置:")[1].strip()
                index = str_[0:str_.find(" ")].strip()
                # print("买入执行位置:", index)
                pos_list.append((1, int(index), ""))
                latest_single[1] = (1, int(index), "")
            elif line.find("开始执行买入") > 0:
                # 只有真正执行买入才会记录位置
                for p in latest_single:
                    if p:
                        pos_list.append(p)
                latest_single = [None,None]
            elif line.find("触发撤单,撤单位置:") > 0:
                str_ = line.split("触发撤单,撤单位置:")[1].strip()
                index = str_[0:str_.find(" ")].strip()