aboutsummaryrefslogtreecommitdiff
path: root/components/valuation.py
diff options
context:
space:
mode:
authorOpenclaw <openclaw@mail.tylerhoang.xyz>2026-03-29 01:33:07 -0700
committerOpenclaw <openclaw@mail.tylerhoang.xyz>2026-03-29 01:33:07 -0700
commitb1e129bff08076fcd7dfe3ef9c3a98c8f1712a26 (patch)
treeb669a1fcaa126fc7f8f81bbae698e37d4e4e2c94 /components/valuation.py
parent547997cbd069e9b958b12a8da38b3a4a257e29e5 (diff)
Improve UX and disable DCF for financials
Diffstat (limited to 'components/valuation.py')
-rw-r--r--components/valuation.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/components/valuation.py b/components/valuation.py
index 82e0f0d..d7a84d4 100644
--- a/components/valuation.py
+++ b/components/valuation.py
@@ -15,6 +15,27 @@ from services.valuation_service import run_dcf, run_ev_ebitda, compute_historica
from utils.formatters import fmt_ratio, fmt_pct, fmt_large, fmt_currency
+FINANCIAL_SECTORS = {"Financial Services"}
+FINANCIAL_INDUSTRY_KEYWORDS = (
+ "bank",
+ "insurance",
+ "asset management",
+ "capital markets",
+ "financial data",
+ "credit services",
+ "mortgage",
+ "reit",
+)
+
+
+def _is_financial_company(info: dict) -> bool:
+ sector = str(info.get("sector") or "").strip()
+ industry = str(info.get("industry") or "").strip().lower()
+ if sector in FINANCIAL_SECTORS:
+ return True
+ return any(keyword in industry for keyword in FINANCIAL_INDUSTRY_KEYWORDS)
+
+
def render_valuation(ticker: str):
tab_ratios, tab_dcf, tab_comps, tab_analyst, tab_earnings = st.tabs([
"Key Ratios", "DCF Model", "Comps", "Analyst Targets", "Earnings History"
@@ -97,6 +118,18 @@ def _render_ratios(ticker: str):
def _render_dcf(ticker: str):
info = get_company_info(ticker)
+
+ if _is_financial_company(info):
+ st.warning(
+ "DCF is disabled for financial companies in Prism. Free-cash-flow and capital-structure "
+ "assumptions are not directly comparable for banks, insurers, and similar businesses."
+ )
+ st.caption(
+ "Use ratios, comps, earnings history, and analyst targets instead. A bank-specific valuation "
+ "framework can be added later."
+ )
+ return
+
shares = info.get("sharesOutstanding") or info.get("floatShares")
current_price = info.get("currentPrice") or info.get("regularMarketPrice")
total_debt = info.get("totalDebt") or 0.0