up
Some checks are pending
Update Docker Hub Description / dockerHubDescription (push) Waiting to run
Some checks are pending
Update Docker Hub Description / dockerHubDescription (push) Waiting to run
This commit is contained in:
parent
619de5cede
commit
3fafbff8c3
@ -143,10 +143,10 @@ class FreqaiExampleStrategy(IStrategy):
|
||||
try:
|
||||
label_period = self.freqai_info["feature_parameters"]["label_period_candles"]
|
||||
|
||||
# 生成更复杂的目标变量 up_or_down
|
||||
dataframe["up_or_down"] = np.where(
|
||||
dataframe["close"].shift(-label_period) > dataframe["close"], 1, 0
|
||||
)
|
||||
# 重新定义目标变量 up_or_down,预测未来价格变化方向
|
||||
dataframe["up_or_down"] = np.where(
|
||||
dataframe["close"].shift(-label_period) / dataframe["close"] - 1 > 0, 1, 0
|
||||
)
|
||||
# 确保目标变量是二维数组
|
||||
if dataframe["up_or_down"].ndim == 1:
|
||||
dataframe["up_or_down"] = dataframe["up_or_down"].values.reshape(-1, 1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user