Price mismatch - Incorrect data - API vs Charts

srbhable
I fetched historical data (2 minute time frame) for following ticker : BANKNIFTY2420746800PE. Found mismatch in what I fetched through using kite.historical_data(..) vs what was shown in charts.

eg: API Data: 2024-02-02 12:39:00+05:30 517.75 528.25 488.95 498
Chart Data: 2024-02-02 12:39:00+05:30 514.4 528.25 492 495.55

O,L,C all 3 are different. Can you please help what I am missing?

Code used to fetch the data:

def fetchOHLC(ticker,interval,duration):
"""extracts historical data and outputs in the form of dataframe"""
instrument = instrumentLookup(instrument_df,ticker)
data = pd.DataFrame(kite.historical_data(instrument,dt.date.today()-dt.timedelta(duration),dt.date.today(),interval))
data.set_index("date",inplace=True)
return data

fetchOHLC("BANKNIFTY2420746800PE","2minute",20)


Do let me know the issue please.
  • rakeshr
    kite.historical_data(instrument,dt.date.today()-dt.timedelta(duration),dt.date.today(),interval)
    Can you paste here the debug log for this request with exact to and from params, being requested?
Sign In or Register to comment.