with v3
This commit is contained in:
parent
e27cde2e19
commit
80394be9d4
@ -164,6 +164,11 @@ class FreqaiExampleStrategy(IStrategy):
|
||||
# 处理异常值
|
||||
dataframe["target"] = dataframe["target"].clip(-0.1, 0.1)
|
||||
|
||||
# 创建 up_or_down 列
|
||||
dataframe["up_or_down"] = np.where(
|
||||
dataframe["close"].shift(-label_period) > dataframe["close"], 1, 0
|
||||
)
|
||||
|
||||
# 数据清理:处理 NaN 和 Inf 值
|
||||
dataframe["up_or_down"] = dataframe["up_or_down"].replace([np.inf, -np.inf], np.nan)
|
||||
dataframe["up_or_down"] = dataframe["up_or_down"].ffill().fillna(0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user