Leverage and positioning: methods
Code: pipeline/tipsheet/compute/leverage.py, publish/leverage.py, step steps/data_leverage.py.
Bundles: leverage/*.
Sources
All are NSE public archives, ingested by the Data bank with contracts and audits:
| Dataset | What it holds | From |
|---|---|---|
nse_mtf_2004_2012, nse_mtf_2013_2022, nse_mtf | Daily margin trading (MTF) summary, plus each security’s funded quantity and amount | 2004-04-13 |
nse_participant_oi | Open interest by Client, DII, FII and Pro, split into futures, options, index and stock, long and short | 2012-01-02 |
nse_fii_derivatives | FII buy and sell values and open interest by product | 2014-12-01 |
Definitions
- MTF book: outstanding margin-trading exposure at the end of the day, in Rs crore (the source is in Rs lakh).
- Fresh exposure and liquidation: the day’s flows. Net new = fresh minus liquidated.
- Book ÷ market cap: the book in basis points of the previous month-end NSE market capitalisation (from business growth).
- Top securities: the latest day’s per-security amounts, summed by symbol (the source sometimes repeats a symbol). Share of book, and change against the session 21 trading days earlier.
- Index-futures long share: longs ÷ (longs + shorts) for each participant. Options tilt: net index calls held minus net index puts held, in contracts.
Checks
- MTF identity: opening book + fresh − liquidated = closing book, within Rs 0.001 crore on all 5,532 sessions. The security rows sum to the closing book (Data bank audit).
- Independent cross-check: our 2026-09-29 book (Rs 1,50,838 crore, 15,083,812.80 lakh) equals the Aftermarket Report’s figure exactly.
- Participant OI (Data bank audits): participants sum to the total, market longs equal shorts, and the legs sum to the totals. Since 2015-09 NSE rounds fractional contracts, so totals miss by one or two contracts.
Caveats
- The MTF regime changed in 2017. The book was Rs 100–300 crore before 2017 and grew quickly from then, as margin trading became widely offered. Charts start in June 2017; the full history is in the data.
- Gaps: 43 MTF sessions (mostly 2019–2022) are missing at source and shown as gaps. 41 recent MTF sessions are NSE’s provisional figures, because NSE never published a final.
- Lot sizes change (for example November 2024), which moves contract counts without any change in exposure. Use shares and percentiles across years.
- Not a signal. The Aftermarket Report tested positioning measures built from these files, and none predicted returns reliably. They are shown as context.
F&O bhavcopy analytics
Bundles: leverage/fo/* and leverage/stats/{nifty_pcr_oi,nifty_basis_ann,stocks_rollover}. Code: compute/fo_analytics.py and publish/fo_analytics.py; step fo_analytics.
Source: the NSE F&O bhavcopy, one row per contract per day, from 2020-01-01 (Data bank eras nse_fo_bhavcopy_2020h1 onward). Two layouts:
- UDiFF (from 2024-07-08) prints the lot size and the underlying’s close.
- Legacy (to 2024-07-05) prints neither. For those rows:
- Lot size is inferred per day, symbol and expiry. Open interest and its daily change are whole multiples of the lot, so their GCD is the lot, or a multiple of it (thin contracts), or a divisor (positions straddling a lot revision). Where a future of the same expiry traded, the GCD is snapped to the nearest divisor or multiple matching traded value ÷ (contracts × close). Weekly option expiries have no future of their own, so the GCD is kept unless it is outside 0.6–1.7× the symbol’s futures estimate (Nifty’s July 2021 weeklies still traded at the old lot of 75 while the monthly future was at 50).
- Tested on the UDiFF era, where the true lot is known: the rule recovers it on 99.7% of symbol-expiry-days.
- Tested on the legacy era against NSE’s published daily premium turnover (business growth): derived index-option premium is within 0.1% on every session in 2020–2024 but one (0.6%); stock options are within about 1×10⁻⁴ on average (legacy values are printed in Rs lakh to two decimals).
- The underlying close comes from Nifty index history (Nifty 50, Bank, Next 50, Midcap Select) and the equity bhavcopy EQ close (stocks). FINNIFTY has no index history before 2026, so its legacy basis is blank (39% coverage).
- Missing session: 2021-03-30 traded, but NSE serves no bhavcopy for it on any route. The Data bank records it as a reviewed source gap, and the premium check skips March 2021.
Identities
- Open interest is reported in units. Contracts = OI ÷ lot size. OI changes with lot-size revisions, so the bundles favour ratios and rupee values.
- For options, traded value is notional: (strike + premium) × quantity. Premium turnover = traded value − strike × contracts × lot size.
- Check: monthly sums of this derived premium against NSE’s published premium turnover in business growth, 81 months from Jan 2020 (March 2021 skipped): the largest relative gap is 2.3×10⁻⁴ for index options and 2.3×10⁻³ for stock options (May 2020); from Jul 2024, under 2×10⁻⁷.
Measures
- Put-call ratio (OI) = put OI ÷ call OI in contracts, per index and for stock options in aggregate.
- Futures basis = the nearest future that doesn’t expire that day, against the underlying: (future ÷ spot − 1), and annualised over calendar days to expiry. On 1 Oct 2026, Nifty’s basis was 6.8% a year.
- Rollover at each monthly expiry: on the expiring contract’s last day, the share of futures OI (by value) in later expiries. It is computed for Nifty, Bank Nifty and all stock futures together. At the 29 Sep 2026 expiry it was 74%, 80% and 91%.
- Expiry-day (0DTE) share: the share of a month’s index-option premium traded in contracts on their expiry day.
- It climbed from about 15% in 2020 to 18% in 2021, 22% by end-2022, 31% by end-2023 and 37–38% in Q2–Q3 2024, as weekly expiries spread across indices and days.
- It fell to 14–18% after SEBI cut weekly expiries to one benchmark index per exchange from 20 November 2024 (16% in Q1 2025).
- It has since drifted back to about 26% by quarter (31% in Sep 2026).
- Market-wide OI value: futures at settlement value; options at the underlying’s value (notional exposure).
All of this is descriptive (see the null results above).