fix: 重评算不出RR时保留原值(rr_ratio清零bug,300668教训)

This commit is contained in:
xxm
2026-08-17 18:05:39 +08:00
parent b71a95f673
commit 9d12b7b0d5
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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",
+2 -2
View File
@@ -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