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
| Option | Cost | Good for | What breaks |
|---|---|---|---|
| Bhavcopy files from NSE | Free | End-of-day prices for your own analysis | You write the download, parsing and corporate-action adjustment yourself |
| nsepython, jugaad-data, nsepy, nsetools | Free | A notebook on your laptop | They read NSE’s website endpoints. The endpoints change, cloud IPs get blocked, and NSE’s terms prohibit scraping. |
| Your broker’s API | Needs a broker account | Intraday bars and live quotes | Focused on trading and prices. Kite Connect, for example, does not return financial statements. |
| DalalOS REST API | Free plan, then paid plans | End-of-day prices, financials, shareholding, F&O and flows in one key | No live prices. Free REST has 50 credits a month and lower speed limits. |
What breaks when you scrape nseindia.com
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