From 930058ce5e27dc072ead85b6db30be9dc7364bb8 Mon Sep 17 00:00:00 2001 From: Patryk Kocielnik Date: Mon, 17 Feb 2025 20:29:09 +0100 Subject: [PATCH] Use TTM EPS (#97). --- isthisstockgood/Active/MSNMoney.py | 3 +++ isthisstockgood/DataFetcher.py | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/isthisstockgood/Active/MSNMoney.py b/isthisstockgood/Active/MSNMoney.py index 26482c8..ee46940 100644 --- a/isthisstockgood/Active/MSNMoney.py +++ b/isthisstockgood/Active/MSNMoney.py @@ -108,6 +108,9 @@ def parse_ratios_data(self, content): # Debt self._parse_debt_to_equity(quarterly_data) + + # Quarterly EPS for MOSP valuation + self.quarterly_eps = _extract_data_for_key(quarterly_data, "earningsPerShare") return True diff --git a/isthisstockgood/DataFetcher.py b/isthisstockgood/DataFetcher.py index 3e74db0..24ad196 100644 --- a/isthisstockgood/DataFetcher.py +++ b/isthisstockgood/DataFetcher.py @@ -60,8 +60,13 @@ def fetchDataForTickerSymbol(ticker): else zacks_analysis.five_year_growth_rate if zacks_analysis \ else 0 # TODO: Use TTM EPS instead of most recent year - margin_of_safety_price, sticker_price = \ - _calculateMarginOfSafetyPrice(msn_money.equity_growth_rates[-1], msn_money.pe_low, msn_money.pe_high, msn_money.eps[-1], five_year_growth_rate) + margin_of_safety_price, sticker_price = _calculateMarginOfSafetyPrice( + msn_money.equity_growth_rates[-1], + msn_money.pe_low, + msn_money.pe_high, + msn_money.quarterly_eps[-1], + five_year_growth_rate + ) payback_time = _calculatePaybackTime(msn_money.equity_growth_rates[-1], msn_money.last_year_net_income, msn_money.market_cap, five_year_growth_rate) free_cash_flow_per_share = float(msn_money.free_cash_flow[-1]) computed_free_cash_flow = round(free_cash_flow_per_share * msn_money.shares_outstanding)