A comprehensive guide to NSE/BSE market data sources, APIs, tools, and providers for algorithmic trading in India. Maintained by Trade Vectors — Mumbai's algo trading specialists.
- Official Data Sources
- Free Data APIs
- Paid Data Providers
- Python Data Libraries
- Historical Data Sources
- Real-Time Data Feeds
- Options & F&O Data
- Commodity Data MCX
| Source | Type | URL | Cost |
|---|---|---|---|
| NSE India | Official equities data | nseindia.com | Free |
| BSE India | Official equities data | bseindia.com | Free |
| SEBI | Regulatory + market data | sebi.gov.in | Free |
| RBI | Macro/economic data | rbi.org.in | Free |
| MCX India | Commodity data | mcxindia.com | Free |
| NCDEX | Agricultural commodity data | ncdex.com | Free |
# 1. nsepy — NSE historical data
pip install nsepy
from nsepy import get_history
from datetime import date
# Get Nifty 50 historical data
nifty_data = get_history(
symbol="NIFTY",
start=date(2023, 1, 1),
end=date(2024, 12, 31),
index=True
)
print(nifty_data.head())# 2. yfinance — Yahoo Finance data for Indian stocks
pip install yfinance
import yfinance as yf
# Download Reliance Industries data
reliance = yf.download("RELIANCE.NS", start="2023-01-01", end="2024-12-31")
print(reliance.tail())
# Nifty 50 index
nifty = yf.download("^NSEI", period="1y", interval="1d")# 3. nsetools — Live NSE quotes
pip install nsetools
from nsetools import Nse
nse = Nse()
# Get live stock quote
quote = nse.get_quote('infy') # Infosys
print(quote)
# Get top gainers
gainers = nse.get_top_gainers()| Provider | Data Type | Markets | Price Range |
|---|---|---|---|
| TrueData | Real-time + Historical | NSE, BSE, MCX | ₹3,000-15,000/month |
| Global DataFeeds | Tick data + OHLCV | NSE, BSE, MCX | ₹2,000-10,000/month |
| iQuesta | Market data platform | NSE, BSE | ₹5,000+/month |
| Quandl (Nasdaq DL) | Historical data | Multiple | $50+/month |
| Refinitiv (Reuters) | Premium financial data | Global | Enterprise |
| Bloomberg Terminal | Comprehensive data | Global | Enterprise |
- NSE Website: Bhavcopy files (daily OHLCV for all stocks)
- BSE Website: Daily bhavcopy download
- Yahoo Finance: Up to 10+ years via
yfinance - Zerodha Kite API: 60-day candle data (free with account)
import requests
import pandas as pd
from datetime import datetime, timedelta
def download_nse_bhavcopy(date_str):
"""Download NSE bhavcopy for a given date (DDMMYYYY format)"""
url = f"https://www.nseindia.com/content/historical/EQUITIES/{date_str[:4]}/{date_str[2:5].upper()}/cm{date_str}bhav.csv.zip"
# Note: NSE requires session cookies for download
print(f"Bhavcopy URL for {date_str}: {url}")
return url
# Example usage
download_nse_bhavcopy("10MAR2026")from kiteconnect import KiteTicker
kws = KiteTicker("your_api_key", "your_access_token")
def on_ticks(ws, ticks):
"""Callback to receive ticks"""
for tick in ticks:
print(f"Token: {tick['instrument_token']}, LTP: {tick['last_price']}")
def on_connect(ws, response):
"""Subscribe to Nifty 50 on connect"""
ws.subscribe([256265]) # Nifty 50 token
ws.set_mode(ws.MODE_FULL, [256265])
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.connect()| Source | Type | Data Available |
|---|---|---|
| NSE Official | Free | Options chain, OI, PCR |
| Sensibull | Freemium | Options analytics, Greeks |
| Opstra | Freemium | Strategy builder, OI analysis |
| Zerodha Kite API | With account | Live F&O quotes, OI |
| Upstox API | With account | F&O OHLCV, OI data |
# Fetch NSE Options Chain
import requests
def get_nifty_options_chain():
url = "https://www.nseindia.com/api/option-chain-indices?symbol=NIFTY"
headers = {
"User-Agent": "Mozilla/5.0",
"Accept-Language": "en-US,en;q=0.5",
"Referer": "https://www.nseindia.com"
}
session = requests.Session()
session.get("https://www.nseindia.com", headers=headers)
response = session.get(url, headers=headers)
return response.json()- MCX Official: mcxindia.com — Free daily prices
- Gold/Silver: Live prices via MCX API or broker APIs
- Crude Oil: NYMEX prices via global data providers
- Agricultural: NCDEX data for agri commodities
Trade Vectors is a Mumbai-based algorithmic trading company specializing in data-driven trading strategies, automated systems, and algo trading education for NSE/BSE/MCX India.
We help traders build reliable data pipelines for their trading systems.
Visit tradevectors.com for algo trading courses, consulting, and automated trading solutions.
Contact: tradevectors.com | @tradevectors
Keywords: NSE data API India, BSE market data, NSE historical data Python, free stock market data India, real-time NSE data, options chain data India, NSE bhavcopy download, algo trading data India