К основному содержанию
скилл CX Codex

sector-rotation — скилл для Claude Code: анализ секторов

Скилл sector-rotation для Claude Code сравнивает сектора NSE с NIFTY 50 по доходности и относительной силе. Запускается на запросы о ротации секторов, лидерстве отраслей и движении рынка к риску или защите.

MIT ★ 69 обновлён 2026-11-13

Установить в Claude Code · Через маркетплейс плагинов Все способы и платформы ↓
/plugin marketplace add Shubhamkumartrichy/claude-trading-skills-india
/plugin install india-trading-skills@india-trading-skills
Открыть на GitHub

Что делает sector-rotation

Скилл анализирует, какие сектора NSE набирают или теряют относительную силу по сравнению с NIFTY 50. Он показывает доходность за периоды от недели до 12 месяцев, положение в квадранте RS-Ratio и RS-Momentum, расстояние от 50- и 200-дневной средней, а также ширину участия компаний в секторе. В отчёте есть сравнение циклических и защитных отраслей и факторов midcap и smallcap.

Скрипт sectors.py получает котировки через yfinance или читает CSV-файлы индексов; для CSV достаточно даты и цены закрытия. Без установленного yfinance онлайн-запуск через Yahoo не сработает, зато данные можно подготовить заранее и обрабатывать офлайн. Скилл даёт контекст по сектору, а не выбирает отдельные акции или момент сделки.

Какие задачи решает

  • сравнить доходность секторов NSE с NIFTY 50
  • найти отрасли с растущей относительной силой
  • проверить, движется ли рынок к циклическим или защитным секторам
  • оценить, участвуют ли в росте midcap и smallcap
  • посмотреть ширину рынка внутри сектора

Примеры запросов агенту

  • Сравни сектора NSE с NIFTY 50 и покажи, где сейчас растёт относительная сила.
  • Проверь, рынок сейчас больше ориентирован на риск или на защитные сектора.
  • Оцени, опережают ли midcap и smallcap NIFTY 50.

Как установить sector-rotation

1Через маркетплейс плагинов

/plugin marketplace add Shubhamkumartrichy/claude-trading-skills-india
/plugin install india-trading-skills@india-trading-skills

Команда ставит плагин india-trading-skills целиком, со всеми его скиллами

2Через Skills CLI (Vercel)

npx skills add Shubhamkumartrichy/claude-trading-skills-india --skill sector-rotation -a claude-code

3Вручную: положить файлы

~/.claude/skills/sector-rotation/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/sector-rotation/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о sector-rotation

Как установить sector-rotation в Claude Code?

Добавьте маркетплейс командой /plugin marketplace add Shubhamkumartrichy/claude-trading-skills-india, затем установите скилл: /plugin install india-trading-skills@india-trading-skills.

Что делает sector-rotation?

Скилл сопоставляет сектора NSE с NIFTY 50 по доходности и относительной силе. Также показывает квадрант RS, тренд относительно скользящих средних и ширину участия компаний.

Что нужно для работы sector-rotation?

Для онлайн-загрузки котировок нужен Python 3 и установленный yfinance. В офлайн-режиме скрипт читает CSV индексов; каждому файлу нужны дата и цена закрытия.

Исходный текст

SKILL.md · MIT
---
name: sector-rotation
description: |
  Sector rotation across NSE sectoral and thematic indices (BANK, IT, AUTO, PHARMA, FMCG, METAL,
  REALTY, ENERGY, PSU BANK, FIN SERVICE, INFRA, PSE, CONSUMPTION and more) against NIFTY 50:
  1W–12M returns, relative strength, an RRG-style RS-Ratio/RS-Momentum quadrant with recent
  quadrant changes, distance from 50/200 DMA, cyclical-vs-defensive tilt, the midcap/smallcap size
  factor, and member breadth. sectors.py works offline from niftyindices.com CSVs or via yfinance.

  Use when the user asks: "which sectors are leading", "sector rotation", "where is money moving",
  "is the market risk-on or defensive", "are midcaps and smallcaps outperforming", "RRG for NSE
  sectors", "which sector should I focus on", "is IT/PSU bank/metal turning", or wants sector
  context before picking stocks.
---

# Sector Rotation (NSE)

Find where relative strength is building and where it is fading, then fish for setups in the
strongest groups. This is a context filter: it tells you which pond, not which fish or when.

## 1. Run it

```bash
python3 scripts/sectors.py rotation                       # Yahoo (pip install yfinance), default universe
python3 scripts/sectors.py rotation --csv-dir nse_idx/    # offline: one CSV per index + "NIFTY 50.csv"
python3 scripts/sectors.py rrg --sectors IT,BANK,METAL,PSUBANK --tail 10   # weekly trail, for plotting
python3 scripts/sectors.py breadth --members members.csv --csv-dir stocks/
python3 scripts/sectors.py universe                       # tickers and Yahoo coverage
```
`--json` gives raw output. Options: `--weeks 8` (quadrant-change look-back), `--smooth 3 --window 10
--momentum 4` (RRG settings, weeks), `--period 2y`, `--ticker NAME=TICKER` / `--map file.json` to
override or add tickers (`--ticker NIFTY=^CRSLDX` benchmarks against NIFTY 500).

**Offline CSVs:** download each index from niftyindices.com (Historical Data, price index). Name each
file after the index ("NIFTY IT.csv", "NIFTY PSU BANK.csv"); names are matched to keys
automatically. Only a date and a close column are needed. Open/High/Low, "Shares Traded" and
"Turnover" are ignored, and no volume is required. Dates like `30 Oct 2026`, `30-Oct-2026` or ISO all
parse. Daily data is best; weekly closes also work (DMAs become 10/40-week averages).

**Yahoo coverage (probed 2026-10-31).** History available: `^NSEI`, `^NSEBANK`, `^CNXIT`, `^CNXAUTO`,
`^CNXPHARMA`, `^CNXFMCG`, `^CNXMETAL`, `^CNXREALTY`, `^CNXENERGY`, `^CNXPSUBANK`, `^CNXINFRA`,
`^CNXPSE`, `^CNXCONSUM`, `^CNXMNC`, `NIFTY_FIN_SERVICE.NS`, `NIFTYMIDCAP150.NS`, `NIFTYSMLCAP250.NS`.
Quote only, no history: NIFTY MEDIA, PRIVATE BANK, HEALTHCARE, OIL & GAS, CPSE, INDIA DEFENCE,
CAPITAL MARKETS, MIDCAP 100 and SMALLCAP 100. Supply these as CSVs. Run `universe` for the full map.

## 2. What it measures

| Metric | Definition |
|---|---|
| Returns | 1W/1M/3M/6M/12M = 5/21/63/126/252 sessions; `rel` = (1+sector)/(1+NIFTY) − 1 |
| RS line | 100 × sector ÷ NIFTY, sampled at each week's last close |
| RS-Ratio | 100 × EMA3(RS) ÷ SMA10 of that EMA. Above 100 = relative trend above its 10-week norm |
| RS-Momentum | 100 × RS-Ratio now ÷ RS-Ratio 4 weeks ago. Above 100 = relative trend improving |
| Quadrant | Leading (≥100/≥100) → Weakening (≥100/<100) → Lagging (<100/<100) → Improving (<100/≥100) |
| Trend | Uptrend, Downtrend, Recovering (above a falling 50 DMA), Pullback (below a rising one), Mixed |
| Rank | (RS-Ratio − 100) + (RS-Momentum − 100) |

Both axes are percentages and are not volatility-scaled, so REALTY and PSU BANK swing wider than
FMCG. Compare quadrant, direction and weeks in quadrant, not raw distance. Rotation usually runs
clockwise. A diagonal jump (Leading straight to Lagging) is a whipsaw near the centre. That was about
9% of quadrant changes on 10 years of NSE data; wait a second week before trusting it.

**Reading it:** Improving with a rising RS-Ratio is the early long watch-list. Leading plus an Uptrend
is where breakouts follow through. Weakening means tighten trails and stop adding. Lagging plus a
Downtrend is a short or avoid list. A sector that is only Improving but still below its 200 DMA is a
bounce until its price trend confirms.

## 3. Rotation read (India)

- **Cyclical / domestic beta:** METAL, REALTY, PSU BANK, AUTO, INFRA. Their earnings ride credit
  growth, government capex, commodity prices and rate cuts.
- **Defensive:** IT, PHARMA, HEALTHCARE, FMCG. IT and pharma are dollar earners that gain when the
  rupee weakens, and they often hold up when FIIs sell India. FMCG has steady staples demand. IT is
  defensive only versus the Indian cycle: it still tracks US tech spending.
- **Kept out of the tilt:** BANK, FIN SERVICE and PVT BANK. These heavyweights are about a third of NIFTY
  and largely *are* the benchmark. ENERGY and OIL & GAS track crude. PSE, CPSE, DEFENCE, CAPITAL
  MARKETS, CONSUMPTION, MNC and MEDIA are reported as themes.
- **Tilt:** cyclicals' average RS-Ratio minus the defensives'. Above +0.5, with the 3M relative
  return agreeing, the read is risk-on. Below −0.5 it is defensive. Anything else is mixed.
- **Size factor:** MIDCAP 150/SMALLCAP 250 vs NIFTY. Both outperforming means broadening, which is
  healthy retail and DII risk appetite. Both lagging means narrowing into large caps, which often
  precedes or accompanies corrections. Smallcaps rolling over first is an early warning.

| Driver | Sectors to check | Typical read |
|---|---|---|
| FII flows (NSDL fortnightly data) | BANK, FIN SERVICE, IT | FII buying lifts private banks first; persistent selling drags them while DII-held mid/small caps hold up |
| Rupee (USD/INR) | IT, PHARMA vs importers | Weak rupee helps exporters' margins and hurts OMCs and capital-goods importers |
| Crude (Brent) | OIL & GAS, ENERGY, paints, tyres, aviation | Falling crude helps OMCs (BPCL, HPCL, IOC), paints and tyres; rising crude helps upstream (ONGC, Oil India) |
| Monsoon and rural demand (IMD, Jun–Sep) | FMCG, AUTO (tractors, 2-wheelers) | A good monsoon helps rural volumes; watch the Sep–Nov festive season |
| Union Budget (1 Feb) and capex | PSE, CPSE, INFRA, DEFENCE, PSU BANK | Capex or divestment themes run into the Budget and can fade after it |
| RBI rate cycle (MPC) | BANK, REALTY, AUTO, NBFCs (FIN SERVICE) | Cuts help realty, auto and NBFCs; banks' margins can compress early in a cutting cycle |
| Global metals and China | METAL | LME prices, China stimulus and steel safeguard duties |

## 4. Breadth inside a sector

`breadth` reports the percentage of members above their 50 and 200 DMA. `--members` takes a CSV of
`sector,symbol`, and `--csv-dir` holds one CSV per stock. Create the stock CSVs with
`../technical-analysis/scripts/ta.py fetch --symbol TCS --out stocks/TCS.csv`. Membership comes from
the index factsheet on niftyindices.com. An index Leading on fewer than 50% of members above their
50 DMA is being carried by one or two heavyweights, so its leadership is narrow.

## 5. How other skills use this

- **`market-pulse`:** fill the "Sectors" line with Leading/Improving vs Lagging, the tilt and the
  size read from `rotation`, instead of ranking 1-week returns by hand. Suggested wording there:
  "Sectors: run sector-rotation; quote quadrant leaders, tilt and size factor".
- **`india-market-analyst`:** at the Context stage, look up the stock's sector quadrant. Prefer longs
  in Leading or Improving sectors that are in an Uptrend. Flag a long in a Lagging, Downtrend sector
  as swimming against the tide. Then hand off to `technical-analysis` for the stock (and
  `multi-timeframe-analysis` on the sector index itself).

## Caveats

- NSE reconstitutes sector indices semi-annually and changes weights through capping. Very long RS
  histories mix different baskets. Concentrated indices (NIFTY IT, BANK, METAL) can turn on one stock.
- Yahoo has gaps and late bars for some indices. The script warns when an index ends more than 3 days
  before NIFTY, or when the data is stale. Prefer niftyindices.com CSVs for anything you act on.
- A mid-week run treats the partial week as the latest weekly point. Re-check after Friday's close.
- Price indices exclude dividends, so high-yield PSE and energy look slightly weaker than their total
  return. Relative strength is not absolute: a Leading sector in a falling market can still lose money.

## Output

```
Sector rotation vs NIFTY 50: data to [date] ([source])
Leading: .. | Improving: .. | Weakening: .. | Lagging: ..
Tilt: [Risk-on/Defensive/Mixed]: [spread] | Size: [Broadening/Narrowing/Mixed]
Key changes ([N] weeks): [sector from→to (week)]
Watch-list: [Improving + rising RS-Ratio] | Avoid: [Lagging + Downtrend]
Drivers to verify: [FII flows / USD-INR / crude / RBI / Budget, with sources]
```

_Educational analysis, not investment advice. Data: [sources + timestamps]._

© Shubham Kumar · MIT · Shubhamkumartrichy/claude-trading-skills-india

Похожие скиллы

Каталог скиллов SKILL.md →
infisical-secret-rotation Infisical Скилл infisical-secret-rotation помогает настроить регулярную смену существующих паролей и ключей в Infisical с записью новых значений в хранилище. CX Codex +1 255установок sector-analyst tradermonty Скилл sector-analyst для Claude Code и Codex — анализирует ротацию секторов и фазы рыночного цикла по данным из CSV без ключей API. Выявляет растущие секторы, перекупленность и текущую стадию цикла. CX Codex +1 3 900установок sector-overview официальный anthropics Скилл sector-overview создаёт развёрнутые отчёты о структуре отраслей: размер рынка, ключевых игроков, конкурентную динамику и тренды. Пригодится аналитикам, инвесторам и стратегам для клиентских презентаций и исследований. CX Codex +1 1 300установок sector-pe-ratios OctagonAI Скилл sector-pe-ratios для Claude Code запрашивает мультипликаторы P/E по секторам и биржам через Octagon MCP. Помогает оценить акции относительно рынка. CX Codex +1 260установок sector-performance-snapshot OctagonAI Скилл sector-performance-snapshot для получения финансовых показателей компаний по секторам и биржам через Octagon MCP. Собирает данные о выручке, EBITDA, чистой прибыли, капитализации и стоимости предприятия за один запрос. CX Codex +1 257установок API Key and Credential Rotation Runbook (JSON) f Промпт API Key and Credential Rotation Runbook (JSON) для ChatGPT, Claude.ai и Claude Code помогает составить план смены секретных данных. Он формирует JSON-файл с шагами ротации, проверками и планом отката. GP ChatGPT ★ 178 201звёзд репо

Из того же набора36

Весь набор →
momentum-scanner Скилл momentum-scanner для Claude Code ищет импульсные движения и сильные акции NSE/BSE. Запускается на запросы о пробоях, гэпах после новостей и рейтинге относительной силы. CX Codex +1 ★ 69звёзд репо trading-discipline Скилл trading-discipline для Claude Code проверяет торговый план до сделки и оценивает текущий риск по журналу. Он подключается на вопросы о входе в сделку, дневном лимите убытка или серии потерь. CX Codex +1 ★ 69звёзд репо event-calendar Скилл event-calendar для Claude Code собирает календарь событий, способных повлиять на индийский рынок. Запускается на запросы о сроках экспирации, заседании RBI, макроданных и риске события в торговом окне. CX Codex +1 ★ 69звёзд репо thesis-tracker Скилл thesis-tracker для Claude Code записывает торговые идеи по индийским акциям и F&O как проверяемые тезисы. Запускается по просьбе добавить идею, проверить открытые позиции или разобрать закрытую сделку. CX Codex +1 ★ 69звёзд репо market-breadth Скилл market-breadth для Claude Code оценивает, сколько акций NSE и BSE участвует в движении индекса. Запускается при запросах о ширине рынка, соотношении роста и падения или участии компаний малой капитализации. CX Codex +1 ★ 69звёзд репо pair-trading Скилл pair-trading для Claude Code проверяет пары акций NSE на коинтеграцию и оценивает спред. Запускается по запросам о хедж-коэффициенте, z-score или плане парной сделки. CX Codex +1 ★ 69звёзд репо exhaustion-reversal Скилл exhaustion-reversal для Claude Code оценивает, выдыхается ли движение акции на NSE/BSE, и составляет план выхода или входа. Включается при запросе проверить перегретый рост, сигнал на разворот или реакцию акции на новости. CX Codex +1 ★ 69звёзд репо macro-regime Скилл macro-regime для Claude Code определяет долгосрочный макрорежим индийского рынка акций по месячным данным. Запускается при запросах о ширине рынка, доходностях облигаций, рупии и нефти. CX Codex +1 ★ 69звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой