| | |
| | | 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: |
| | |
| | | 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() |