diff --git a/strategy_lifecycle.py b/strategy_lifecycle.py index b49ec37..bc78872 100644 --- a/strategy_lifecycle.py +++ b/strategy_lifecycle.py @@ -727,50 +727,50 @@ def reassess_strategy(code, name, price, cost, shares, current_action, if is_new_entry: # 新买入时机 if volume_signal == "主动买盘占优" and candlestick_sentiment == "bullish": - timing_signal = "量价齐升,可买入" + timing_signal = "买入" elif volume_signal == "主动卖盘占优": - timing_signal = "放量下跌,等企稳再入" + timing_signal = "观望" elif volume_signal == "买卖均衡" and ws and price <= ws * 1.03: - timing_signal = "缩量回踩支撑,可买入" + timing_signal = "买入" elif candlestick_sentiment == "bullish": - timing_signal = "阳线企稳,可买入" + timing_signal = "买入" elif ws and price < ws * 1.02: - timing_signal = "接近支撑位,关注" + timing_signal = "关注" else: # 已持仓时机(用于加仓/减仓参考) if is_short_term_strong_trend: # 短炒+强趋势:强趋势持有,禁止加仓信号 - timing_signal = "强趋势持" + timing_signal = "持有" elif profit_pct > 5: # 已盈利 if volume_signal == "主动买盘占优": - timing_signal = "放量走强,持有" + timing_signal = "持有" elif volume_signal == "主动卖盘占优" and not is_new_entry: - timing_signal = "获利盘涌出,关注" + timing_signal = "关注" else: timing_signal = "持有" elif profit_pct > 0: # 微盈 if volume_signal == "主动买盘占优": - timing_signal = "温和放量,持有" + timing_signal = "持有" elif ws and price <= ws * 1.02: - timing_signal = "回踩支撑,可加仓" + timing_signal = "加仓" else: timing_signal = "持有" else: # 浮亏 if volume_signal == "主动卖盘占优" and ss and price <= ss * 1.03: - timing_signal = "量价齐跌近强撑,关注" + timing_signal = "关注" elif volume_signal == "主动买盘占优" and sr_resist and price >= sr_resist * 0.97: - timing_signal = "放量上涨近强压,关注止盈" + timing_signal = "关注" elif volume_signal == "买卖均衡" and ws and price <= ws * 1.02: - timing_signal = "缩量回踩弱支撑,可加仓" + timing_signal = "加仓" else: timing_signal = "持有" # ----- 【v3.2新增】分类约束:弱势/深套禁止输出买入/加仓类信号 ----- if stock_category == "弱势" or is_deep_loss: - buy_signals = ["可加仓", "可买入", "可追", "买"] + buy_signals = ["买入", "加仓", "可追"] if any(s in timing_signal for s in buy_signals): old_signal = timing_signal timing_signal = "弱势持有" if stock_category == "弱势" else "深套持有" @@ -914,8 +914,7 @@ def _is_buy_signal(signal): """判断信号是否为买入/持有类(用于防洗盘)""" if not signal: return False - buy_keywords = ['买入', '持有', '加仓', '阳线企稳', '温和放量', '量价齐升', - '缩量回踩', '接近支撑', '关注', '回调机会', '价稳'] + buy_keywords = ['买入', '持有', '加仓', '关注'] for kw in buy_keywords: if kw in signal: return True @@ -1142,7 +1141,11 @@ def enrich_timing_signal(base_signal, macro_desc="", sector_note="", if not factors: return "信号不充分", [] - return ",".join(factors), factors + # 修改:信号保持干净(只取base_signal),不把全部因子拼进去 + # enriched 仍作为完整的可读描述保留在 factors_list 中 + # 调用方决定是否展示 factors + clean_signal = base_signal if base_signal and base_signal != "neutral" else factors[-1] + return clean_signal, factors def reassess_with_context(code, name, price, cost, shares, current_action, @@ -1185,6 +1188,7 @@ def reassess_with_context(code, name, price, cost, shares, current_action, portfolio_context=_get_portfolio_risk_state(), ) result["timing_signal"] = enriched + result["signal_factors"] = factors # 6. 防洗盘:信号不要一天一翻(2026-06-23) # 如果旧信号是买入/持有类,新信号是谨慎/等待类,但中期趋势未破→维持旧信号 @@ -1205,6 +1209,9 @@ def reassess_with_context(code, name, price, cost, shares, current_action, if has_uptrend: print(f" 防洗盘: {old_signal}→保持旧信号(中期趋势完整)") result["timing_signal"] = f"{old_signal}(正常回调价稳)" + sf = result.get("signal_factors") or [] + if "正常回调价稳" not in sf: + result["signal_factors"] = sf + ["正常回调价稳"] break except Exception as e: print(f" 防洗盘跳过: {e}")