Stable ROE bounded at the stable cost of equity plus 3 points (excess returns fade); midpoint ± tolerance guidance re-verified on the written figures
Browse files- engine/guidance.py +4 -1
- engine/predict_yearly.py +9 -1
- engine/report_model.py +5 -0
- engine/state_builder.py +1 -0
- engine/tests/test_valuation_fixes_1_5.py +23 -0
- engine/validation.py +5 -0
engine/guidance.py
CHANGED
|
@@ -369,8 +369,11 @@ def build_state(release, proposed, *, as_of=None, candidates=None):
|
|
| 369 |
unit, concept = m["unit"], m["concept"]
|
| 370 |
qt = Q.CONCEPT_QUANTITY.get(concept) or (Q.LEVEL if unit in Q.MONEY_UNITS + (Q.COUNT, Q.MULTIPLE) else None)
|
| 371 |
lo_raw, hi_raw = m.get("low"), m.get("high")
|
|
|
|
| 372 |
if m.get("midpoint") is not None and lo_raw is None and hi_raw is None:
|
| 373 |
mp, pm, pu = float(m["midpoint"]), float(m.get("plus_minus") or 0.0), m.get("plus_minus_unit")
|
|
|
|
|
|
|
| 374 |
if pu == "PERCENT":
|
| 375 |
d = mp * pm / 100.0 # relative tolerance
|
| 376 |
elif pu == "BASIS_POINTS": # absolute tolerance, in the figure's own unit
|
|
@@ -391,7 +394,7 @@ def build_state(release, proposed, *, as_of=None, candidates=None):
|
|
| 391 |
"per_share": unit == Q.USD_PER_SHARE,
|
| 392 |
"accounting_basis": {"GAAP": "GAAP", "NON_GAAP": "ADJUSTED"}.get(m.get("basis"), "UNSPECIFIED"),
|
| 393 |
"quote": _norm(m.get("quote"))[:400], "verified": True, "operator": _operator(m),
|
| 394 |
-
"normalized_from": m.get("normalized_from")}
|
| 395 |
row["rendered_value"] = render(row, "value_only")
|
| 396 |
row["rendered_full"] = render(row, "full")
|
| 397 |
# a revision the release states in the same sentence: raised, lowered or reaffirmed against the prior outlook
|
|
|
|
| 369 |
unit, concept = m["unit"], m["concept"]
|
| 370 |
qt = Q.CONCEPT_QUANTITY.get(concept) or (Q.LEVEL if unit in Q.MONEY_UNITS + (Q.COUNT, Q.MULTIPLE) else None)
|
| 371 |
lo_raw, hi_raw = m.get("low"), m.get("high")
|
| 372 |
+
written = None
|
| 373 |
if m.get("midpoint") is not None and lo_raw is None and hi_raw is None:
|
| 374 |
mp, pm, pu = float(m["midpoint"]), float(m.get("plus_minus") or 0.0), m.get("plus_minus_unit")
|
| 375 |
+
# the figures as WRITTEN ("$61.5 billion ± $1.5 billion"): re-verification reads these, not the range
|
| 376 |
+
written = {"midpoint": mp, "plus_minus": (pm if m.get("plus_minus") is not None else None), "plus_minus_unit": pu}
|
| 377 |
if pu == "PERCENT":
|
| 378 |
d = mp * pm / 100.0 # relative tolerance
|
| 379 |
elif pu == "BASIS_POINTS": # absolute tolerance, in the figure's own unit
|
|
|
|
| 394 |
"per_share": unit == Q.USD_PER_SHARE,
|
| 395 |
"accounting_basis": {"GAAP": "GAAP", "NON_GAAP": "ADJUSTED"}.get(m.get("basis"), "UNSPECIFIED"),
|
| 396 |
"quote": _norm(m.get("quote"))[:400], "verified": True, "operator": _operator(m),
|
| 397 |
+
"normalized_from": m.get("normalized_from"), "written": written}
|
| 398 |
row["rendered_value"] = render(row, "value_only")
|
| 399 |
row["rendered_full"] = render(row, "full")
|
| 400 |
# a revision the release states in the same sentence: raised, lowered or reaffirmed against the prior outlook
|
engine/predict_yearly.py
CHANGED
|
@@ -4201,6 +4201,8 @@ def _median_roe(data, overview):
|
|
| 4201 |
|
| 4202 |
HELD_NAV_MATERIAL = 0.25 # held crypto above this share of market value: price the operating business, add the holdings
|
| 4203 |
STABLE_BETA_BOUNDS = (0.8, 1.2) # his rule of thumb for a stable-growth beta (the story model applies the same bounds)
|
|
|
|
|
|
|
| 4204 |
|
| 4205 |
|
| 4206 |
def _net_capex_ttm(data):
|
|
@@ -4806,7 +4808,12 @@ def derive_fair_value(current_price, pred_fund, data, state=None):
|
|
| 4806 |
_ke_fin_st = float(np.clip(_rf + _beta_fin_st * _erp_fin, 0.055, 0.16))
|
| 4807 |
_roe0 = float(np.clip(_roe_med, -0.10, 0.45))
|
| 4808 |
_roe_ind = (_ist or {}).get("roe_eva") or (_ist or {}).get("roe")
|
| 4809 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4810 |
# today's payout: dividends per share over the trailing GAAP EPS from the filings (the provider's EPS field is
|
| 4811 |
# removed from the pricing view as unsourced, so DPS ÷ EPS never computed and every bank, insurer and utility
|
| 4812 |
# carried the 30% default: AEP pays out about 62%)
|
|
@@ -4826,6 +4833,7 @@ def derive_fair_value(current_price, pred_fund, data, state=None):
|
|
| 4826 |
"beta_basis": "industry equity beta (his levered beta for " + str(_di.get("industry")) + ")",
|
| 4827 |
"ke_initial": round(_ke_fin, 4), "ke_stable": round(_ke_fin_st, 4),
|
| 4828 |
"roe": round(_roe0, 3), "roe_stable": round(_roe_s, 3),
|
|
|
|
| 4829 |
"bvps": round(_bvps, 2), "justified_pb": round(_jpb, 2), "payout": round(_pay0, 3),
|
| 4830 |
"payout_stable": round(float(_er.get("payout_stable") or 0.0), 3),
|
| 4831 |
"pv_excess_returns": round(_er["pv_excess_returns"], 2),
|
|
|
|
| 4201 |
|
| 4202 |
HELD_NAV_MATERIAL = 0.25 # held crypto above this share of market value: price the operating business, add the holdings
|
| 4203 |
STABLE_BETA_BOUNDS = (0.8, 1.2) # his rule of thumb for a stable-growth beta (the story model applies the same bounds)
|
| 4204 |
+
STABLE_EXCESS_RETURN_MAX = 0.03 # stable ROE at most this far above the stable cost of equity: a durable franchise premium
|
| 4205 |
+
# of the size financials have earned over long periods, not a cyclical peak in perpetuity
|
| 4206 |
|
| 4207 |
|
| 4208 |
def _net_capex_ttm(data):
|
|
|
|
| 4808 |
_ke_fin_st = float(np.clip(_rf + _beta_fin_st * _erp_fin, 0.055, 0.16))
|
| 4809 |
_roe0 = float(np.clip(_roe_med, -0.10, 0.45))
|
| 4810 |
_roe_ind = (_ist or {}).get("roe_eva") or (_ist or {}).get("roe")
|
| 4811 |
+
# stable growth: excess returns fade (his rule). The stable ROE is the lower of the company's and the
|
| 4812 |
+
# industry's, never below the stable cost of equity and never more than STABLE_EXCESS_RETURN_MAX above it: an
|
| 4813 |
+
# industry ROE at a cyclical peak held in perpetuity at a 3-point ke − g spread valued ALL at 5.3x book (+141%)
|
| 4814 |
+
_roe_s_raw = min(_roe0, float(_roe_ind)) if _roe_ind is not None else _ke_fin_st
|
| 4815 |
+
_roe_s = float(max(_ke_fin_st, min(_roe_s_raw, _ke_fin_st + STABLE_EXCESS_RETURN_MAX)))
|
| 4816 |
+
_roe_s_bound = _roe_s < _roe_s_raw - 1e-9
|
| 4817 |
# today's payout: dividends per share over the trailing GAAP EPS from the filings (the provider's EPS field is
|
| 4818 |
# removed from the pricing view as unsourced, so DPS ÷ EPS never computed and every bank, insurer and utility
|
| 4819 |
# carried the 30% default: AEP pays out about 62%)
|
|
|
|
| 4833 |
"beta_basis": "industry equity beta (his levered beta for " + str(_di.get("industry")) + ")",
|
| 4834 |
"ke_initial": round(_ke_fin, 4), "ke_stable": round(_ke_fin_st, 4),
|
| 4835 |
"roe": round(_roe0, 3), "roe_stable": round(_roe_s, 3),
|
| 4836 |
+
"roe_stable_bounded": bool(_roe_s_bound), "roe_stable_unbounded": round(float(_roe_s_raw), 4),
|
| 4837 |
"bvps": round(_bvps, 2), "justified_pb": round(_jpb, 2), "payout": round(_pay0, 3),
|
| 4838 |
"payout_stable": round(float(_er.get("payout_stable") or 0.0), 3),
|
| 4839 |
"pv_excess_returns": round(_er["pv_excess_returns"], 2),
|
engine/report_model.py
CHANGED
|
@@ -518,6 +518,11 @@ def build_user_report(s, cat, prose, limitations):
|
|
| 518 |
[[r.t(_roe_words)],
|
| 519 |
[r.p(MI + "roe", C.PCT, "return on equity used"), r.t(" → "),
|
| 520 |
r.p(MI + "roe_stable", C.PCT, "stable return on equity")]],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 521 |
[[r.t("Cost of equity")], _kecell],
|
| 522 |
[[r.t("Stable growth")], [r.p(MI + "g_terminal", C.PCT, "stable growth")]]]
|
| 523 |
if _mi.get("payout") is not None:
|
|
|
|
| 518 |
[[r.t(_roe_words)],
|
| 519 |
[r.p(MI + "roe", C.PCT, "return on equity used"), r.t(" → "),
|
| 520 |
r.p(MI + "roe_stable", C.PCT, "stable return on equity")]],
|
| 521 |
+
] + ([[[r.t("Stable return on equity bounded: excess returns fade in stable growth, so it is held "
|
| 522 |
+
"within three points of the stable cost of equity (the lower of company and industry "
|
| 523 |
+
"before the bound)")],
|
| 524 |
+
[r.p(MI + "roe_stable_unbounded", C.PCT, "stable return on equity before the bound")]]]
|
| 525 |
+
if _mi.get("roe_stable_bounded") else []) + [
|
| 526 |
[[r.t("Cost of equity")], _kecell],
|
| 527 |
[[r.t("Stable growth")], [r.p(MI + "g_terminal", C.PCT, "stable growth")]]]
|
| 528 |
if _mi.get("payout") is not None:
|
engine/state_builder.py
CHANGED
|
@@ -590,6 +590,7 @@ def build_forecast_stage(state, *, pred_fund, fair_val, story, engine_run, engin
|
|
| 590 |
"high_growth_years", "roe", "roe_stable", "bvps", "justified_pb",
|
| 591 |
"payout", "pv_excess_returns", "pv_terminal_excess", "beta_basis",
|
| 592 |
"beta_stable", "ke_stable", "payout_stable",
|
|
|
|
| 593 |
"g1_trailing", "g1_trailing_basis", "affo")}
|
| 594 |
# bank metrics beside the book-value model (his excess-return valuation reads book value and its return)
|
| 595 |
_bmx = _bank_metrics(d, d.get("reconciled_historicals") or {}, dm) if dm.get("basis") == "book_roe" else {}
|
|
|
|
| 590 |
"high_growth_years", "roe", "roe_stable", "bvps", "justified_pb",
|
| 591 |
"payout", "pv_excess_returns", "pv_terminal_excess", "beta_basis",
|
| 592 |
"beta_stable", "ke_stable", "payout_stable",
|
| 593 |
+
"roe_stable_bounded", "roe_stable_unbounded",
|
| 594 |
"g1_trailing", "g1_trailing_basis", "affo")}
|
| 595 |
# bank metrics beside the book-value model (his excess-return valuation reads book value and its return)
|
| 596 |
_bmx = _bank_metrics(d, d.get("reconciled_historicals") or {}, dm) if dm.get("basis") == "book_roe" else {}
|
engine/tests/test_valuation_fixes_1_5.py
CHANGED
|
@@ -419,3 +419,26 @@ def test_operating_leases_are_debt_with_their_interest_added_back():
|
|
| 419 |
eb, la = lease["assumptions"]["equity_bridge"], lease["assumptions"]["lease_adjustment"]
|
| 420 |
assert eb["operating_leases"] == 2e9 and eb["debt"] == pytest.approx(4e9 + 2e9) and eb["debt_excluding_leases"] == 4e9
|
| 421 |
assert la["margin_shift"] > 0 and lease["assumptions"]["margin_target"] > base["assumptions"]["margin_target"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
eb, la = lease["assumptions"]["equity_bridge"], lease["assumptions"]["lease_adjustment"]
|
| 420 |
assert eb["operating_leases"] == 2e9 and eb["debt"] == pytest.approx(4e9 + 2e9) and eb["debt_excluding_leases"] == 4e9
|
| 421 |
assert la["margin_shift"] > 0 and lease["assumptions"]["margin_target"] > base["assumptions"]["margin_target"]
|
| 422 |
+
|
| 423 |
+
|
| 424 |
+
def test_guidance_written_as_midpoint_plus_minus_reverifies_on_what_was_written():
|
| 425 |
+
import guidance as gd
|
| 426 |
+
q = "Revenue | $61.5 billion ± $1.5 billion | | $61.5 billion ± $1.5 billion"
|
| 427 |
+
m = {"concept": "REVENUE", "label": "Revenue", "period_label": "Q2 fiscal 2027", "midpoint": 61.5, "plus_minus": 1.5,
|
| 428 |
+
"plus_minus_unit": "ABSOLUTE", "low": None, "high": None, "unit": "USD_BILLION", "operator": "POINT", "basis": "GAAP",
|
| 429 |
+
"quote": q}
|
| 430 |
+
row = gd.build_state({"text": q, "form": "8-K", "filed": "2026-12-17"}, {"metrics": [m]})["metrics"][0]
|
| 431 |
+
assert (row["raw_low"], row["raw_high"]) == (60.0, 63.0) and row["written"]["midpoint"] == 61.5
|
| 432 |
+
from types import SimpleNamespace
|
| 433 |
+
import validation as V
|
| 434 |
+
assert "written" in row and gd.verify({"concept": "REVENUE", "unit": row["raw_unit"], "label": "Revenue", "low": None,
|
| 435 |
+
"high": None, "midpoint": 61.5, "plus_minus": 1.5, "plus_minus_unit": "ABSOLUTE",
|
| 436 |
+
"quote": row["quote"], "operator": row["operator"]}, row["quote"]) == (True, "")
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
def test_the_stable_return_on_equity_is_bounded_above_the_cost_of_equity():
|
| 440 |
+
import predict_yearly as P
|
| 441 |
+
assert P.STABLE_EXCESS_RETURN_MAX == 0.03
|
| 442 |
+
peak = ve.excess_return_equity(122.29, 0.205, 0.187, 0.0682, 0.0492, 0.1, 5, ke_stable=0.0795)
|
| 443 |
+
bound = ve.excess_return_equity(122.29, 0.205, 0.0795 + 0.03, 0.0682, 0.0492, 0.1, 5, ke_stable=0.0795)
|
| 444 |
+
assert bound["value"] < 0.55 * peak["value"] and 2.0 < bound["implied_price_to_book"] < 3.0
|
engine/validation.py
CHANGED
|
@@ -244,6 +244,11 @@ def validate_data(s):
|
|
| 244 |
for m in rows:
|
| 245 |
prop = {"concept": m.get("concept"), "unit": m.get("raw_unit") or m.get("unit"), "label": m.get("label"),
|
| 246 |
"low": m.get("raw_low"), "high": m.get("raw_high"), "quote": m.get("quote"), "operator": m.get("operator")}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
ok, why = _g.verify(prop, m.get("quote") or "")
|
| 248 |
if not ok:
|
| 249 |
bad.append(f"{m.get('metric_id')}: {why}")
|
|
|
|
| 244 |
for m in rows:
|
| 245 |
prop = {"concept": m.get("concept"), "unit": m.get("raw_unit") or m.get("unit"), "label": m.get("label"),
|
| 246 |
"low": m.get("raw_low"), "high": m.get("raw_high"), "quote": m.get("quote"), "operator": m.get("operator")}
|
| 247 |
+
if m.get("written"):
|
| 248 |
+
# a guided "midpoint ± tolerance": the range is computed from what the release wrote; verify the written
|
| 249 |
+
# figures (MU: "$61.5 billion ± $1.5 billion" stored as 60–63 and withheld for "60 not in the quote")
|
| 250 |
+
prop.update(low=None, high=None, midpoint=m["written"].get("midpoint"),
|
| 251 |
+
plus_minus=m["written"].get("plus_minus"), plus_minus_unit=m["written"].get("plus_minus_unit"))
|
| 252 |
ok, why = _g.verify(prop, m.get("quote") or "")
|
| 253 |
if not ok:
|
| 254 |
bad.append(f"{m.get('metric_id')}: {why}")
|