s-ttp commited on
Commit
25ef76b
·
verified ·
1 Parent(s): 5431fe0

quality round 2: fund-aware concentration, candidate DCF signals, D/E normalization, cross-market disclosure, anchored health in plan

Browse files
Files changed (1) hide show
  1. src/revival.py +12 -1
src/revival.py CHANGED
@@ -91,11 +91,16 @@ def switch_pairs(holdings: list[dict], decisions: dict, candidates: list[dict])
91
  sma = g("sma200")
92
  return {"pe": g("pe"), "rev_growth": g("rev_growth"),
93
  "vs_200d": (price / sma - 1) if price and sma else None}
 
 
 
 
 
94
  pairs.append({
95
  "out": h["symbol"], "out_action": decisions[h["symbol"]]["action"],
96
  "in": cand["ticker"], "in_name": live.get("name") or cand["ticker"],
97
  "sector": cand.get("sector"), "same_sector": cand.get("sector") == sec,
98
- "signals": cand.get("signals", []),
99
  "compare": {"out": _snap(h["data"], h["data"].get("price")),
100
  "in": _snap(live, live.get("price"))},
101
  })
@@ -237,6 +242,12 @@ def build_plan(holdings, decisions, target, candidates, health, total_pl, cards,
237
  "orders": order_plan(holdings, target),
238
  "outlook": outlook(holdings, target, candidates),
239
  }
 
 
 
 
 
 
240
  story = narrative({k: v for k, v in plan.items()} | {"n_holdings": len(holdings)})
241
  plan["pitch"] = (story or {}).get("pitch") or (
242
  "This portfolio needs surgery, not encouragement — here is the path back." if mode == "revival"
 
91
  sma = g("sma200")
92
  return {"pe": g("pe"), "rev_growth": g("rev_growth"),
93
  "vs_200d": (price / sma - 1) if price and sma else None}
94
+ # candidate sources are US-listed; be honest when the exiting holding is not
95
+ cross_market = "." in h["symbol"] and "." not in cand["ticker"]
96
+ signals = list(cand.get("signals", []))
97
+ if cross_market:
98
+ signals.append("US-listed — needs US market access, or pick a comparable local name")
99
  pairs.append({
100
  "out": h["symbol"], "out_action": decisions[h["symbol"]]["action"],
101
  "in": cand["ticker"], "in_name": live.get("name") or cand["ticker"],
102
  "sector": cand.get("sector"), "same_sector": cand.get("sector") == sec,
103
+ "cross_market": cross_market, "signals": signals,
104
  "compare": {"out": _snap(h["data"], h["data"].get("price")),
105
  "in": _snap(live, live.get("price"))},
106
  })
 
242
  "orders": order_plan(holdings, target),
243
  "outlook": outlook(holdings, target, candidates),
244
  }
245
+ # anchor the "before" side to the REAL headline health score — the outlook's own
246
+ # estimate uses thinner inputs and quoting a different number than the gauge confuses
247
+ try:
248
+ plan["outlook"]["current"]["est_health"] = health
249
+ except Exception:
250
+ pass
251
  story = narrative({k: v for k, v in plan.items()} | {"n_holdings": len(holdings)})
252
  plan["pitch"] = (story or {}).get("pitch") or (
253
  "This portfolio needs surgery, not encouragement — here is the path back." if mode == "revival"