Yahoo Finance Nifty Historical Data ((top)) May 2026
import yfinance as yf nifty = yf.download('^NSEI', start='2010-01-01', end='2023-12-31') View the first 5 rows print(nifty.head()) Save to CSV nifty.to_csv('nifty_historical.csv')
For decades, the Nifty 50 has been the heartbeat of the Indian equity market. Whether you're backtesting a trading strategy, calculating beta against the broader market, or simply tracking long-term wealth creation, reliable historical data is non-negotiable. yahoo finance nifty historical data
print(nifty[['Adj Close', 'volatility']].tail()) import yfinance as yf nifty = yf
import pandas as pd import numpy as np nifty = yf.download('^NSEI', period='1y') nifty['returns'] = nifty['Adj Close'].pct_change() nifty['volatility'] = nifty['returns'].rolling(30).std() * np.sqrt(252) calculating beta against the broader market