Which Sectors Struggle When the Dollar Rallies? Sector Rotation Analysis in Python
June 15, 2026
What's the question?
Dollar strength can affect equity sectors through several channels. A stronger dollar can pressure companies with foreign revenue, tighten global financial conditions, and signal demand for U.S. assets during stress. The sector impact is not automatic, but it is important for macro-aware portfolio construction.
The question is whether dollar rallies are followed by weaker sector returns. The test uses UUP as a tradable dollar proxy. A dollar rally week is defined as a week in the top quintile of UUP returns. A weak-dollar week is defined as a week in the bottom quintile.
The approach
The universe is UUP for the dollar proxy and eight sector ETFs: XLK, XLF, XLV, XLE, XLY, XLP, XLI, and XLU. Built from SEC EDGAR public filings and market data, the test uses five years of weekly adjusted prices.
- Pull weekly adjusted prices
- Calculate weekly returns for UUP and each sector ETF
- Identify top-quintile and bottom-quintile dollar weeks
- Measure each sector's return in the following week
- Compare average next-week sector returns after dollar rallies versus weak-dollar weeks
The forward-return setup avoids describing the same week's move as a predictive signal.
Code
import xfinlink as xfl
import pandas as pd
xfl.set_api_key("YOUR_API_KEY") # free at https://xfinlink.com/signup
sectors = ["XLK", "XLF", "XLV", "XLE", "XLY", "XLP", "XLI", "XLU"]
prices = xfl.prices(["UUP", *sectors], period="5y", interval="1w", fields=["adj_close"])
pivot = prices.pivot_table(index="date", columns="ticker", values="adj_close").dropna()
returns = pivot.pct_change().dropna()
signal = returns["UUP"]
forward = returns[sectors].shift(-1)
top = signal >= signal.quantile(0.80)
bottom = signal <= signal.quantile(0.20)
summary = pd.DataFrame({
"after_dollar_rally": forward[top].mean(),
"after_weak_dollar": forward[bottom].mean(),
})
summary["spread"] = summary["after_dollar_rally"] - summary["after_weak_dollar"]
print(summary.sort_values("spread"))
Full script with formatting and visualisation: dollar-strength-sector-rotation-python.py
Output
=== Dollar Strength Sector Rotation Test ===
Weekly sample: 2021-06-21 to 2026-05-26 (258 weeks)
Dollar proxy: UUP
Dollar rally threshold: weekly return >= 0.79%
Weak-dollar threshold: weekly return <= -0.61%
Dollar rally weeks: 52; weak-dollar weeks: 52
Average next-week sector returns:
XLP after_rally= -0.38% after_weak= 0.26% spread= -0.64%
XLI after_rally= -0.10% after_weak= 0.10% spread= -0.19%
XLF after_rally= -0.05% after_weak= 0.06% spread= -0.11%
XLV after_rally= -0.18% after_weak= -0.16% spread= -0.03%
XLU after_rally= -0.45% after_weak= -0.53% spread= 0.09%
XLK after_rally= -0.14% after_weak= -1.06% spread= 0.92%
XLE after_rally= 0.43% after_weak= -0.59% spread= 1.02%
XLY after_rally= -0.25% after_weak= -1.45% spread= 1.20%
Best relative sector after dollar rallies: XLY ( 1.20% spread)
Weakest relative sector after dollar rallies: XLP ( -0.64% spread)
What this tells us
Dollar rallies were not followed by uniformly weak sector returns. Every sector except XLE had a negative average next-week return after dollar rally weeks, but the comparison against weak-dollar weeks changes the interpretation.
XLP had the weakest relative result. It averaged -0.38% after dollar rally weeks and +0.26% after weak-dollar weeks, a spread of -0.64 percentage points. XLI and XLF also had negative spreads. These sectors looked more sensitive to dollar strength in this sample.
XLY, XLE, and XLK had positive relative spreads. That does not mean dollar rallies are bullish for these sectors. XLY still averaged -0.25% after dollar rally weeks. The positive spread occurs because its returns after weak-dollar weeks were even worse at -1.45%.
So what?
Dollar strength is a regime variable, not a complete allocation rule. It can help identify when sector leadership may shift, but it should be paired with trend, valuation, earnings revisions, and rate sensitivity.
The useful takeaway is relative. Consumer staples had the clearest negative response after dollar rallies. Energy and discretionary did not fit the simple strong-dollar-bad-equities story over this period. A sector rotation model should test those relationships directly instead of assuming the macro narrative applies equally to every sector.
Built with xfinlink — free financial data API for Python. pip install xfinlink
pip install xfinlink