diff --git a/deploy/profile-scripts/per_stock_reassess.py b/deploy/profile-scripts/per_stock_reassess.py index 47865da9..4f729da4 100644 --- a/deploy/profile-scripts/per_stock_reassess.py +++ b/deploy/profile-scripts/per_stock_reassess.py @@ -360,7 +360,7 @@ def main(): "strategy_type": "自选策略" if entry.get("type", "") in ("自选策略", "watchlist") else "持仓策略", "action": result.get("action", ""), "timing_signal": result.get("timing_signal", entry.get("timing_signal", "")), - "rr_ratio": result.get("rr_ratio", entry.get("rr_ratio", 0)), + "rr_ratio": (result.get("rr_ratio") or entry.get("rr_ratio") or 0), "tech_snapshot": result.get("tech_snapshot", entry.get("tech_snapshot", "")), "stock_category": result.get("stock_category", entry.get("stock_category", "")), "sector_context": result.get("sector_context", entry.get("sector_context", "")), @@ -457,7 +457,7 @@ def main(): "take_profit": result.get("take_profit"), "tech_snapshot": result.get("tech_snapshot", entry.get("tech_snapshot")), "timing_signal": result.get("timing_signal", entry.get("timing_signal")), - "rr_ratio": result.get("rr_ratio", entry.get("rr_ratio", 0)), + "rr_ratio": (result.get("rr_ratio") or entry.get("rr_ratio") or 0), "status": result.get("status", "updated"), "price": price, "currency": "HKD" if is_hk else "CNY", diff --git a/deploy/profile-scripts/strategy_lifecycle.py b/deploy/profile-scripts/strategy_lifecycle.py index 23095a43..1022a274 100644 --- a/deploy/profile-scripts/strategy_lifecycle.py +++ b/deploy/profile-scripts/strategy_lifecycle.py @@ -2083,7 +2083,7 @@ def reassess_with_context(code, name, price, cost, shares, current_action, fundamentals=fund, news_sentiment=news_sentiment, portfolio_context=_get_portfolio_risk_state(), - rr_ratio=result.get("rr_ratio", 0), + rr_ratio=(result.get("rr_ratio") or 0), market_regime=market_regime, ) result["timing_signal"] = enriched @@ -2444,7 +2444,7 @@ def regenerate_all(stdout=True): is_new_entry=(source == "watchlist"), fundamentals=fund, news_sentiment=news_sentiment, - rr_ratio=result.get("rr_ratio", 0), + rr_ratio=(result.get("rr_ratio") or 0), market_regime=(market_regime_hk if (market_regime_hk and _mkt_of(code) == 'hk') else market_regime), ) result["timing_signal"] = enriched