BLOG

Behind the numbers.

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

What Growth Rate Is the Market Pricing In? Reverse DCF in Python
Does a Strong Balance Sheet Cushion Drawdowns? Leverage and Downside Risk in Python
Does Ticker Recycling Corrupt a Mean-Reversion Backtest? Entity-Resolved Z-Scores in Python
How Much of a Growth Screen's Backtested Edge Is Survivorship Bias? Point-in-Time Index Testing in Python
Why Do Leveraged ETFs Decay? Measuring Volatility Drag in Python
Are Consumer Staples Margins Shrinking Under Inflation? Gross Margin Trend Analysis in Python
Do Weak Jobs Reports Predict Market Drawdowns? NFP Surprise Event Study in Python
Is the Rotation From Tech to Industrials Backed by Earnings? Relative EPS Growth Analysis in Python
Is the Semiconductor Rally Broadening Beyond NVIDIA? Return Dispersion Analysis in Python
Which Stocks Benefit Most When Oil Prices Fall? Oil Beta Screening in Python
Do Bond Returns Predict Stock Returns? Granger Causality Test in Python
Which Stocks Actually Drive Portfolio Returns? Shapley Value Attribution in Python
Does "Sell in May" Still Work? Calendar Anomaly Backtest in Python
How to Build Complete Price History Through Ticker Changes? Entity Resolution in Python
Are KO and PEP Cointegrated? Pairs Trading Signal Construction in Python
Which Commodities Have the Strongest Momentum? Rotation Backtest in Python
Which Commodity ETFs Have the Worst Tail Risk? Expected Shortfall in Python
Are Gold Miners Leveraged Gold Bets? Rolling Beta Analysis in Python
Does the Base-Metals-to-Gold Ratio Lead Cyclical Stocks? Signal Test in Python
Can Risk Parity Tame Commodity Volatility? Portfolio Optimization in Python
Are Power Stocks Becoming an AI Infrastructure Trade? Momentum Screening in Python
Which AI Chip Stocks Have Margin Momentum? Profitability Trend Analysis in Python
Which AI Stocks Are Cheapest Relative to Growth? Growth-Adjusted Valuation in Python
Does AI Stock Leadership Persist? Momentum Backtest in Python
Which AI Stocks Have the Cleanest Balance Sheets? Net Cash Screening in Python
Can Risk Parity Reduce Mega-Cap Drawdowns? Portfolio Optimization in Python
Which Growth Stocks Are Self-Funding? Cash-Flow Quality Screening in Python
Which Sectors Struggle When the Dollar Rallies? Sector Rotation Analysis in Python
Do Cheap Stocks Hold Up When Bonds Sell Off? Valuation Rotation in Python
Does the Nasdaq 100 Have Better Growth Quality Than the Dow? Index Constituent Analysis in Python
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

Why Do Leveraged ETFs Decay? Measuring Volatility Drag in Python

What's the question?

A 3x leveraged ETF promises three times the daily return of its index, and delivers it every day. Yet over three years TQQQ returned 219.7% while the Nasdaq 100 returned 86.3% — 2.5x, not 3x. Holders read this as a broken product.

It is not. Daily rebalancing compounds returns, and compounding is path-dependent: a 10% loss then a 10% gain leaves a position below where it started. A leveraged position’s expected log return is L·μ − (L²·σ²)/2, for leverage L, expected return μ, and variance σ². Against L times the underlying’s log return, the fund gives up a volatility drag of (L² − L)/2 · σ² per year.

The critical feature is the square: drag scales with L², not L. Moving from 2x to 3x triples the drag coefficient. How large is that drag, and does it follow the L² law closely enough to forecast?

The approach

Six leveraged funds are measured against the index ETF they track over three years of daily total returns ending July 16, 2026: four 3x (TQQQ/QQQ, UPRO/SPY, SOXL/SOXX, TNA/IWM) and two 2x (QLD/QQQ, SSO/SPY). QLD and TQQQ share an index, isolating leverage.

  1. Pull daily total returns from return_daily, never raw close: leveraged ETFs reverse-split often, and raw close steps across splits.
  2. Inner-join fund and index on date; a mismatched calendar corrupts the regression.
  3. Regress each fund’s daily return on its index’s; a slope near L confirms the daily promise.
  4. Compare actual cumulative return against the naive expectation (1 + L·U) and the no-drag benchmark (1 + U)^L.
  5. Decompose the annualised log shortfall into the drag term, the fees-and-financing cost from the intercept, and a residual.
  6. Split each pair into six sub-periods and fit realized drag against realized variance. The slope should reproduce (L² − L)/2.

Code

import numpy as np
import xfinlink as xfl

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

PAIRS = [("TQQQ", "QQQ", 3), ("UPRO", "SPY", 3), ("SOXL", "SOXX", 3),
         ("TNA", "IWM", 3), ("QLD", "QQQ", 2), ("SSO", "SPY", 2)]

def daily_returns(ticker):
    d = xfl.prices(ticker, period="3y", fields=["return_daily"]).sort_values("date")
    return d[["date", "return_daily"]].rename(columns={"return_daily": ticker})

for lev, und, L in PAIRS:
    m = daily_returns(lev).merge(daily_returns(und), on="date", how="inner").dropna()
    rl, ru = m[lev].values, m[und].values
    years = len(m) / 252.0

    beta, alpha = np.polyfit(ru, rl, 1)          # slope should be ~L
    actual = np.prod(1 + rl) - 1
    index = np.prod(1 + ru) - 1
    naive = L * index                            # what holders expect
    ideal = (1 + index) ** L - 1                 # correct no-drag benchmark

    sigma = np.std(ru, ddof=1) * np.sqrt(252)
    realized_drag = (L * np.log(1 + index) - np.log(1 + actual)) / years
    theory_drag = (L ** 2 - L) / 2 * sigma ** 2  # the variance penalty
    carry = -alpha * 252                         # fees + financing
    residual = realized_drag - theory_drag - carry

    print(f"{lev}/{und} slope={beta:.3f} actual={actual*100:.1f}% naive={naive*100:.1f}% "
          f"ideal={ideal*100:.1f}% drag={realized_drag*100:.2f}% "
          f"theory={theory_drag*100:.2f}% carry={carry*100:.2f}% resid={residual*100:+.2f}%")

Full script with formatting and visualisation: why-do-leveraged-etfs-decay-volatility-drag-python.py

Output

TQQQ cumulative return versus naive 3x and no-drag benchmarks over three years, and annualised drag against index variance for 2x and 3x funds with theoretical lines.
==============================================================================
1. DOES THE DAILY PROMISE HOLD?  regression: fund daily return ~ index daily return
==============================================================================
pair         target    slope       R2   intercept /yr
TQQQ/QQQ         3x    2.973   0.9994         -11.04%
UPRO/SPY         3x    2.912   0.9962          -9.13%
SOXL/SOXX        3x    2.947   0.9982         -12.21%
TNA/IWM          3x    2.986   0.9985         -11.49%
QLD/QQQ          2x    1.991   0.9994          -5.66%
SSO/SPY          2x    1.947   0.9963          -4.64%

==============================================================================
2. MULTI-PERIOD REALITY (3y, 752 trading days)
==============================================================================
pair             index   naive Lx    (1+U)^L     actual   vs naive
TQQQ/QQQ         86.3%     259.0%     547.0%     219.7%     -39.3pp
UPRO/SPY         69.9%     209.8%     390.8%     193.7%     -16.1pp
SOXL/SOXX       205.9%     617.7%    2762.9%     413.7%    -204.0pp
TNA/IWM          57.9%     173.6%     293.3%      87.0%     -86.5pp
QLD/QQQ          86.3%     172.7%     247.2%     158.4%     -14.3pp
SSO/SPY          69.9%     139.9%     188.8%     129.1%     -10.8pp

==============================================================================
3. WHERE THE SHORTFALL COMES FROM (annualised, log terms)
==============================================================================
pair          index vol  realized  (L2-L)/2 s2  fees+fin  residual
TQQQ/QQQ          20.3%    23.62%       12.39%    11.04%    +0.20%
UPRO/SPY          15.3%    17.20%        7.02%     9.13%    +1.05%
SOXL/SOXX         38.6%    57.57%       44.72%    12.21%    +0.64%
TNA/IWM           21.2%    24.91%       13.42%    11.49%    +0.00%
QLD/QQQ           20.3%     9.90%        4.13%     5.66%    +0.11%
SSO/SPY           15.3%     7.76%        2.34%     4.64%    +0.77%

==============================================================================
4. SCALING TEST: drag vs variance across 6 sub-periods x 6 pairs
==============================================================================
  2x funds: fitted drag/variance slope = 1.002   theory (L^2-L)/2 = 1.0   (n=12 sub-periods)
  3x funds: fitted drag/variance slope = 3.022   theory (L^2-L)/2 = 3.0   (n=24 sub-periods)
  correlation between realized drag and theoretical drag: 0.9977

What this tells us

The daily promise holds. Slopes land between 2.912 and 2.986 for the 3x funds and 1.947 to 1.991 for the 2x funds, with R² from 0.9962 to 0.9994. These funds do what their prospectuses say; the shortfall is not a tracking failure.

The naive benchmark is wrong, in an instructive direction. Compounding at 3x exposure with zero volatility delivers (1 + U)^L, far higher than three times the index’s cumulative return: 547.0% for TQQQ against a naive 259.0%, and 2762.9% for SOXL against a naive 617.7%. Convexity favours the leveraged holder when the index trends. Drag closes that gap and overshoots it, so SOXL gave up far more than its −204.0pp headline suggests.

The decomposition accounts for essentially all of it. Realized drag ranges from 7.76%/yr (SSO) to 57.57%/yr (SOXL), and the variance term plus the intercept leaves residuals of +0.00% to +1.05% per year. That residual is not zero and should not be: the log expansion drops third-order terms, and rebalancing happens at the close, not continuously. The intercept absorbs fees, financing on borrowed notional, and a dividend mismatch against the proxy — at −11.04%/yr for TQQQ, it rivals the drag itself.

The L² law is confirmed rather than assumed. QLD and TQQQ track the identical index at identical 20.3% volatility, yet their theoretical drags are 4.13% and 12.39% — exactly 3.0x, from one extra unit of leverage. SSO and UPRO give 2.34% and 7.02%, the same ratio. Across 36 sub-periods the fitted drag-to-variance slope is 1.002 for 2x funds against a theoretical 1.0, and 3.022 for 3x funds against 3.0, correlation 0.9977. The dashed lines in the lower panel are theory, not fits.

So what?

Decay in these products is forecastable. The annual cost of L times exposure is approximately (L² − L)/2 · σ² plus fees and financing, both estimable in advance. At 20% index volatility a 3x fund carries roughly 12% of drag and, at current short rates, a further 11% of carry — a hurdle near 23% per year. At SOXX’s 38.6% volatility that nears 58%.

This makes σ² the variable to watch: doubling realized volatility quadruples the drag, so the same index view produces very different outcomes at 15% and 40%. A leveraged position should be assessed against a volatility forecast, not a return forecast alone.

The arithmetic is not specific to ETFs. Any daily-rebalanced constant-leverage exposure carries it — margin accounts, futures overlays, volatility-targeted risk-parity sleeves — and substituting L and a volatility estimate prices it to about a percentage point per year.

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