BLOG

Behind the numbers.

Code examples, market analysis, and data quality deep-dives.

Do Healthcare Cash-Flow Margins Predict Returns? Signal Evaluation in Python
Which Dividend Stocks Survive a Cash-Flow Stress Test? Dividend Screening in Python
Does Heavy Insider Selling Predict Weak Returns? Insider Flow Test in Python
Can Quality Screens Reduce Small-Cap Balance-Sheet Risk? Russell 2000 Test in Python
Which Retailers Have Positive Operating Leverage? Margin Screening in Python
Is MSTR a Leveraged Bitcoin Proxy? Rolling Beta Analysis in Python
Is Micron's Memory Cycle Recovering? Inventory and Margin Forecasting in Python
Which Sectors Work When Bonds Rally? Rate-Sensitive Rotation in Python
Do One-Month Price Extremes Reverse? Signal Evaluation in Python
Do Low-Volatility S&P 500 Stocks Reduce Drawdowns? Factor Test in Python
Is AI Capex Paying Back Fast Enough? Revenue Hurdle Forecasting in Python
Could Shorter AI Asset Lives Hit Earnings? Depreciation Stress Test in Python
How Much AI Capex Risk Can a Portfolio Remove? Constrained Optimization in Python
Is the AI Capex Trade Crowded? Rolling Volatility and Sector Rotation in Python
Did the AI Boom Come From Existing S&P 500 Members? Point-in-Time Momentum Test in Python
Is AI Revenue Circular? Customer-Vendor Capex Loop Analysis in Python
Is the AI Trade Connected to Private Credit? Rolling Correlation Network in Python
Is Apollo More Balance-Sheet Sensitive Than Peers? Leverage Screen in Python
Are AI Earnings Supported by Cash Flow? Accrual and Capex Screen in Python
Can Defensive Stocks Hedge AI Drawdowns? Basket Regime Test in Python
How Fast Does the Market Price In Fed Decisions? FOMC Event Study in Python
How Much Are Options Sellers Overpaid? The Variance Risk Premium in Python
Which Companies Have the Worst Earnings Quality? Sloan Accrual Screen with Geographic Revenue Data in Python
Does the Oil-to-Gold Ratio Signal Recessions? XLE/GLD Backtest in Python
Is AI Spending Crowding Out Free Cash Flow? Capex Sustainability Across the Mag 7 in Python
Does a Long Energy / Short Bonds Portfolio Capture Inflation Surprises? Factor Construction in Python
Can a Hidden Markov Model Detect Oil Market Regimes? HMM Analysis in Python
Do Grain Prices Predict Food Inflation? Granger Causality Test in Python
Does the Corporate Credit Spread Predict Stock Market Crashes? BAA-AAA Spread Analysis in Python
Do Oil Stocks Hedge Inflation? Rolling Beta Analysis in Python
Which Stocks Are Most Rate-Sensitive? Equity Duration via Bond Beta in Python
Which Companies Have the Highest Accrual Ratios? Earnings Quality Screening in Python
Is Alpha Persistent or Decaying? Rolling Sharpe Ratio Analysis in Python
Are Markets Trending or Mean-Reverting? Hurst Exponent Analysis in Python
Is Consumer Discretionary vs Staples a Leading Indicator? XLY/XLP Ratio Analysis in Python
Does Heavy Capex Predict Future Stock Returns? Capital Expenditure Analysis in Python
How to Estimate Cost of Equity Using CAPM in Python
Is Volatility Predictable? Testing for Volatility Clustering in Python
Which Industrials Are Overleveraged? Net Debt to EBITDA Screening in Python
GM Before and After Bankruptcy: Why Entity Resolution Matters for Financial Data
What Is Adjusted Beta? Merrill Lynch Beta Shrinkage in Python
How Good Is a Stock Pick? Information Ratio and Tracking Error in Python
Do Stock Returns Follow a Normal Distribution? Testing for Fat Tails in Python
Which Large Caps Have the Highest Free Cash Flow Yield? FCF Screening in Python
Which Sectors Won Over 5 Years? Sector Rotation Analysis in Python
How to Forecast Stock Volatility with GARCH Models in Python
Are Stock Prices Mean-Reverting? Augmented Dickey-Fuller Test in Python
How to Calculate CAPM Alpha and Beta with Regression in Python
How to Compare Sector Sharpe Ratios and Sortino Ratios in Python
DELL: Why Stitching Historical Price Data Together Is Wrong
How to Analyze Drawdown and Recovery for Bank Stocks in Python
How to Screen SaaS Stocks by Revenue Growth and Cash Flow in Python
How to Screen REITs by Dividend Yield and Valuation in Python
How Correlated Are the Magnificent 7? Intra-Group Correlation in Python
AAPL vs XOM: Do Individual Stocks Have Seasonal Patterns?
How to Rank Large-Cap Stocks by Momentum in Python
How to Build a Multi-Endpoint Financial Dashboard in Python
How to Compare Volatility Across Energy Stocks in Python
How to Screen Healthcare Stocks by Valuation in Python
How to Build a Sector Correlation Matrix for Portfolio Diversification in Python
How to Find Oversold and Overbought Stocks Using Z-Scores in Python
How to Measure Earnings Quality: Cash Flow vs Net Income in Python
How to Build a Multi-Factor Stock Screen in Python (Value + Momentum + Quality)
How to Build a Simple DCF Model for Any Stock in Python
How to Screen Tech Stocks by Revenue Growth in Python
How to Screen Stocks by Balance Sheet Health in Python
Is "Sell in May" Real? SPY Monthly Seasonality Over 10 Years
How to Compare Sector Performance YTD Using Python
How to Track S&P 500 Additions and Removals Over Time in Python
How to Screen Dividend Stocks by Yield and Quality in Python
How to Calculate Max Drawdown and Recovery Time for Any Stock in Python
How to Compare Profitability Across Mega-Cap Tech Stocks in Python
Why Ticker Symbols Are Unreliable: The Recycling Problem Every Quant Should Know
How to Calculate and Compare Stock Volatility in Python
How to Screen Blue-Chip Stocks by P/E Ratio in Python
How to Track Companies Through Ticker Changes, Bankruptcies, and Renames in Python
S&P 500 Turnover: How Much the Index Has Changed Since 2010
How to Calculate Stock Beta and Correlation in Python
← All articles

Which Dividend Stocks Survive a Cash-Flow Stress Test? Dividend Screening in Python

What's the question?

Dividend yield is attractive only if the payout is financially supportable. A high yield can mean shareholder income, but it can also mean the market expects a dividend cut. The difference depends on cash generation, leverage, and payout burden.

The practical question is which dividend stocks combine yield with enough cash-flow and balance-sheet support. A simple yield screen cannot answer that question because it rewards high distributions even when free cash flow is weak or leverage is elevated.

The approach

The universe is T, VZ, MO, PM, KO, PEP, PG, WMT, DUK, XOM, and CVX. Built from SEC EDGAR public filings and market data, the screen uses trailing-twelve-month metrics.

  1. Pull dividend yield, payout ratio, debt/EBITDA, free-cash-flow margin, and P/E ratio
  2. Standardize each metric across the peer set
  3. Reward higher yield and higher free-cash-flow margin
  4. Penalize higher payout ratios and higher leverage
  5. Rank the stocks by the resulting resilience score

The score is not a prediction that a dividend will be raised or cut. It is a stress screen that separates income from balance-sheet pressure.

Code

import xfinlink as xfl
import pandas as pd

xfl.set_api_key("YOUR_API_KEY")  # free at https://xfinlink.com/signup

tickers = ["T", "VZ", "MO", "PM", "KO", "PEP", "PG", "WMT", "DUK", "XOM", "CVX"]
fields = ["dividend_yield", "dividend_payout_ratio", "debt_to_ebitda", "fcf_margin"]

df = xfl.metrics(tickers, period_type="ttm", fields=fields)
latest = df.sort_values("period_end").groupby("ticker").tail(1).set_index("ticker")

def zscore(s):
    return (s - s.mean()) / s.std(ddof=0)

latest["resilience_score"] = (
    zscore(latest["dividend_yield"])
    - zscore(latest["dividend_payout_ratio"])
    - zscore(latest["debt_to_ebitda"])
    + zscore(latest["fcf_margin"])
)

print(latest.sort_values("resilience_score", ascending=False))

Full script with formatting and visualisation: dividend-cash-flow-stress-python.py

Output

Dividend yield versus payout stress with free-cash-flow margin sizing
=== Dividend Cash-Flow Stress Screen ===
Latest TTM periods: 2026-03-21 to 2026-04-30
Complete-data universe: 11 dividend stocks
Highest yield: VZ (   5.9%)
Best resilience score: MO ( 2.97)
Weakest resilience score: DUK (-3.95)

Dividend stress ranking:
MO    score=  2.97  yield=   5.9%  payout=  87.7%  debt/EBITDA= 2.13  FCF_margin=  36.8%  PE= 14.9
T     score=  1.79  yield=   4.8%  payout=  37.4%  debt/EBITDA= 3.03  FCF_margin=  13.7%  PE=  7.7
VZ    score=  1.32  yield=   5.9%  payout=  67.3%  debt/EBITDA= 2.99  FCF_margin=  14.6%  PE= 11.4
PG    score=  0.85  yield=   2.8%  payout=  61.8%  debt/EBITDA= 1.59  FCF_margin=  17.3%  PE= 21.7
KO    score=  0.33  yield=   2.5%  payout=  64.8%  debt/EBITDA= 2.53  FCF_margin=  25.5%  PE= 25.9
XOM   score=  0.29  yield=   2.8%  payout=  68.0%  debt/EBITDA= 0.74  FCF_margin=   5.6%  PE= 24.7
PM    score= -0.16  yield=   3.2%  payout=  81.1%  debt/EBITDA= 2.87  FCF_margin=  25.7%  PE= 25.5
WMT   score= -0.20  yield=   0.8%  payout=  34.9%  debt/EBITDA= 1.06  FCF_margin=   1.7%  PE= 42.4
CVX   score= -1.49  yield=   3.7%  payout= 120.4%  debt/EBITDA= 1.10  FCF_margin=   7.4%  PE= 32.4
PEP   score= -1.75  yield=   4.0%  payout=  89.3%  debt/EBITDA= 3.37  FCF_margin=   9.3%  PE= 22.6
DUK   score= -3.95  yield=   3.4%  payout=  65.0%  debt/EBITDA= 4.90  FCF_margin= -10.1%  PE= 19.1

What this tells us

The highest yield does not automatically produce the best stress profile. VZ has the highest yield at 5.9%, but MO ranks first because it combines a similar yield with a 36.8% free-cash-flow margin and lower leverage than several peers. T also ranks well because its payout ratio is only 37.4%, although its leverage is higher than MO's.

DUK ranks weakest. The issue is not the 3.4% yield by itself. The combination of 4.90x debt/EBITDA and a -10.1% free-cash-flow margin makes the dividend less attractive on this stress framework. CVX also scores poorly because the payout ratio is above 100% in the trailing-twelve-month window.

So what?

Dividend screens should begin with yield but not end there. A high yield with strong free-cash-flow margin and manageable leverage can be a useful income candidate. A high yield with weak free cash flow or high leverage is a different exposure: it is partly a credit and payout-risk trade.

The practical rule is simple. Rank yield together with payout, leverage, and free-cash-flow margin. That avoids treating every 4% to 6% yield as equivalent.

Built with xfinlink — free financial data API for Python. pip install xfinlink

Built with xfinlink — free financial data API for Python. pip install xfinlink
← All articles