Incorrect Historical Data For Banknifty Futrures


  • def hist_data(ticker,st_date,end_date,interval,exchange="NFO"):
    params = {
    "exchange": exchange,
    "symboltoken": ticker,
    "interval": interval,
    "fromdate": st_date,
    "todate": end_date
    }
    print(params)
    hist_data = obj.getCandleData(params)
    print(hist_data)
    df_data = pd.DataFrame(hist_data["data"],
    columns = ["date","open","high","low","close","volume"])
    df_data.set_index("date",inplace=True)
    return df_data

    banknifty_data = hist_data("61627","2023-11-30 00:00", "2023-12-01 23:55", "ONE_DAY",)

    The above code is used to return values of 30-11-23 and 01-12-13 for BANKNIFTY28DEC23FUT contract

    28c3625e-7aeb-42b1-9c28-b56640291a36-image.png

    the code returned the above data in which the values for 31-11-23 is from BANKNIFTY30NOV23FUT contract and values from 01-12-23 if from BANKNIFTY28DEC23FUT