Yahoo Nifty Historical Data
pip install yfinance pandas matplotlib
def fetch_data(self, period="1y", start_date=None, end_date=None): """ Fetches historical data for NIFTY 50. yahoo nifty historical data
This report analyzes the historical price and return data of the Nifty 50 index (ticker ^NSEI ) as obtained via Yahoo Finance’s historical dataset. The period under review spans from January 1, 2000, to December 31, 2023. Key findings indicate a long-term secular uptrend, punctuated by sharp corrections during global financial crises (2008–2009), the COVID-19 pandemic (2020), and rising interest rate cycles (2022). The index delivered a over the full period, with an annualized volatility of ~18%. to December 31
: Enter ^NSEI into the search bar on Yahoo Finance. the COVID-19 pandemic (2020)
self.data['MA_Short'] = self.data['Close'].rolling(window=short_window).mean() self.data['MA_Long'] = self.data['Close'].rolling(window=long_window).mean() print(f"Calculated Moving Averages: short_window-day and long_window-day.")


