diff --git a/models/scheme_b_last_model.joblib b/models/scheme_b_last_model.joblib index 5791929..a92beb2 100644 Binary files a/models/scheme_b_last_model.joblib and b/models/scheme_b_last_model.joblib differ diff --git a/models/scheme_b_scaler.joblib b/models/scheme_b_scaler.joblib index 8313b4f..465dcce 100644 Binary files a/models/scheme_b_scaler.joblib and b/models/scheme_b_scaler.joblib differ diff --git a/strategy/ai_strategy.py b/strategy/ai_strategy.py index 78bd6c8..be4f0df 100644 --- a/strategy/ai_strategy.py +++ b/strategy/ai_strategy.py @@ -211,5 +211,11 @@ def get_live_signal(period: int = None, model_type: str = 'lightgbm', return 0 X_scaled = scaler.transform(X_last) X_scaled_df = pd.DataFrame(X_scaled, columns=feature_cols, index=X_last.index) - pred = model.predict(X_scaled_df) - return int(pred[0]) + proba = model.predict_proba(X_scaled_df)[0] # (p0, p1, p2) + pred = model.predict(X_scaled_df)[0] + confidence_threshold = MC.get('confidence_threshold', 0.45) + logger.info(f"方案B 预测概率: 观望={proba[0]:.2f} 做多={proba[1]:.2f} 做空={proba[2]:.2f} -> {int(pred)}") + if proba.max() < confidence_threshold: + logger.info(f"置信度 {proba.max():.2f} < {confidence_threshold},视为观望") + return 0 + return int(pred) diff --git a/四分之一,五分钟,反手条件充足.py b/四分之一,五分钟,反手条件充足.py index 6675e5e..4d84f6d 100644 --- a/四分之一,五分钟,反手条件充足.py +++ b/四分之一,五分钟,反手条件充足.py @@ -705,6 +705,7 @@ class BitmartFuturesTransaction: self.last_kline_time = current_15m_id logger.info(f"进入新 15m K 线: {current_15m_id}") raw = get_live_signal(period=15) + logger.info(f"方案B 信号: {raw} (0=观望 1=做多 2=做空), 当前持仓: {self.start}") if raw == 1: if self.start == 0: signal = ('long', current_price)