I am using the following code to fetch 5min candle for NIFTY and BANKNIFTY. But some of fetched OHLC value doesn't match the actual results. today = datetime.now(IST).today() minute = today.minute start = today - timedelta(days=6) data = self.kite.historical_data(instrument_token=instrument_token, from_date=start, to_date=today+timedelta(days=1), interval='{}minute'.format(frame)) df = pd.DataFrame(data) df.set_index('date',inplace=True) return df
You can get started here.