diff --git a/config_examples/config_freqai.okx.json b/config_examples/config_freqai.okx.json index c8ffea75..9f7f17a6 100644 --- a/config_examples/config_freqai.okx.json +++ b/config_examples/config_freqai.okx.json @@ -78,7 +78,7 @@ "include_corr_pairlist": ["BTC/USDT"], "label_period_candles": 10, "include_shifted_candles": 1, - "DI_threshold": 0.3, + "DI_threshold": 1.5, "weight_factor": 0.9, "principal_component_analysis": false, "use_SVM_to_remove_outliers": false, diff --git a/freqtrade/templates/FreqaiExampleStrategy.py b/freqtrade/templates/FreqaiExampleStrategy.py index 7a5ca70c..956ecb9f 100644 --- a/freqtrade/templates/FreqaiExampleStrategy.py +++ b/freqtrade/templates/FreqaiExampleStrategy.py @@ -179,9 +179,10 @@ class FreqaiExampleStrategy(IStrategy): 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 - ) + # Ensure the target variable is reshaped correctly + dataframe["up_or_down"] = np.where( + dataframe["close"].shift(-label_period) > dataframe["close"], 1, 0 + ).reshape(-1, 1) # Reshape to 2D array # 生成 %-volatility 特征 dataframe["%-volatility"] = dataframe["close"].pct_change().rolling(20).std() @@ -202,6 +203,8 @@ class FreqaiExampleStrategy(IStrategy): logger.error(f"创建 FreqAI 目标失败:{str(e)}") raise + # Log the shape of the target variable for debugging + logger.info(f"目标列形状:{dataframe['up_or_down'].shape}") logger.info(f"目标列预览:\n{dataframe[['up_or_down', '&-buy_rsi']].head().to_string()}") return dataframe