Skip to content

Guide: Python

NSE API in Python: your options and what breaks

Disclosure: DalalOS sells one of the options below, so this page is not neutral. We read the library READMEs and NSE’s terms on 17 November 2026.

There are four ways to get NSE data into Python. This guide says what each one is good for, what breaks, and shows the same daily-price call with a REST API.

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

KEY TAKEAWAYS

  • What DalalOS is for: end-of-day NSE and BSE prices, financials and shareholding in a scheduled Python job. A REST call with a key, with the source and a timestamp in each response, and no scraping of nseindia.com.
  • For a one-off notebook, bhavcopy files and the open-source libraries cost nothing.
  • In a product or a scheduled job, scraping libraries break when NSE changes its website, and NSE’s terms prohibit scraping.
  • For intraday or live prices, use a broker API. DalalOS is end-of-day only.

The four options

Ways to get NSE data into Python
OptionCostGood forWhat breaks
Bhavcopy files from NSEFreeEnd-of-day prices for your own analysisYou write the download, parsing and corporate-action adjustment yourself
nsepython, jugaad-data, nsepy, nsetoolsFreeA notebook on your laptopThey read NSE’s website endpoints. The endpoints change, cloud IPs get blocked, and NSE’s terms prohibit scraping.
Your broker’s APINeeds a broker accountIntraday bars and live quotesFocused on trading and prices. Kite Connect, for example, does not return financial statements.
DalalOS REST APIFree plan, then paid plansEnd-of-day prices, financials, shareholding, F&O and flows in one keyNo live prices. Free REST has 50 credits a month and lower speed limits.

What breaks when you scrape nseindia.com

  • The library stops. The nsepy README says the author is unable to maintain it.
  • You get blocked. The jugaad-data README says it caches requests to avoid getting blocked by NSE.
  • The endpoints are not public. nsepython describes itself as an unofficial wrapper around the endpoints behind NSE’s website.
  • The terms forbid it. NSE’s terms of use prohibit systematic or automated data collection on its website, including scraping.

Daily prices with a REST API

Create a key at /dashboard/keys and keep it in an environment variable.

import os, requests

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

r = requests.get(f"{BASE}/stocks/SBIN/price-history",
                 params={"days": 365}, headers=HEADERS, timeout=30)
body = r.json()
bars = body["data"]["bars"]  # daily OHLCV
print(body["source"], body["cached_at"], body["stale"])

Routes take an NSE symbol, an ISIN or a BSE code. For error handling, retries and pandas, follow the Python REST quickstart. Every route is in the REST reference.

What this does not give you

No live prices, no intraday bars and no live option chains. Prices arrive after the exchanges publish their end-of-day files. If you show NSE prices to the public, read NSE and BSE data licensing first. Nothing here is investment advice.

FAQ

Common questions

Is there a free NSE API for Python?
NSE publishes end-of-day bhavcopy files you can download for free. Open-source libraries such as nsepython and jugaad-data fetch data from NSE's website through unofficial endpoints. DalalOS has a free plan that includes REST, with 50 REST credits a month.
Is it legal to scrape NSE with Python?
NSE's terms of use prohibit systematic or automated data collection on its website, including scraping. Libraries that call the website's internal endpoints fall under that clause. This is not legal advice; read NSE's terms before you run one in a product.
Why did my nsepy or nsepython code stop working?
These libraries read NSE's website endpoints, which NSE can change without notice. The nsepy README says its author can no longer maintain it. Blocking is the other common cause: the jugaad-data README says it caches requests to avoid being blocked.
Can I get live NSE prices in Python?
Not from DalalOS, which is end-of-day only. For intraday bars or live ticks, use your broker's API or a licensed real-time vendor.
Does DalalOS have a Python package?
No. You call the REST API with requests or httpx and a bearer key from your dashboard.
Who wrote this page?
DalalOS, which sells a REST API, so read it with that in mind. The open-source libraries are free and work for many notebooks.

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