Adjusted stock prices
Code: pipeline/tipsheet/compute/prices.py and compute/prices_qa.py.
Output: .cache/derived/equity_prices_adjusted.parquet (about 11.2 million rows: 5,535 companies, 7,934 sessions, 1994-11-03 to date).
This panel is not published directly. It is the input to stock breadth.
Sources
- NSE equity bhavcopy: every session from 1994-11-03. It comes from five datasets:
- four sealed eras: 1994–2004, 2005–2012, 2013–2018 and 2019–2022
nse_bhavcopyfrom 2022-06, updated daily
- Corporate actions: stocks.events (
stocks_events_corporate_actions, about 137,000 events for 1995–2026). - Renames: NSE’s
symbolchange.csv, joined as of each date, so a company keeps one identity across symbol changes.
Method
-
Stitch the eras. Where two series overlap, a fixed series priority decides which one is used (EQ first, then BE and the others).
-
Turn each corporate action into a price factor. Splits, bonuses, consolidations, rights (at the theoretical ex-rights price) and demergers (from the price gap).
-
Gate every factor on the price itself. A factor is applied only if the ex-date opening gap agrees with it within ×1.25.
- stocks.events sometimes dates the ex-date a session early or late, so a rejected factor is re-tested on the next seven calendar days.
- Factors that still fail are rejected and listed for review. These are mostly preference-share “bonuses”, such as TVS Motor’s 2025 4:1, where the price did not move.
-
Read every exchange’s record. stocks.events keeps one row per action, tagged with the exchanges that reported it. Rows tagged only BSE count too, because a split applies to the company on both exchanges, but they are matched by ISIN only, never by symbol. Until 27 October 2026 only NSE-tagged rows were read, which dropped ITC’s 2005 bonus, KRBL’s 2010 split and Ambuja’s 2005 bonus, among others.
-
Look for a missing companion. Companies often split and issue bonus shares on the same day, and the source tends to record only one of the two. When a recorded split or bonus fails the price gate, and the leftover gap is within 10% of a single split or bonus, both are applied. ITC’s 2005 1:2 bonus came with a split from ₹10 to ₹1, so the combined factor is 1/15. 28 actions are adjusted this way, flagged
with_companion. -
Infer actions the publisher missed. A split, bonus or consolidation is inferred from the price only when all of these hold:
- the prior close is at least ₹10 and the previous trade at most seven days earlier
- the close is at most 55% of the prior close (or at least 180%), and the open at most 75% (at least 133%). With price bands of 20% or less, a crash opens near the prior close and falls during the day: Satyam in 2009 and Yes Bank in 2020 opened 0–10% down. A split shows up in the opening price.
- the new level holds for five sessions (within 25%, or 50% when the open itself gapped past 55%)
The factor is the nearest single split or bonus (within 4% of the close, failing that the open; 10% for ratios of ¼ or less). Failing that, it is the nearest split-and-bonus pair within 6%, and failing that the close-to-close ratio, flagged
inferred_from_gap. The close is tried first because opening prices on split days are often off: ETF splits regularly open 20% away from the new level.Ratios of 0.6–0.75 are never inferred, because a 25–40% fall can be real. They go to a review list instead.
-
Demergers without a ratio use the opening gap, unless the stock then fell another 20% or more in the session. Then the open was held up by the price band and the ex-day close is used instead. Adani Enterprises in 2015 opened 10% down and closed 83% down.
-
Clean zero prices. Zero open, high or low prices are treated as not reported. 1990s files print 0 when only a close was traded.
What I checked
- NSE’s
PREVCLOSEis not adjusted for corporate actions. I checked the Reliance 2009 bonus, the HDFC Bank 2025 bonus, the Nestlé 2024 split and 33 demergers. So factors must come from an events source.PREVCLOSEis still useful as a completeness check. A day on which most of the market’sPREVCLOSEdiffers from the prior close means a missing session. That check found six missing weekend sessions and a file dated with a two-digit year.
- Against Kite, 2003–2026, I compared 150 random stocks that had corporate actions, counting only persistent steps. 116 agree.
- Most of the rest are errors on Kite’s side: steps that reverse, and dividend adjustments on PSU stocks.
- Two are mine: Kansai Nerolac’s 2004 bonus, which no source recorded, and Zee Media’s 2010 demerger, which I under-adjusted. The demerger rule in step 7 now takes Zee Media’s ex-day close (factor 0.24, against 0.52 before).
- The 27 October 2026 repair (steps 4–7) cut unexplained one-day falls of more than 50% from 110 to 39. It changed the adjustment history of 145 companies. 14 listed stocks moved more than 2 points in distance from their high, among them ITC (−57% to −47%) and EIH (−59% to −41%).
- The 39 left are real crashes (Satyam, GTL, 63 Moons, Infibeam, Yes Bank) and 1990s stocks whose previous trade was 8–30 days earlier, where a split cannot be told from weeks of trading.
Lifetime returns
Code: compute/lifetime_returns.py, step lifetime_returns. Bundles: markets/lifetime/buckets, markets/lifetime/cohorts. Page: /markets/#lifetime.
- Universe: every main-board company in this panel (EQ, BE and BZ series; no ETFs, no SME board) with at least 20 sessions from 2 January 1995. Companies already trading then start on that date. 4,239 companies, 1,641 of which have stopped trading.
- Return: adjusted close at the last trade over adjusted close at the first. “Still trading” means a trade within ten days of the panel’s last date.
- Benchmarks: the Nifty 500 price index and the 91-day T-bill over each company’s own dates. Both sides are price only. A robustness run adds a 1.5% yearly dividend to every stock and to the index.
- Concentration: ₹1 in every company at its first trade, held to its last. The figure is the smallest number of best performers whose gains add up to the whole pot’s net gain.
- Checks (27 October 2026): 54% lost money and 29% beat the index. Without the 281 companies that have an unexplained price jump, those are 54.5% and 30%. Among companies that traded ten years or more: 36% and 30%. With dividends on both sides: 52% and 29%.
- Limits: this counts companies, not market value. A delisted company’s last trade may overstate what its holders received (a liquidation) or understate it (a buyback at a premium). Companies listed only on BSE are absent.
Review lists
These are written to .cache/derived/ on every run:
| File | What it holds |
|---|---|
qa_price_jumps.csv | One-day moves too large to be ordinary trading |
qa_candidate_bonus.csv | Possible bonuses that were not inferred |
qa_rejected_actions.csv | Publisher factors that failed the price gate |
qa_missing_sessions.csv | Sessions that appear to be missing |
Known limits
- Survivorship-free, but only for NSE. A company listed only on BSE is absent.
- Demergers are adjusted from the price gap, which can over- or under-state the value of the demerged company.
- Dividends are not adjusted. This is a price panel, not a total-return panel.