| | |
| | | # 将文件写入到文本 |
| | | writer.writerow(row) |
| | | |
| | | |
| | | def test1(args): |
| | | index, df = args |
| | | print(index) |
| | | |
| | | |
| | | def pre_process_transactions(csv_path="E:/测试数据/Transaction_Test.csv"): |
| | | def str_to_float(s): |
| | |
| | | 'EndTime': group['TradeTime'].iloc[-1], |
| | | 'EndPrice': group['TradePrice'].iloc[-1] |
| | | }) |
| | | |
| | | |
| | | |
| | | |
| | | dtype = { |
| | | 'SecurityID': 'category', # 低基数分类数据 |
| | |
| | | print(f"处理完毕,总共{index}批") |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | if __name__ == '__main__1': |
| | | # df = pd.read_csv(f"E:/测试数据/Transaction_Test.csv") |
| | | pre_process_transactions() |
| | | |
| | | # 命令模式 /home/userzjj/app/gp-server/l2_data_parser Transaction 2025-05-08 |
| | | # 解析大单: /home/userzjj/app/gp-server/l2_data_parser ExtractDealBigOrder 2025-05-09 /home/userzjj/最终成交数据20250509.txt 000555 |
| | | if __name__ == '__main__1': |
| | | if __name__ == '__main__': |
| | | if len(sys.argv) > 1: |
| | | params = sys.argv[1:] |
| | | print("接收的参数", params) |
| | |
| | | elif _type == 'MarketData': |
| | | parse_market_data(day) |
| | | elif _type == 'Transaction_New': |
| | | transaction_big_order_parser.pre_process_transactions(f"/home/userzjj/ftp/{day}/Transaction.csv") |
| | | if len(params) > 2: |
| | | process_count = int(params[2].strip()) |
| | | else: |
| | | process_count = 4 |
| | | |
| | | transaction_big_order_parser.pre_process_transactions(f"/home/userzjj/ftp/{day}/Transaction.csv", |
| | | process_count=process_count) |
| | | transaction_big_order_parser.concat_pre_transactions(f"/home/userzjj/ftp/{day}/Transaction") |
| | | elif _type == 'NGTSTick_New': |
| | | transaction_big_order_parser.pre_process_ngtsticks(f"/home/userzjj/ftp/{day}/NGTSTick.csv") |
| | | transaction_big_order_parser.concat_pre_transactions(f"/home/userzjj/ftp/{day}/NGTSTick") |
| | | elif _type == 'ExtractDealBigOrder': |
| | | # 提取所有成交的大单 |
| | | if len(params) > 2: |
| | | save_path = params[2].strip() |
| | | process_count = int(params[2].strip()) |
| | | else: |
| | | save_path = None |
| | | |
| | | if len(params) > 3: |
| | | target_code = params[3].strip() |
| | | process_count = 4 |
| | | transaction_big_order_parser.pre_process_ngtsticks(f"/home/userzjj/ftp/{day}/NGTSTick.csv", |
| | | process_count=process_count) |
| | | transaction_big_order_parser.concat_pre_ngtsticks(f"/home/userzjj/ftp/{day}/NGTSTick") |
| | | elif _type == 'Transaction_Concat': |
| | | transaction_big_order_parser.concat_pre_transactions(f"/home/userzjj/ftp/{day}/Transaction") |
| | | elif _type == 'NGTSTick_Concat': |
| | | transaction_big_order_parser.concat_pre_ngtsticks(f"/home/userzjj/ftp/{day}/NGTSTick") |
| | | elif _type == 'ExtractDealBigOrder': |
| | | # 命令模式 /home/userzjj/app/gp-server/l2_data_parser ExtractDealBigOrder 2025-05-09 |
| | | if len(params) > 2: |
| | | process_count = int(params[2].strip()) |
| | | else: |
| | | target_code = None |
| | | parse_deal_big_orders(day, save_path, target_code) |
| | | process_count = 10 |
| | | transaction_big_order_parser.extract_big_order_of_all(f"/home/userzjj/ftp/{day}/NGTSTick", |
| | | process_count=process_count) |
| | | transaction_big_order_parser.extract_big_order_of_all(f"/home/userzjj/ftp/{day}/Transaction", |
| | | process_count=process_count) |