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.

[Open in ChatGPT (opens in a new tab)](https://chatgpt.com/plugins/plugin_asdk_app_6aded6de90f081918717da5227322e16) [Open in Claude (opens in a new tab)](https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=DalalOS&connectorUrl=https%3A%2F%2Fmcp.dalalos.in%2Fmcp) [Other AI apps](https://dalalos.in/connect)

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](https://www.nseindia.com/static/resources/forms-formats-members).

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](https://github.com/jugaad-py/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](https://github.com/jugaad-py/jugaad-data/issues/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](https://github.com/jugaad-py/jugaad-data/issues/136), 12 September 2026: `bhavcopy_fo_save` raises a connection error.
- [Issue 131](https://github.com/jugaad-py/jugaad-data/issues/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](https://dalalos.in/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 concept | REST field | Notes |
| --- | --- | --- |
| Date | trade_date | ISO date |
| Series | series | EQ, SME and others |
| Open, high, low, close | open, high, low, close | As published |
| Last price | last |  |
| Previous close | prev_close |  |
| Traded quantity | volume | Shares |
| Traded value | turnover | Rupees |
| Number of trades | num_trades |  |
| ISIN | data.isin | Once per response; data.isins if the symbol has changed ISIN |
| Delivery quantity and % | deliv_qty, deliv_pct | Where 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](https://dalalos.in/data-api/clean-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

|  | NSE file | Library | DalalOS REST |
| --- | --- | --- | --- |
| Cost | Free | Free | Free plan, then paid; 50 free REST credits a month |
| ISIN | In the file | Depends on the file format read | On every response |
| Delivery | Depends on the file | Depends on the library | In each row |
| Split adjustment | No | No, as a rule | price-history?adjusted=true |
| Holiday handling | You check the date column | Issue 131 shows one library did not | Returns only the days it holds; check coverage.last_date |
| Failure mode | File name or URL changes | Library lags NSE changes | HTTP 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.

| Provider and plan | Price a month | Calls included | Price per call | Per 1,000 calls | Notes |
| --- | --- | --- | --- | --- | --- |
| DalalOS Plus | ₹199 | 500 REST credits | **₹0.398** | ₹398 | REST and MCP. Yearly billing lowers the price further. |
| DalalOS Pro | ₹699 | 20,000 REST credits | **₹0.0350** | ₹34.95 | REST and MCP. Yearly billing lowers the price further. |
| DalalOS Business | ₹2,499 | 1,50,000 REST credits | **₹0.0167** | ₹16.66 | REST and MCP, named contact. Yearly billing lowers the price further. |
| DalalOS Business+ | ₹4,999 | 4,00,000 REST credits | **₹0.0125** | ₹12.50 | REST and MCP, named contact. Yearly billing lowers the price further. |
| IndianAPI Growth | ₹1,799 | 50,000 requests | ₹0.0360 | ₹35.98 | REST, 1 request a second. Its terms (indianapi.in/legal/terms, read 24 Nov 2026) say any purpose, commercial or not. |
| IndianAPI Pro | ₹3,999 | 100,000 requests | ₹0.0400 | ₹39.99 | REST, 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.77 | Per-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 | ₹125 | Per fundamentals request at full daily use. Data may only be used inside your company. |
| Zerodha Kite Connect | ₹500 | No quota; rate limits only | No per-call price | No per-call price | Prices 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](https://dalalos.in/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+

| Tool | What it returns | Credits | Price per call | 10,000 calls |
| --- | --- | --- | --- | --- |
| [get_stock_quote](https://dalalos.in/tools/get-stock-quote) | Latest end-of-day quote for one company | 1 | ₹0.0125 | ₹125 |
| [get_financials](https://dalalos.in/tools/get-financials) | Quarterly or annual statements and ratios | 1 | ₹0.0125 | ₹125 |
| [get_shareholding](https://dalalos.in/tools/get-shareholding) | Shareholding pattern by quarter | 1 | ₹0.0125 | ₹125 |
| [get_price_history](https://dalalos.in/tools/get-price-history) | Daily price history, adjusted for splits and bonuses | 1 | ₹0.0125 | ₹125 |
| [screen_stocks](https://dalalos.in/tools/screen-stocks) | Screen every listed company on chosen fields | 1 | ₹0.0125 | ₹125 |
| [get_stock_events](https://dalalos.in/tools/get-stock-events) | A company's BSE announcements | 1 | ₹0.0125 | ₹125 |
| [get_filing_extract](https://dalalos.in/tools/get-filing-extract) | Facts read from one filing (beta) | 1 | ₹0.0125 | ₹125 |
| [get_market_fii_dii_flow](https://dalalos.in/tools/get-market-fii-dii-flow) | Daily FII and DII flows | 1 | ₹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](https://dalalos.in/docs/display-rights) and [data licensing](https://dalalos.in/data-api/licensing). For what NSE data costs from the exchange, see [NSE API cost](https://dalalos.in/guides/nse-api-cost).

Last checked: 6 December 2026. 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.

[Open in ChatGPT (opens in a new tab)](https://chatgpt.com/plugins/plugin_asdk_app_6aded6de90f081918717da5227322e16) [Open in Claude (opens in a new tab)](https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=DalalOS&connectorUrl=https%3A%2F%2Fmcp.dalalos.in%2Fmcp) [Other AI apps](https://dalalos.in/connect)

[Already connected? Open your dashboard](https://dalalos.in/dashboard)

KEEP EXPLORING

- [NSE API in Python: your options](https://dalalos.in/guides/nse-api-python)
- [Stock price data API](https://dalalos.in/data-api/stock-price-data)
- [Python REST quickstart](https://dalalos.in/docs/python-quickstart)
- [Clean, split-adjusted data](https://dalalos.in/data-api/clean-adjusted-data)
- [nsepy and jugaad-data alternative](https://dalalos.in/compare/nsepy-jugaad-data-alternative)
- [NSE API cost](https://dalalos.in/guides/nse-api-cost)
- [Back to home](https://dalalos.in/)