Administrator
2025-05-21 59f746fc801513c4a9b59030216c0b8e2d3073da
L2大单解析
1个文件已修改
9 ■■■■■ 已修改文件
l2_data_parser.py 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2_data_parser.py
@@ -49,16 +49,25 @@
    fdatas = []
    with open(f"{base_path}/Transaction.csv", 'r', encoding='utf-8') as file:
        csv_reader = csv.reader(file)
        total_lines = csv_reader.line_num
        print("总行数:", total_lines)
        # 获取表头:: [ExchangeID,SecurityID,TradeTime,TradePrice,TradeVolume,ExecType,MainSeq,SubSeq,BuyNo,SellNo,Info1,Info2,Info3,TradeBSFlag,BizIndex,LocalTimeStamp]
        headers = next(csv_reader)
        print("表头:", headers)
        # 遍历数据行
        _path = f"{base_path}/Transaction_filter.csv"
        percent = 0
        with open(_path, 'w', newline='', encoding='utf-8') as csvfile:
            # 创建一个 CSV 写入器对象
            writer = csv.writer(csvfile)
            # 逐行写入数据
            count = 0
            for row in csv_reader:
                count += 1
                p = count * 100 // total_lines
                if p != percent:
                    percent = p
                    print(f"**进度:{percent}%")
                if row[1] not in target_codes and not parse_all:
                    continue
                # 将文件写入到文本