Market Breadth
Research > Market Breadth (DEVELOPER and above). backend/nseeod/breadth.py computes, for six universes and every
trading day since 1999, the share of stocks above their 20 / 50 / 100 / 200-day simple moving average and the cumulative
Advance-Decline line. It runs after every successful equity bhav copy (BhavProcessor._update_breadth, incremental, a few
seconds) and publishes the results as te_asset / te_price series (sub_type='breadth', codes BR-<universe>-<kind>), the same
way the TE-FO Index is published.
| Universe | Definition | History |
|---|---|---|
N50 | NIFTY 50 as on each date | 1999-05 |
NN50 | NIFTY Next 50 | 1999-02 |
MID150 | NIFTY Midcap 150 | 2013-06 |
SML250 | NIFTY Smallcap 250 | 2013-06 |
MICRO | Proxy: every other mainboard stock (typ 1, no ETFs) priced that day and not in NIFTY 500 that day. Not the NSE Microcap 250 index (no membership history is held); larger than 250 and includes illiquid names | 1999-02 |
N500 | NIFTY 500 | 1999-02 |
Kinds per universe: P20 P50 P100 P200 (% above), ADL (A/D line), ADV, DEC, N (stocks priced that day).
Method
- Prices:
eq_store.get_returns_panel(adjust='price')- split / bonus adjusted, symbol changes joined, ETFs excluded. The adjusted close is rebuilt from the returns; averages are taken over the stock's own rows. - % above N-day MA = members with close above their N-day SMA, divided by members that HAVE an N-day SMA that day. A stock with fewer than N rows of history (new listing, long suspension) is left out of that denominator, never counted as below.
- Advance = adjusted close above the previous close, decline = below, unchanged = equal. A stock's first row (no previous close) counts in none of them. ADL = running total of advances minus declines from the universe's first day.
- Members are
idx_members_on(index, date)intervals, so history is survivorship-free. - Sanity checks from the first run: NIFTY 500 advances on 2020-03-23 = 2 of 500, 2024-06-04 (election result) = 34, 2004-05-17 = 6, 2008-10-24 = 11. Decliners outnumber advancers by 1-2 points on an average day, so the cumulative ADL drifts down over years - read it against the index (divergences), not as an absolute level.
Run (from backend/)
python -m nseeod.breadth build [--dry] # full history (about 2 minutes), replaces the series; --dry writes nothing
python -m nseeod.breadth update # incremental: reloads ~520 days, rewrites the last 7 days and newer, continues the ADL
python -m nseeod.breadth status # latest values of every universe
Rebuild on each machine (nothing is copied between PC and VPS). After a corporate-action backfill run build once.
API / page
GET /api/breadth/universes, /api/breadth/series?universe=&from=&to=&smooth=50, /api/breadth/series.csv (DEVELOPER).
The chart follows a TradingView-style breadth indicator: lines for 20 / 50 / 100 / 200-day, a thick 50-day average of the % above
50-day line (p50s, smooth= parameter), and Overbought 80 / Midline 50 / Oversold 20 levels with light shading. A second
chart shows the A/D line, a third the index price (for MICRO the real NSE Microcap 250 index is shown as a reference only).