Enhance trading workflow with new order flow management

- Added dingdanliu_nb_mflow for improved order processing
- Updated related scripts and configurations to support new functionality
This commit is contained in:
Win_home
2025-03-15 22:45:08 +08:00
parent e2c54c6409
commit f925dff46b
21 changed files with 5345 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import pandas as pd
# 读取上传的CSV文件
file_path = 'C:/Users/zhouj/Desktop/a次主力连续_20190103.csv'
df = pd.read_csv(file_path, encoding='gbk')
# 重命名列以便处理
df.rename(columns={'时间': 'datetime', '最新': 'price', '成交量': 'volume'}, inplace=True)
# 确保datetime列是datetime类型
df['datetime'] = pd.to_datetime(df['datetime'])
# 设置datetime列为索引
df.set_index('datetime', inplace=True)
# 使用resample方法将数据重新采样为1分钟数据
df_resampled = df.resample('1T').agg({
'price': ['first', 'max', 'min', 'last'],
'volume': 'sum'
})
# 重命名列名以符合K线数据的标准命名
df_resampled.columns = ['open', 'high', 'low', 'close', 'volume']
# 删除存在NA值的行如果有的时间段没有交易数据
df_resampled.dropna(inplace=True)
# 将重新采样的数据写入新的CSV文件
output_file = 'C:/Users/zhouj/Desktop/tic_data_1min.csv'
df_resampled.to_csv(output_file)
print(f'1分钟历史数据已保存至{output_file}')