Skip to content
Back to skills

Sector Rotation

ASecurity

Place the eleven US sector ETFs on a relative-rotation map against the S&P 500, from Webull weekly prices and the bundled calculator. Use when the user runs "/sector-rotation" or asks "เงินไหลไปกลุ่มไหน", "กลุ่มไหนนำตลาด", "sector rotation", "กลุ่มไหนกำลังแข็งแรง", "ทำ RRG ให้หน่อย", "which sectors are leading", "which sectors are lagging", "relative rotation". Also works for any group of symbols against any benchmark.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 27, 2026
ai-agentspythongobash

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned November 27, 2026

npx -y skills add nutdnuy/qc-webull-desk --skill sector-rotation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sector Rotation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sector Rotation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nutdnuy-sector-rotation/badge)](https://www.skillsdirectory.com/skills/nutdnuy-sector-rotation)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sector-rotation
description: Place the eleven US sector ETFs on a relative-rotation map against the S&P 500, from Webull weekly prices and the bundled calculator. Use when the user runs "/sector-rotation" or asks "เงินไหลไปกลุ่มไหน", "กลุ่มไหนนำตลาด", "sector rotation", "กลุ่มไหนกำลังแข็งแรง", "ทำ RRG ให้หน่อย", "which sectors are leading", "which sectors are lagging", "relative rotation". Also works for any group of symbols against any benchmark.
metadata:
  version: "0.1.0"
  author: QuantCorner
---

# Sector rotation

Answer "which sectors have been stronger or weaker than the market lately, and
in which direction are they moving".

Read `references/desk-rules.md` first and run its connection gate.

## Universe

Default: benchmark SPY and the eleven Select Sector SPDR ETFs.

| Symbol | Sector | Symbol | Sector |
|---|---|---|---|
| XLK | Technology | XLV | Health care |
| XLF | Financials | XLY | Consumer discretionary |
| XLC | Communication services | XLP | Consumer staples |
| XLI | Industrials | XLE | Energy |
| XLU | Utilities | XLB | Materials |
| XLRE | Real estate | | |

The user may give another group and benchmark (for example country ETFs
against ACWI, or their own holdings against SPY). At least three members.

## Collect

`get_stock_bars` with `category` US_ETF, `timespan` W, `count` 30, at most 20
symbols per call; the benchmark must be in every call or fetched once and
reused. Leave `real_time_required` off so the unfinished week is not included.
If the first row is the current, unfinished week anyway, drop it and say so.

## Calculate

Save the closes to `bars.txt`. Either save the tool response as it came, or
write the compact form (cheaper):

```
# SPY
2026-11-13,754.37
2026-11-20,689.81
# XLK
2026-11-13,170.28
```

Then run:

```bash
python3 scripts/rotation.py bars.txt --benchmark SPY --out rotation.json
```

Check two closes per symbol against the tool response before running. Use the
script's numbers as they are. Members it lists under `skipped` are left out of
the map and named in the report.

## Read the result

- **Leading:** stronger than the benchmark and still gaining.
- **Weakening:** stronger, but losing pace.
- **Lagging:** weaker and still losing.
- **Improving:** weaker, but gaining.

Report members that changed quadrant over the trail (`previous_quadrant`
differs from `quadrant`), and the 4-week and 12-week relative returns that sit
behind the picture. Note how tightly the members cluster around 100: when all
are close to the centre there is little rotation to speak of.

The method is an RRG-style approximation from weekly closes. Say this in the
report; do not call it RRG without the qualifier. A quadrant describes recent
weeks and does not forecast the next ones.

## Deliver

Chat: which sectors lead and lag, and the one that changed most, in three sentences.

Report:

- KPIs: number of members in each quadrant, as-of week.
- `scatter` with `centre` [100, 100], `x_label` "Relative strength", `y_label`
  "Momentum", `quadrants` ["Improving", "Leading", "Lagging", "Weakening"];
  `highlight` the member furthest into Leading.
- `table`: symbol, sector, quadrant, previous quadrant, strength, momentum,
  relative return 4 weeks, relative return 12 weeks (signed percentages).
- `bars` of 12-week relative return (signed).
- `limits`: the script's notes; sector ETFs are weighted by company size, so
  one or two giants can drive a sector.

Close with the reminder line from desk rules, section 8.

Files in this skill

  • SKILL.md3.5 KB
  • assets/partner.json1.1 KB
  • references/desk-rules.md11.2 KB
  • scripts/bars_io.py3.3 KB
  • scripts/render_report.py22.4 KB
  • scripts/rotation.py4.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.