Sector Rotation API
A live REST endpoint that ranks S&P sector ETFs by momentum, classifies each as defensive or cyclical, and surfaces per-sector accumulation and distribution signals derived from a Money Flow Index plus volume analysis.
Rank the S&P sectors
GET /api/v1/sectors/rotation returns all 11 sector ETFs (XLY, XLK, XLF, XLE, XLI, XLB, XLU, XLP, XLV, XLC, XLRE) ranked by momentum. Each sector carries a defensive-or-cyclical type, price, 1-week / 1-month / 3-month performance, and a volume ratio. The top-level signal resolves to RISK_ON, RISK_OFF, or NEUTRAL based on the rotation spread between cyclical and defensive averages.
Detect accumulation and distribution
GET /api/v1/sectors/flows?lookback=14 adds volume analysis on top of the momentum ranking. Each sector is classified as accumulation, distribution, or neutral based on a proprietary composite of price and volume signals.
The lookback parameter accepts values from 5 to 50 periods.
Why not just build this in Python?
You can, and many quants do. The barrier is not the calculation itself — MFI and z-scores are trivial. The barrier is the data plumbing: keeping 11 ETF price and volume histories in sync, handling corporate actions, managing yfinance rate limits, and running the recalculation on a schedule. BullrunData handles that plumbing and exposes the result as a single REST call, so the calculation runs on our side and you consume the JSON. If you'd rather build it yourself, the data is available on the free tier and via the sectors_rotation and sectors_flows MCP tools for AI agents.
Common integrations
- Rotation dashboards: render a bar chart of momentum by sector plus a heat map of MFI × volume z-score classification.
- Regime detection: use the defensive-vs-cyclical average spread as one input to a broader risk-on/risk-off classifier.
- Sector-tilt allocation: weight a sector-ETF portfolio by rank, refresh weekly.
- Newsletter automation: daily summary of "what led, what lagged, what accumulated, what distributed" from a single API call.
Related resources
- Glossary: Sector Rotation — how sector leadership cycles with the business cycle
- Glossary: Money Flow Index — the volume-weighted momentum oscillator
- Recession Probability API — pair sector rotation with cycle detection
- API Documentation — full REST reference