Skip to content
Data
Skill

/sector-rotation-signal

Change-detection layer on top of market-regime. market-regime reports current sector leadership as a snapshot; this skill tracks how the leadership order has changed over a rotation window (default 30 days) and flags sectors moving up or down the ranks. Categorizes moves into

From plugin
quant-garage
761 skills

Claude Code

$ npx -y skills add rgourley/quant-garage --skill sector-rotation-signal --agent claude-code

SKILL.md

sector-rotation-signal.SKILL.md
name: sector-rotation-signal
description: Change-detection layer on top of market-regime. market-regime reports current sector leadership as a snapshot; this skill tracks how the leadership order has changed over a rotation window (default 30 days) and flags sectors moving up or down the ranks. Categorizes moves into growth / value-cyclical / defensive / rate-sensitive buckets and generates a plain-English theme read. Use when the daily regime hasn't moved but the composition of leadership is shifting — the actual tradeable signal.

sector-rotation-signal

You hand over a rotation window (default 30 days) and get back the current 20-day RS rank per sector, the rank change over the window, and a rotation classification (rotating in, stable, rotating out). Bundled with a plain-English theme read.

Rank change is the leading signal. The tape already prices absolute strength; leadership rotation is what tells you the composition of strength is shifting.

When to invoke

  • The user asks "what sectors are rotating", "is the market rotating",

"growth vs value right now"

  • market-regime shows the same label two days in a row but you want

to know if the underlying composition is changing

  • Portfolio-review workflow, after market-regime — regime says WHAT,

rotation-signal says WHERE-IT'S-MOVING

  • A single-name research question wants sector context: "is my

Tech position bucking the sector rotation"

What you need

  • `MASSIVE_API_KEY` (Stocks Starter). One daily-aggs call per SPDR

sector ETF + SPY (12 calls total).

What you get back

**Layer 1 JSON** matching [`output-schema.json`](./output-schema.json). Per-sector: current 20-day RS rank, rank in the reference date, rank_delta, 20-day RS in basis points, secondary RS window, rotation classification, category tags.

**Layer 2 rendered table** sorted by current rank. Rotation column uses arrows (`↑`, `↑↑`, `↓`, `↓↓`, `stable`) so the visual read is immediate. Theme line above the table. See [`references/rendering.md`](./references/rendering.md).

How it works

1. **Fetch SPY + 11 sector ETFs** over `lookback_days` (default 252) using the same helpers as market-regime. 2. **Compute RS ranks on two reference days**: `now` (latest trading day) and `then` (latest trading day <= today - rotation_window). RS is `sector_return - spy_return` over the primary RS window (default 20 days), reported in basis points. 3. **Compute rank_delta** = rank_then - rank_now (positive means the sector moved UP the leadership order, i.e. rank number went DOWN). 4. **Classify each sector**: rotating_in_strong (delta >= +3), rotating_in (>= +2), stable (|delta| <= 1), rotating_out (<= -2), rotating_out_strong (<= -3). 5. **Generate theme read** based on which category buckets (growth, defensive, value-cyclical, rate-sensitive) are receiving inflows vs outflows.

Category tags

  • **growth**: XLK, XLY, XLC
  • **defensive**: XLP, XLU, XLV
  • **value_cyclical**: XLE, XLI, XLB, XLF
  • **rate_sensitive**: XLRE, XLU, XLF (overlap intentional)

Endpoints used

  • `GET /v2/aggs/ticker/{ticker}/range/1/day/{from}/{to}` for SPY +

11 sector ETFs

Doesn't handle (yet)

  • **A 1-position rank move is inside the noise floor.** Deliberately

classified as `stable`. Users who want fine-grain rotation should use a longer rotation window.

  • **SPDR sector ETFs are a proxy for the full sector universe.**

Real-world sector performance can diverge from the ETF (especially in Energy, where XLE is oil-major heavy).

  • **RS is past-return, not predictive.** Rotation captures a shift

in what's working, not what will work next.

  • **Rotation reads are heuristic.** Real regime classification

belongs in a dedicated macro tool; this is a change-detection surface, not a regime call.

Read more
@rgourley
Ships withquant-garage

Trade like a pro. Without the terminal. View the full landing page → Quant and equity research tools that run inside Claude, or behind your own UI.

Stars on GitHub

Momentum

stars in total
7
Star history of rgourley/quant-garage on GitHub, a chart by star-history.com

Other skills on quant-garage.

8-k-scanner

8-k-scanner

Scan SEC 8-K disclosures across a single ticker or a watchlist using Massive's pre-parsed disclosure taxonomy. Groups the…

analyst-tracker

analyst-tracker

Track sell-side analyst positioning on a name via Benzinga Analyst Ratings. Pulls every rating event over the lookback window,…

backtest-data-prep

backtest-data-prep

Build a clean, point-in-time, ready-to-backtest OHLCV dataset for a US equity universe across an arbitrary date window. Emits…

commodity-cycle

commodity-cycle

Single-commodity macro read. Answers "is this commodity in a winning or losing macro setup right now" and names the macro driver…

More skills from other plugins.

context-loader
Auto-invoked

context-loader

Search memories from earlier Pi sessions in this repository. Use it when earlier work may already explain the code, error,…

mem05d69k
@mem0ai@mem0aiInstall Skill
analyzing-ai-citations

analyzing-ai-citations

Answer AI citation and answer engine optimization (AEO) questions in PostHog: whether AI answer engines (ChatGPT, Claude, and an…

posthog12d41k
@posthog@posthogInstall Skill

Questions about sector-rotation-signal.

Which coding agents can use sector-rotation-signal?
sector-rotation-signal installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.