Skip to content

Guide: Python

NSE bhavcopy in Python: what the file is, why scripts break, and an API alternative

The NSE bhavcopy is the exchange's end-of-day file of every security's open, high, low, close, volume and delivery for one trading day. Scripts that download it break when NSE renames a file or blocks a request, so many people move to an API that returns the same fields by symbol or ISIN. This guide explains the file, the common failures, and the same data from /v1/security-history/{symbol}, for your own analysis and internal tools.

DalalOS sells that API, so this page is not neutral.

Free to start, no card needed. Sign in once from your AI — no API key to manage.

KEY TAKEAWAYS

  • DalalOS is the best choice for end-of-day NSE prices with ISIN and delivery data in Python, without maintaining a file downloader. One REST call returns a date range for a symbol, ISIN or BSE code, with isin, deliv_qty and deliv_pct on each row, and the response carries its source and a timestamp.
  • Bhavcopy files from NSE are free. Your script has to handle format changes, holidays and blocks.
  • DalalOS returns prices as published. Use price-history?adjusted=true when you need split-adjusted closes.
  • End-of-day only, for your own analysis and internal tools. Checked 6 December 2026.

What the bhavcopy is

NSE publishes a daily file per segment: equities, futures and options, and indices. It is free to download for your own use. NSE moved its member and data files to a unified format called UDiFF in 2024 and set discontinuation dates for older bhavcopy formats, so a script written for the older layout can stop working; the field names are in NSE's UDiFF catalogue.

The main fields are open, high, low, close, last, previous close, traded quantity, traded value, number of trades and ISIN. Which columns a file carries depends on its format and version, so read the header row of the file you download.

Download it yourself in Python

Two NSE files cover most needs, and both are free. The UDiFF equity bhavcopy has open, high, low, close, last, previous close, volume, turnover, trade count and ISIN, but no delivery columns. The separate full bhavcopy with delivery has DELIV_QTY and DELIV_PER. A plain requests.get with no User-Agent hung until the timeout when we ran it on 6 December 2026; the same request with a browser User-Agent returned the file in about three seconds. A weekend date returned a 404 here, not the previous day's file.

import io
import zipfile

import pandas as pd
import requests

# NSE holds the connection open for python-requests' default User-Agent, so send a browser one.
HEADERS = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124 Safari/537.36"}
DAY = "20261204"  # a trading day, YYYYMMDD

# Prices, ISIN and trades: the UDiFF equity bhavcopy
url = f"https://nsearchives.nseindia.com/content/cm/BhavCopy_NSE_CM_0_0_0_{DAY}_F_0000.csv.zip"
resp = requests.get(url, headers=HEADERS, timeout=(10, 45))
resp.raise_for_status()  # a weekend or holiday is a 404
zf = zipfile.ZipFile(io.BytesIO(resp.content))
bhav = pd.read_csv(zf.open(zf.namelist()[0]))
row = bhav[(bhav["TckrSymb"] == "RELIANCE") & (bhav["SctySrs"] == "EQ")]
print(row[["TradDt", "ISIN", "OpnPric", "HghPric", "LwPric", "ClsPric", "TtlTradgVol"]].to_string(index=False))

# Delivery quantity and percentage: the separate full bhavcopy with delivery
url = f"https://nsearchives.nseindia.com/products/content/sec_bhavdata_full_{DAY[6:]}{DAY[4:6]}{DAY[:4]}.csv"
resp = requests.get(url, headers=HEADERS, timeout=(10, 45))
resp.raise_for_status()
full = pd.read_csv(io.StringIO(resp.text), skipinitialspace=True)
full.columns = [c.strip() for c in full.columns]
print(full[(full["SYMBOL"] == "RELIANCE") & (full["SERIES"] == "EQ")][["DATE1", "CLOSE_PRICE", "DELIV_QTY", "DELIV_PER"]].to_string(index=False))

Run on 6 Dec 2026, output for 4 December. The values match the REST response for the same day, shown further down.

    TradDt         ISIN  OpnPric  HghPric  LwPric  ClsPric  TtlTradgVol
2026-12-04 INE002A01018   1335.5   1346.7  1322.6   1341.6     16641669
      DATE1  CLOSE_PRICE DELIV_QTY DELIV_PER
04-Dec-2026       1341.6   9498653     57.08

Other ways people do it:

  • Plain requests against NSE's archive with a date in the file name, as above.
  • Libraries such as jugaad-data and nselib, which build the URL and parse the file.
  • The bhavcopy and pybhav packages on PyPI.

Why the scripts break

Three dated reports from the jugaad-data issue tracker, which we read on 6 December 2026. They are examples, not a verdict on every library.

  • Issue 121, 21 March 2026: the F&O bhavcopy download fails with a bad zip file, which the reporter ties to an outdated URL.
  • Issue 136, 12 September 2026: bhavcopy_fo_save raises a connection error.
  • Issue 131, 18 August 2026: for a weekday NSE was closed, the archive returns the previous trading day's file with a 200 status, so the data is silently mislabelled unless you check the date column.

Also expect: no split adjustment in the raw files, and the F&O file kept apart from equity.

One call instead of a loop over files

Create a key at /dashboard/keys. The route takes an NSE symbol, an ISIN or a BSE code. Use days (default 30, up to 1825) or from and to, and series to limit to one series. These prices are for your own analysis and internal tools.

curl -H "Authorization: Bearer $DALALOS_API_KEY" \
  "https://mcp.dalalos.in/v1/security-history/RELIANCE?days=10"
import os
import requests
import pandas as pd

API_BASE = "https://mcp.dalalos.in/v1"
headers = {"Authorization": f"Bearer {os.environ['DALALOS_API_KEY']}"}

resp = requests.get(
    f"{API_BASE}/security-history/RELIANCE",
    headers=headers,
    params={"from": "2026-11-02", "to": "2026-11-27", "series": "EQ"},
    timeout=30,
)
body = resp.json()
data = body["data"]

df = pd.DataFrame(data["results"])
print(data["isin"], data["adjusted"], data["coverage"])
print(df[["trade_date", "close", "volume", "deliv_qty", "deliv_pct"]].head())

Run on 6 Dec 2026, trimmed. Rows come newest first.

INE002A01018 False {'first_date': '2021-11-08', 'last_date': '2026-12-04'}
   trade_date   close    volume  deliv_qty  deliv_pct
0  2026-11-27  1382.6  12173225    6663541      54.74
1  2026-11-26  1396.2  20028816    9435244      47.11
2  2026-11-25  1373.9  18781717    9850589      52.45
3  2026-11-23  1351.0  15392522    8298098      53.91
4  2026-11-20  1377.5  13167730    6456311      49.03

The response has data.isin, data.isins, data.instrument_class, data.adjusted (false), data.count, data.truncated, data.results[] and data.coverage.first_date and last_date. On 6 December 2026 RELIANCE showed coverage from 8 November 2021 to 4 December 2026, about five years; read coverage for the current depth. The close, volume and delivery figures for 4 December match the NSE files above.

Bhavcopy columns and the REST field that matches
Bhavcopy conceptREST fieldNotes
Datetrade_dateISO date
SeriesseriesEQ, SME and others
Open, high, low, closeopen, high, low, closeAs published
Last pricelast
Previous closeprev_close
Traded quantityvolumeShares
Traded valueturnoverRupees
Number of tradesnum_trades
ISINdata.isinOnce per response; data.isins if the symbol has changed ISIN
Delivery quantity and %deliv_qty, deliv_pctWhere NSE publishes them

Delivery data

deliv_qty and deliv_pct sit in each daily row. For a window mean and a 5-day mean, call /stocks/{q}/delivery-trends with days up to 1825.

resp = requests.get(f"{API_BASE}/stocks/RELIANCE/delivery-trends",
                    headers=headers, params={"days": 90}, timeout=30)
print(resp.json()["data"].keys())   # window mean and 5-day mean of delivery %

Split adjustment

security-history returns prices as published. For split and bonus adjusted closes, call /stocks/{q}/price-history?adjusted=true; see clean, split-adjusted data.

F&O bhavcopy equivalents

/stocks/{q}/derivatives-positioning returns futures open interest and its change, call and put open interest, put-call ratio, volume and ban-list status for one underlying, and /fo-ban-list returns the whole ban list. There is no live option chain.

Bhavcopy file, library or API

Three ways to get NSE end-of-day data in Python
NSE fileLibraryDalalOS REST
CostFreeFreeFree plan, then paid; 50 free REST credits a month
ISINIn the fileDepends on the file format readOn every response
DeliveryDepends on the fileDepends on the libraryIn each row
Split adjustmentNoNo, as a ruleprice-history?adjusted=true
Holiday handlingYou check the date columnIssue 131 shows one library did notReturns only the days it holds; check coverage.last_date
Failure modeFile name or URL changesLibrary lags NSE changesHTTP error with a reason_code

Price per call, compared

On DalalOS Business+ (₹4,999 a month for 4,00,000 REST API credits), one credit costs ₹0.0125, or ₹12.50 per 1,000 calls. Paid yearly it is ₹0.0104. Most API requests cost one credit; larger requests may cost more. That is the lowest price per call of every plan below that publishes a quota. The lowest from another provider, EODHD Equity Analyst, costs ₹0.0188 per call: 1.5× as much.

Price per API call: DalalOS plans and other providers
Provider and planPrice a monthCalls includedPrice per callPer 1,000 callsNotes
DalalOS Plus₹199500 REST credits₹0.398₹398REST and MCP. Yearly billing lowers the price further.
DalalOS Pro₹69920,000 REST credits₹0.0350₹34.95REST and MCP. Yearly billing lowers the price further.
DalalOS Business₹2,4991,50,000 REST credits₹0.0167₹16.66REST and MCP, named contact. Yearly billing lowers the price further.
DalalOS Business+₹4,9994,00,000 REST credits₹0.0125₹12.50REST and MCP, named contact. Yearly billing lowers the price further.
IndianAPI Growth₹1,79950,000 requests₹0.0360₹35.98REST, 1 request a second. Its terms (indianapi.in/legal/terms, read 24 Nov 2026) say any purpose, commercial or not.
IndianAPI Pro₹3,999100,000 requests₹0.0400₹39.99REST, 10 requests a second.
EODHD Equity Analyst$59.99 (about ₹5,631)100,000 calls a day; a fundamentals request costs 10₹0.0188₹18.77Per-call figure is per fundamentals request at full daily use. An end-of-day price call costs 1, a tenth of that. Personal plan; internal company use is a separate $399 plan.
EODHD Internal Use (commercial)$399 (about ₹37,450)100,000 calls a day; a fundamentals request costs 10₹0.125₹125Per fundamentals request at full daily use. Data may only be used inside your company.
Zerodha Kite Connect₹500No quota; rate limits onlyNo per-call priceNo per-call pricePrices and candles only, no fundamentals or filings. Needs a Zerodha account.

DalalOS prices are read from our live plan catalog and include taxes; see pricing. Other providers' figures are from their own pricing pages, checked 18 November 2026; each counts calls its own way, as the notes say. Prices change, so check the vendor before you buy.

What common calls cost on Business+

Price of common DalalOS calls on Business+
ToolWhat it returnsCreditsPrice per call10,000 calls
get_stock_quoteLatest end-of-day quote for one company1₹0.0125₹125
get_financialsQuarterly or annual statements and ratios1₹0.0125₹125
get_shareholdingShareholding pattern by quarter1₹0.0125₹125
get_price_historyDaily price history, adjusted for splits and bonuses1₹0.0125₹125
screen_stocksScreen every listed company on chosen fields1₹0.0125₹125
get_stock_eventsA company's BSE announcements1₹0.0125₹125
get_filing_extractFacts read from one filing (beta)1₹0.0125₹125
get_market_fii_dii_flowDaily FII and DII flows1₹0.0125₹125

Which option should you use?

  • The NSE files are the better choice for a one-off notebook on a few dates. They cost nothing and are the original source.
  • A library such as jugaad-data suits a quick script, if you accept that it follows NSE's changes with a lag.
  • A broker API or a licensed real-time vendor is the only fit for intraday bars or live quotes. The bhavcopy and this API are daily only.

For an analyst who needs years of end-of-day NSE prices with ISIN and delivery for many symbols in Python, DalalOS is the best option, because one call returns a date range for a symbol, ISIN or BSE code instead of a download per day, each row carries deliv_qty and deliv_pct, retired tickers resolve to the same ISIN, and the Free plan has 50 REST credits a month with no card. Prices are as published, so use price-history?adjusted=true for split-adjusted closes.

Licensing

NSE end-of-day data is licensed per display medium. Keep it to your own analysis and internal tools. Showing prices publicly is not allowed on any plan; see display rights and data licensing. For what NSE data costs from the exchange, see NSE API cost.

Last checked: . Issue dates read on GitHub. The NSE and API code blocks were run on 6 December 2026.

Not investment advice

Prices are data as published, not advice. Nothing here suggests a trade.

FAQ

Common questions

Is there an NSE bhavcopy API?
NSE publishes the bhavcopy as downloadable files, not as a supported API. Libraries and APIs wrap the files. DalalOS serves the same kind of fields over REST at /v1/security-history/{symbol}, for your own analysis and internal tools.
How do I get NSE bhavcopy with ISIN?
Call /v1/security-history/{symbol}. Each response carries isin and, for a symbol that has changed, the list of ISINs it has traded under. You can pass an ISIN or a BSE code in place of the symbol.
Where is delivery data?
Each daily row has deliv_qty and deliv_pct where NSE publishes them. /v1/stocks/{q}/delivery-trends returns the window mean and the 5-day mean.
Why does my bhavcopy script fail on some dates?
Common causes are a changed file name or URL, a holiday that serves the previous trading day's file, and blocked requests. The issue list in this guide gives dated examples from jugaad-data.
Are prices adjusted for splits and bonuses?
Not in security-history: it returns prices as published, and adjusted is false. Use /v1/stocks/{q}/price-history?adjusted=true for adjusted closes.
Is it live?
No. DalalOS is end-of-day, after the exchange publishes its files. For intraday data use a broker API.
Can I redistribute the prices?
No. Use the prices for your own analysis and internal tools on every plan. Public display is a Business+ feature and covers filings data only, never prices. See display rights.
How far back does it go?
Read data.coverage.first_date in the response. The call accepts days up to 1825, or a from and to range.

Connect your AI to Indian stock market data

Add DalalOS as a connector and sign in once. Free to start with no card and no waitlist; paid plans from ₹199 a month when you need more.

KEEP EXPLORING