我正在尝试迭代,但无法确定如何迭代。有.csv文件。
问题:所以我找到了LOW_num的数据[0],并且得到了TOP_num的TOP_num数据[0]<LOW_num的数据[0]公式可能是什么?示例:
for line in file:
data = line.split(sep)
一条线看起来像这样:
2022-04-05T08:34:39+02:00, 1.2024, 1.2024, 1.2024, 1.2024, 1.2185, 1.2059028833000065, 1.2024784243912705, 1.2004400559932131, 1.198116316019428
所以data[0]表示列A,data[1]表示列B,data[2]表示列C,(…(
memory["high"] = {}
memory["low"] = {}
for line in file:
data = line.split(sep)
if data[5] < data[9]:
memory["high"][float(data[2])] = str(data[0])
memory["low"][float(data[3])] = str(data[0])
# those are collecing data[2] and data[3] only between events when
# values changes from column F > J, to F < J, in that .csv file
则在相同的";对于文件中的行:";,但如果不同:
LOW_num = min(memory["low"]) # it gets lowest number of all collected data[3] (Column D)
TOP_num = max(memory["high"]) # it gets biggest number of all collected data[2] (Column C)
#so TOP_num is for example: "1.555"
#but that TOP_num got day, month, and year attached to it as well:
#ex: memory["high"]["1.555"]["2022-04-05T08:34:39+02:00"]
TOP_data0 = str(memory["high"][TOP_num])
LOW_data0 = str(memory["low"][LOW_num])
我试过一些东西,但都做不好,例如:
for i in memory["high"][i][j]:
if memory["high"][i][memory["high"][TOP_num][TOP_data0] < memory["low"][LOW_num]LOW_data0]:
print(memory["high"][i][TOP_num])
.csv文件表示一些硬币的价格数据,例如来自交易所的ADAUSDT,(时间,打开,高,低,关闭,somming,sommings,somming.(我找到给定时间段的最低价格(Low_num(,从之前的某个起始价格开始。并且必须找到这些起点和Low_num点之间的最大价格。这个大价格是必须设置的止损数字,为了达到这个例子的最低点,它是一个空头。
明白了!
memory["SL"] = {}
for number in memory["high"]:
if number > LOW_num: # so its only numbers higher than Lowest obviously
x = number
if memory["high"][x] < LOW_data0: # and among them, with date only earlier than LOW_date0
memory["SL"][x] = str(memory["high"][x]) # and saving it to new memory set for later max() or min() upon it
哇,蟒蛇可以比较日期!