diff options
| -rw-r--r-- | components/valuation.py | 6 | ||||
| -rw-r--r-- | services/data_service.py | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/components/valuation.py b/components/valuation.py index 863193b..a72d177 100644 --- a/components/valuation.py +++ b/components/valuation.py @@ -13,7 +13,6 @@ from services.data_service import ( get_recommendations_summary, get_earnings_history, get_next_earnings_date, - get_ebitda_from_income_stmt, ) from services.fmp_service import ( get_key_ratios, @@ -338,8 +337,9 @@ def _render_dcf(ticker: str): st.divider() st.markdown("**EV/EBITDA Valuation**") - # Use income statement EBITDA — info["ebitda"] is unreliable in yfinance - ebitda = get_ebitda_from_income_stmt(ticker) or info.get("ebitda") + # Use TTM EBITDA from compute_ttm_ratios — same source as Key Ratios tab + ratios_data = get_key_ratios(ticker) + ebitda = ratios_data.get("ebitdaTTM") ev_bridge_items = get_balance_sheet_bridge_items(ticker) total_debt = ev_bridge_items["total_debt"] total_cash = ev_bridge_items["cash_and_equivalents"] diff --git a/services/data_service.py b/services/data_service.py index 156a33e..412ca94 100644 --- a/services/data_service.py +++ b/services/data_service.py @@ -355,6 +355,11 @@ def compute_ttm_ratios(ticker: str) -> dict: if net_income and net_income > 0: ratios["dividendPayoutRatioTTM"] = dividends_paid / net_income + # Expose raw EBITDA so callers (e.g. DCF EV/EBITDA section) use the + # same TTM figure as the Key Ratios tab — single canonical source. + if ebitda is not None: + ratios["ebitdaTTM"] = ebitda + return ratios except Exception: return {} @@ -601,7 +606,6 @@ def get_balance_sheet_bridge_items(ticker: str) -> dict: minority_interest = pick( "Minority Interest", "Minority Interests", - "Total Equity Gross Minority Interest", ) or 0.0 net_debt = total_debt - cash_and_equivalents |
