Error in fetching latest 125 5minute candles

swagar1729
swagar1729 edited January 2021 in Python client
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
  • sujith
    The historical data API is meant for backtesting only. You can make candles at your end for live market strategies.
    You can get started here.
Sign In or Register to comment.