π NSE Data Fetcher (Python)
Fetch real-time stock, index, and option chain data from the NSE India website using Python.
π Features
β Fetch stock quote data (e.g., RELIANCE, TCS, INFY)
β Fetch index data (e.g., NIFTY 50, BANKNIFTY)
β Fetch option chain data (indices & stocks)
β Save results to CSV/JSON for analysis
β Ready-to-use Jupyter notebook demo
π Project Structure nse-data-fetcher/ βββ README.md βββ requirements.txt βββ .gitignore βββ src/ β βββ utils.py # Session + headers for NSE API β βββ nse_stocks.py # Fetch stock data β βββ nse_indices.py # Fetch index data β βββ nse_options.py # Fetch option chain βββ notebooks/ β βββ demo.ipynb # Example usage βββ data/ β βββ reliance.csv β βββ nifty50.csv β βββ nifty_options.csv
π§ Installation
Clone the repo and install dependencies:
git clone https://github.com//nse-data-fetcher.git cd nse-data-fetcher pip install -r requirements.txt
π Usage
Fetch Stock Data python src/nse_stocks.py
Fetch Index Data python src/nse_indices.py
Fetch Option Chain python src/nse_options.py
Jupyter Notebook Demo jupyter notebook notebooks/demo.ipynb
π Requirements
Python 3.8+
Libraries:
requests
pandas
jupyter (optional, for notebooks)
Install with:
pip install -r requirements.txt
NSE APIs sometimes block frequent requests β add delays if needed.
Always warm up the session by hitting https://www.nseindia.com before API calls.
Data is for educational and research purposes only (not for commercial trading).