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 Data bank 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.
-
Infer actions the publisher missed. A split, bonus or consolidation is inferred from a clean price ratio (½, ⅓, 1:10 and so on) only when all of these hold:
- the prior close is at least ₹10
- the ratio is within 4% of a clean ratio (10% for ratios of ¼ or less, or 5× and more)
- the new level holds for five sessions
Ratios of 0.6–0.75 are never inferred, because a 25–40% fall can be real. They go to a review list instead.
-
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 we checked
- NSE’s
PREVCLOSEis not adjusted for corporate actions. We 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, we 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 ours: Kansai Nerolac’s 2004 bonus, which no source recorded, and Zee Media’s 2010 demerger, which we under-adjust.
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.