Skip to main content
skill CX Codex

market-valuation — Claude Code skill: market analysis and install

The market-valuation Claude Code skill measures valuation and speculative heat in Indian equities using NSE index history and other market figures. It activates for questions about NIFTY valuations, IPO activity or a possible bubble.

MIT ★ 69 updated 2026-11-13

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add Shubhamkumartrichy/claude-trading-skills-india
/plugin install india-trading-skills@india-trading-skills
Open on GitHub

What market-valuation does

The skill calculates historical P/E, P/B and dividend-yield percentiles, compares earnings yield with the 10-year government-bond yield, and relates Indian market capitalisation to GDP. It also combines valuation, volatility, market breadth, IPO activity, investor flows and borrowed exposure into a froth score and a market phase.

Calculations run through valuation.py, which requires Python 3 and dated market data in CSV or JSON files. Historical index files must be downloaded in a browser because NSE and Nifty Indices block scripts. P/E windows that cross NSE’s methodology change on 31 March 2021 are marked; the post-change record covers about one market cycle.

What it helps with

  • check NIFTY valuation against its historical range
  • compare index earnings yield with government-bond yields
  • measure Indian market capitalisation against GDP
  • assess market froth using valuation, IPOs and leverage

Example prompts for the agent

  • Check whether NIFTY looks expensive using its P/E, P/B and dividend yield.
  • Compare NIFTY’s earnings yield with the 10-year government-bond yield.
  • Calculate Indian market froth from froth_inputs.json.

How to install market-valuation

1Plugin marketplace

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

This installs the whole india-trading-skills plugin with all its skills

2Skills CLI (Vercel)

npx skills add Shubhamkumartrichy/claude-trading-skills-india --skill market-valuation -a claude-code

3Manually: put the files in place

~/.claude/skills/market-valuation/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/market-valuation/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about market-valuation

How do I install market-valuation in Claude Code?

Add the marketplace with /plugin marketplace add Shubhamkumartrichy/claude-trading-skills-india, then install the skill with /plugin install india-trading-skills@india-trading-skills.

What does market-valuation do?

It analyses Indian equity valuations against historical measures and produces a market-froth score. It also compares earnings yield with government-bond yields and market capitalisation with GDP.

What does market-valuation require?

It requires Python 3 and prepared CSV or JSON files containing dated market figures. Historical NSE files are downloaded in a browser; WebSearch or WebFetch is used to look up current figures.

Source text

SKILL.md · MIT
---
name: market-valuation
description: |
  How expensive and how frothy the Indian market is, from files you download and numbers you look
  up: NIFTY (or any NSE index) P/E, P/B and dividend-yield percentiles over 5/10/all years with a
  cheap/fair/expensive/extreme band, handling NSE's 2021 switch to consolidated P/E; earnings yield
  vs the 10-year G-sec; market cap to GDP with India reference levels; and a 0–100 froth score from
  valuation, India VIX, breadth, IPO and SME-IPO heat, SIP and demat growth, F&O activity and MTF
  leverage, mapped to a phase and a risk posture. valuation.py works offline.

  Use when the user asks: "is the market expensive", "NIFTY PE percentile", "is NIFTY overvalued",
  "are we in a bubble", "is there froth in small caps", "market cap to GDP India", "Buffett
  indicator India", "bond yield vs earnings yield", "should I slow down my buying", "is the IPO
  market too hot", or wants valuation context before adding equity exposure.
---

# Market Valuation and Froth (India)

`market-regime` says what the trend allows today. This skill says how much is already priced in and
how crowded the trade is. Rich valuations and hot behaviour lower future returns and raise the
damage when the trend breaks, but they rarely say when.

## Commands

```bash
python3 scripts/valuation.py pe --csv nifty50_pe.csv                    # percentiles, bands, basis break
python3 scripts/valuation.py pe --csv nifty50_pe.csv --since 2021-03-31 --windows 3,5 --json
python3 scripts/valuation.py yieldgap --pe 22.4 --gsec 6.55             # one-off reading
python3 scripts/valuation.py yieldgap --csv nifty50_pe.csv --yields gsec10y.csv   # + gap percentile
python3 scripts/valuation.py mcap-gdp --mcap 470 --gdp 357 --gdp-basis "FY26 provisional"
python3 scripts/valuation.py froth --inputs froth_inputs.json --as-of 2026-11-12
python3 scripts/valuation.py froth --csv nifty50_pe.csv --vix 11.5 --mtf-yoy 54 --inputs-as-of 2026-11-10
```
Common flags: `--json` (strict JSON), `--as-of DATE`, `--date-format dmy|mdy`; `pe`/`yieldgap` also take
`--since`, `--windows 5,10`, `--bands 25,75,90`, `--index "NIFTY 50"`. `froth` takes every input as a
flag (`--help` lists them with units), `--breadth-json` (output of
`../market-breadth/scripts/breadth.py status --json`), `--max-age-days 45` and `--drop-stale`. Errors
exit 2 with one `error:` line. Dates are never guessed: slash dates need a day above 12 somewhere in
the column, or `--date-format`.

## Where each number comes from

Fetch current values with WebSearch/WebFetch, cite each source and date, and never invent a missing
one. nseindia.com and niftyindices.com block scripts, so the user downloads those CSVs in a browser.

| Input | Source | Notes |
|---|---|---|
| P/E, P/B, div yield history | niftyindices.com → Reports → Historical Data → "P/E, P/B & Div Yield" (choose index and range) | Header `Index Name, Date, P/E, P/B, Div Yield %` (seen on the report page); the old NSE archive file used `Date, P/E, P/B, Div Yield`. Columns are matched by keyword, several files merge, and note rows are kept |
| 10-year G-sec yield | RBI DBIE, FBIL/CCIL benchmark, or an Investing.com "India 10Y" export (`Date, Price, …`; Price is the yield) | Percent, e.g. 6.55 |
| Market cap, GDP | BSE all-listed market cap (₹ lakh crore); MoSPI nominal GDP | Say which GDP: trailing four quarters, last fiscal year, or estimate |
| Mid/small-cap P/E | Same niftyindices report for NIFTY Midcap 150 and Smallcap 250 | Same date as the NIFTY 50 P/E |
| India VIX | NSE close | |
| IPOs | Exchange listing pages, IPO trackers | Mainboard listings in the last 3 months and their listing-day gain; SME subscription multiples |
| SIP inflow | AMFI monthly note (around the 10th) | Same month a year earlier for growth. Sep-2026 was a record ₹32,490 cr |
| New demat accounts | CDSL and NSDL monthly figures, SEBI Bulletin | Total was about 23.8 crore in Aug-2026 (press reports) |
| F&O activity | NSE Market Pulse, SEBI studies | Individual traders' premium turnover or unique-trader count, year on year |
| MTF book | NSE/BSE daily margin-trading reports; monthly CareEdge notes | NSE+BSE book was ₹1.48 lakh cr in Aug-2026 vs ₹96,000 cr a year earlier (CareEdge) |

Inputs file: JSON `{"as_of": "2026-11-10", "inputs": {"vix": 11.5, "mtf_book": {"value": 148000,
"as_of": "2026-10-31", "source": "NSE"}}}` or CSV `input,value,as_of,source`. Each input gets an
`as_of`. Components older than `--max-age-days` are flagged stale (year-ago bases, 12-month averages
and annual GDP are exempt).

## The 2021 P/E basis break

NSE Indices' press release of 23-Feb-2021 moved index P/E from trailing-four-quarter standalone to
consolidated earnings (standalone only where no consolidated figures exist), from 31-Mar-2021.
Consolidated profits include subsidiaries, so NIFTY's P/E dropped overnight (reported as roughly 40 to
33) with no price move; P/B and dividend yield were not part of the change. `pe` marks windows that
span the switch (†), takes its headline from consolidated-only history, and prints the P/E step
beside the P/B change. `--since 2021-03-31` drops the old basis everywhere. Post-switch history is
about five years (one cycle): treat percentiles as provisional and lean on P/B for long comparisons.

## What it computes

- **Percentiles:** share of observations at or below today. "Richness" flips dividend yield and yield
  gap so higher always means more expensive. Bands: cheap < 25 ≤ fair < 75 ≤ expensive < 90 ≤
  extreme. "Richer" is the share of history that was more expensive than today.
- **Yield gap:** 100 ÷ P/E − 10-year G-sec, the bond ÷ earnings-yield ratio, the P/E at which the gap
  would be zero and, with both files, its percentile. In India the gap is usually negative.
  Published "rich" thresholds conflict (about 1–3 points), so read it against its own history.
- **Market cap ÷ GDP:** bands cheap < 60, fair 60–100, elevated 100–120, expensive 120–140, extreme
  140+. References: long-period average about 75–87% (Motilal Oswal notes, rising as years are
  added); about 55% at the Mar-2020 low; 149% at the Dec-2007 peak; 130–150% in 2024–25.
- **Froth score:** sub-scores 0–100 from fixed anchors, weighted, re-normalised over what you supply,
  with coverage and confidence (high ≥ 75% of weight, low < 50%).

| Group | Components (weight) | Why |
|---|---|---|
| Valuation 40 | P/E percentile 16, yield gap 8, mcap/GDP 8, mid/small-cap P/E premium over large 8 | Most objective, but slow and it can stay high for years |
| Leverage 12 | MTF book growth year on year | Borrowed money forces selling in a fall |
| Issuance 17 | Mainboard IPO rate and listing gain 10; SME subscription 7 | Supply rises to meet demand near tops |
| Retail 18 | SIP growth 6, new demat accounts 6, F&O activity 6 | New money and speculation |
| Complacency 13 | India VIX (low scores high) 8, breadth score 5 | Calm, broad rallies get crowded |

Phases: < 20 Depressed, 20–39 Normal, 40–59 Warm, 60–79 Frothy, 80+ Euphoric. Each phase maps to a
size multiplier on the `market-regime` allowance (1.0, 1.0, 0.8, 0.5, 0.25) and to stop, IPO and
leverage guidance. This is risk management, not a market call.

## Reading it in India

- **SIP money props up multiples.** Since 2020, monthly SIPs have grown into a steady domestic bid
  that absorbs FII selling (see `fii-dii-flows`). That has kept P/E above its old averages for longer,
  so "expensive" alone has been a poor reason to sell. Watch for SIP growth stalling while valuations
  stay high.
- **Froth shows up in small caps, SME issues and leverage first.** 2007: market cap to GDP peaked
  near 149% in Dec-2007 amid an IPO rush, before the 2008 crash. 2018: the BSE Smallcap index peaked
  on 15-Jan-2018 and fell about 35% by mid-2019 while NIFTY held up. 2021: record demat openings,
  new-age tech IPOs and a retail F&O surge (SEBI studies later found about 9 in 10 individual F&O
  traders lost money). 2024: on 11-Mar-2024 the SEBI chairperson warned of froth in small and mid
  caps and their funds had to publish stress tests; SME IPOs drew hundreds of times subscription (a
  two-showroom dealer drew about 419×) and NSE capped SME listing-day prices at 90% over issue.
- **Low VIX is not safety.** India VIX at record-low levels (near 10 in 2023 and 2025) meant
  complacent option pricing, not low risk.

## How other skills use it

- `market-regime` sets the exposure ceiling; the froth phase scales new position size within it.
  Frothy plus "Uptrend under pressure" is the combination to respect most.
- `market-breadth`: feed its `status --json` to `--breadth-json`. A frothy score with narrowing
  breadth means the crowd is concentrated in fewer names.
- `fii-dii-flows`: DII absorption explains how valuations stay high despite FII selling. Absorption
  failing while the score is Frothy is a warning.
- `macro-regime`: rates and the G-sec yield move the yield gap. Check it before calling equities
  cheap or dear relative to bonds.
- `ipo-analysis`: Frothy or Euphoric means skipping listing-gain applications and SME issues.
- `position-sizing` and `trailing-stops` apply the posture: smaller risk per trade, tighter trails.

## Limits

Valuation is a poor short-term timing tool: markets stay expensive or cheap for years. Percentiles
depend on the history loaded. The froth anchors are judgement calls, not fitted values. Monthly
inputs lag by four to six weeks. Comparisons across the 2021 P/E switch are unreliable.

## Output

```
Valuation ([index], [date], source): P/E x (pctile p over [window], band), P/B y, div yield z%
Yield gap: EY e% − G-sec g% = d pp (pctile q) | Mcap/GDP r% ([band], GDP basis)
Froth: s/100 [phase] (coverage c%, confidence) | hot: [..] | cool: [..] | posture: [size ×m, stops, IPOs]
```
_Educational analysis, not investment advice. Data: [sources + dates]._

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

Similar skills

SKILL.md skills catalog →

From the same set36

The whole set →
market-breadth This Claude Code skill measures how many NSE and BSE stocks are moving with an index. It runs for questions about market breadth, advances versus declines, or midcap participation. CX Codex +1 ★ 69repo stars pair-trading The pair-trading Claude Code skill tests NSE stock pairs for cointegration and measures their spread. It responds to requests for hedge ratios, z-scores, or a pair-trade plan. CX Codex +1 ★ 69repo stars exhaustion-reversal exhaustion-reversal is a Claude Code skill that scores fading NSE/BSE stock moves and maps entry or exit plans. It activates for questions about rallies, reversals, or news reactions. CX Codex +1 ★ 69repo stars macro-regime The macro-regime Claude Code skill classifies the structural regime of Indian equities from monthly market and macro data. It runs for questions about breadth, rates, the rupee, or crude. CX Codex +1 ★ 69repo stars fii-dii-flows The fii-dii-flows Claude Code skill reads Indian equity flow data for FII/FPI and DII from downloaded CSVs. It responds to requests about institutional selling, futures positions, holdings changes, and stock deals. CX Codex +1 ★ 69repo stars backtest-lab The backtest-lab Claude Code skill tests rule-based swing strategies on NSE and BSE daily data. It activates for requests to backtest a rule, inspect drawdowns, or account for trading charges. CX Codex +1 ★ 69repo stars indian-market-structure The indian-market-structure Claude Code skill explains how India’s stock markets operate. It answers questions about NSE and BSE sessions, order types, settlement, and trading restrictions. CX Codex +1 ★ 69repo stars india-market-analyst The india-market-analyst Claude Code skill analyses Indian stocks, indices and derivatives. It routes trade questions through the relevant market-analysis steps. CX Codex +1 ★ 69repo stars

Project sponsors

Companies that keep this analytics open