Comprehensive Python-based system for analyzing dividend-paying stocks and generating professional investment reports
The Dividend Stock Analyzer is an end-to-end data science pipeline that automates the evaluation of dividend-paying stocks for long-term investment. It analyzes multiple dimensions—dividend strength, business quality, risk profile, valuation, and long-term return scenarios—to generate professional Word reports with buy/hold/avoid recommendations.
Long-term dividend investors face several challenges:
Manually analyzing dividend safety, quality metrics, valuation, and risk factors takes 4-6 hours per stock
Financial data spread across multiple websites, requiring manual consolidation and calculation
Subjective analysis without standardized criteria leads to biased investment decisions
A fully automated Python pipeline that downloads financial data, performs comprehensive analysis across 7 dimensions, and generates professional investment reports in under 5 minutes per stock.
Fetches 60+ years of price data, dividend history, and financial statements from Yahoo Finance API
Evaluates 100+ metrics across dividend safety, quality, risk, and valuation with a 0-100 point system
Generates 7-page Word documents with color-coded recommendations, visualizations, and investment thesis
Hybrid system: strict deal-breakers eliminate risky stocks, weighted scoring ranks suitable candidates
Change one ticker variable to analyze any stock—all outputs automatically update
Projects 3-year and 10-year returns under bull/base/bear scenarios with probability assessments
Tech Stack
9-Step Analysis Pipeline
Automated download of 60+ years of price data, complete dividend history, and 5+ years of financial statements (income, balance sheet, cash flow). Includes data validation and error handling for API failures.
Calculates 8 dividend metrics: current yield, 5/10-year CAGR, payout ratio, FCF coverage, payment history, and dividend cuts. Generates safety score (0-100) weighted across 6 components.
Evaluates business fundamentals across 4 categories: Profitability (ROE, margins), Growth (revenue/earnings CAGR), Financial Health (debt ratios, liquidity), and Competitive Position. Includes sector-specific adjustments for financial companies.
Measures volatility (annualized standard deviation), beta, maximum drawdown, Value at Risk (VaR 95%), and Sharpe ratio. Classifies risk level as LOW/MEDIUM/HIGH based on scoring thresholds.
Categorizes stocks into 6 types: Dividend Aristocrat, Quality Dividend Stock, Suitable, Trading Stock, Speculative, or Avoid. Uses dividend history, quality score, and volatility metrics to determine long-term suitability.
Calculates fair value using 3 methods: P/E ratio (vs 5-year average), Dividend Discount Model (Gordon Growth), and Price-to-Free-Cash-Flow. Computes margin of safety: (Fair Value - Price) / Fair Value × 100.
Projects total returns under three scenarios: Bull (25% probability), Base (50% probability), Bear (25% probability). Calculates 3-year and 10-year expected returns with probability of positive outcomes.
Two-stage decision tree: (1) Deal-breaker checks (yield < 1%, quality < 40, speculative classification, dividend cuts), (2) Weighted scoring (Dividend 30pts + Quality 30pts + Risk 20pts + Valuation 20pts). Generates STRONG BUY/BUY/HOLD/WAIT/AVOID with confidence score.
Automatically creates professional 7-page Word document with color-coded recommendations, key metrics dashboard, component breakdowns, scenario projections, and investment thesis. Includes visualization appendix with 7 charts.
Tested on 7 stocks across Consumer Defensive, Healthcare, Financial Services, and Technology sectors. The system successfully identified 1 BUY opportunity, 3 HOLD positions, and correctly filtered out 3 unsuitable stocks.
Financial Services
BUY - Score 74.5Undervalued with 65% margin of safety
Healthcare
HOLD - Score 67.5Quality dividend payer, fairly valued
Consumer Defensive
HOLD - Score 58.9Dividend sustainability concerns
Consumer Defensive
HOLD - Score 64.8Stable but not compelling value
Technology
AVOID - Score 53.0Dividend yield < 1% (deal breaker)
Financial Services
AVOID - Score 57.2Yield too low for dividend portfolio
Energy
AVOID - Score 62.4Speculative classification (deal breaker)
Distribution: 0 STRONG BUY, 1 BUY (14%), 3 HOLD (43%), 0 WAIT, 3 AVOID (43%). This realistic distribution demonstrates the system's selectivity—not every blue-chip stock makes the cut for dividend investing.
Standard profitability metrics (gross margin, operating margin) don't apply to financial companies like banks and insurance firms.
Yahoo Finance API occasionally returns incomplete data, missing fields, or incorrect historical values.
Initial criteria were too strict—all 10 test stocks returned HOLD or AVOID, with no BUY recommendations.
Generating professional Word documents with consistent formatting, dynamic content, and embedded visualizations required precise control over document structure.
Add tailored thresholds for Energy, Utilities, REITs, and Telecommunications to improve classification accuracy
Web interface to analyze 10-20 stocks simultaneously with comparison matrix and sector benchmarking
Extend to international exchanges with currency conversion, different accounting standards, and country risk factors
All code, data, and documentation available on GitHub