Files
lm_code/回测数据/main.py
2025-09-25 18:29:53 +08:00

40 lines
936 B
Python

import pandas as pd
if __name__ == '__main__':
# 读取 Excel 文件
file_path = 'kline_data.xlsx'
df = pd.read_excel(file_path, )
# 逐行读取数据
ls = {}
for index, row in df.iterrows():
# print(row)
id = row['id']
open = row['open']
close = row['close']
# ls[str(int(id))] = {'open': float(open), 'close': float(close)}
# # 根据键进行排序
# sorted_data = dict(sorted(ls.items()))
#
# low_data = None
# new_data = None
# for _, i in enumerate(sorted_data):
# if _:
#
# # 跳过第一个
# if not low_data:
# low_data = i
#
# continue
#
# if sorted_data[i]["open"] > low_data[low_data]["open"]:
# if sorted_data[i]["close"] > low_data[low_data]["close"]:
# print(low_data)
# print(i)