BLOG

Behind the numbers.

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

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

Are AI Earnings Supported by Cash Flow? Accrual and Capex Screen in Python

What's the question?

An earnings boom is more durable when accounting profit is supported by operating cash flow. Operating cash flow is cash generated by the business before capital expenditure. Free cash flow is operating cash flow minus capital expenditure. A company can report strong net income while cash flow weakens if working capital, non-cash items, or aggressive investment absorb cash.

This matters for AI because the debate is not only about revenue growth. It is also about the quality of the earnings behind that growth. If AI-linked companies show weak cash conversion, negative free cash flow, or capex consuming most operating cash flow, the earnings base is more vulnerable. If they convert earnings to cash and retain free cash flow after capex, the boom has stronger financial support.

The approach

The screen covers NVDA, ORCL, MSFT, AMZN, META, GOOG, AVGO, and PLTR. It uses the latest annual fundamentals for each company.

  1. Compute operating cash flow divided by net income
  2. Compute free cash flow margin, which is free cash flow divided by revenue
  3. Compute capital expenditure as a share of operating cash flow
  4. Compute an accrual ratio: net income minus operating cash flow, divided by total assets
  5. Compute stock-based compensation as a share of revenue

The goal is to distinguish cash-supported earnings from earnings that depend more heavily on reinvestment and non-cash adjustments.

Code

import xfinlink as xfl
import pandas as pd

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

tickers = ["NVDA", "ORCL", "MSFT", "AMZN", "META", "GOOG", "AVGO", "PLTR"]
fields = ["revenue", "net_income", "operating_cash_flow", "free_cash_flow",
          "capital_expenditures", "total_assets", "stock_based_compensation_cf"]

df = xfl.fundamentals(tickers, period_type="annual", period="4y", fields=fields)
latest = df.sort_values("period_end").groupby("ticker").tail(1).copy()

latest["capex_abs"] = latest["capital_expenditures"].abs()
latest["cash_conversion"] = latest["operating_cash_flow"] / latest["net_income"]
latest["fcf_margin"] = latest["free_cash_flow"] / latest["revenue"]
latest["capex_to_ocf"] = latest["capex_abs"] / latest["operating_cash_flow"]
latest["accrual_ratio"] = (
    latest["net_income"] - latest["operating_cash_flow"]
) / latest["total_assets"]

print(latest[["ticker", "cash_conversion", "fcf_margin", "capex_to_ocf"]])

Full script with formatting and visualisation: ai-earnings-cash-flow-quality-python.py

Output

AI earnings cash flow quality scatter plot showing cash conversion versus capex burden
=== AI Earnings Cash-Flow Quality Screen ===
Latest annual period per company (max period_end 2026-01-25)

ORCL  OCF/net_income=1.67x  FCF_margin= -0.7%  capex/OCF=101.9%  accrual_ratio= -5.0%  SBC/revenue= 8.1%
AMZN  OCF/net_income=1.80x  FCF_margin=  1.1%  capex/OCF=94.5%  accrual_ratio= -7.6%  SBC/revenue= 2.7%
META  OCF/net_income=1.92x  FCF_margin= 22.9%  capex/OCF=60.2%  accrual_ratio=-15.1%  SBC/revenue=10.2%
GOOG  OCF/net_income=1.25x  FCF_margin= 18.2%  capex/OCF=55.5%  accrual_ratio= -5.5%  SBC/revenue= 6.7%
MSFT  OCF/net_income=1.34x  FCF_margin= 25.4%  capex/OCF=47.4%  accrual_ratio= -5.5%  SBC/revenue= 4.3%
NVDA  OCF/net_income=0.86x  FCF_margin= 44.8%  capex/OCF= 5.9%  accrual_ratio= +8.4%  SBC/revenue= 3.0%
AVGO  OCF/net_income=1.19x  FCF_margin= 42.1%  capex/OCF= 2.3%  accrual_ratio= -2.6%  SBC/revenue=11.8%
PLTR  OCF/net_income=1.31x  FCF_margin= 46.9%  capex/OCF= 1.6%  accrual_ratio= -5.7%  SBC/revenue=15.3%

Companies with OCF/net income >= 1.2x: ORCL, AMZN, META, GOOG, MSFT, PLTR
Companies with negative free cash flow margin: ORCL

What this tells us

The screen does not show uniformly weak earnings quality. Six of eight companies convert net income into operating cash flow at 1.2 times or better. META has the strongest cash conversion at 1.92x, followed by AMZN at 1.80x and ORCL at 1.67x. These figures indicate that reported earnings are supported by cash receipts and working-capital dynamics, not only by accounting profit.

The capex burden changes the interpretation. ORCL converts earnings to operating cash flow, but capital expenditure consumes 101.9% of operating cash flow, leaving a negative free cash flow margin of -0.7%. AMZN has a similar capex burden at 94.5% of operating cash flow and only a 1.1% free cash flow margin. These are not weak operating businesses. They are businesses where reinvestment absorbs the cash.

NVDA is the opposite case. Its operating cash flow is 0.86 times net income, but free cash flow margin is 44.8% because capex is only 5.9% of operating cash flow. The supplier model remains far less capital intensive than the infrastructure-buyer model.

So what?

The cash-flow evidence argues against a blanket claim that AI earnings are low quality. The more precise risk is capex absorption. ORCL and AMZN are the names where investment spending leaves the least cash after operations. NVDA, AVGO, and PLTR produce high free cash flow margins because their models require less physical infrastructure relative to revenue.

For forecasting, the key variable is not only revenue growth. It is the path from revenue to operating cash flow to free cash flow. A company can have excellent cash conversion and still be financially stretched if capex consumes the cash. AI valuation models should therefore separate operating quality from reinvestment burden before assigning multiples.

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