Historical API for Nifty and Bank Nifty


  • @admin When will we get the historical API for indices? Please update.


  • @Moderator_2 Thank you for your kind and prompt responses.

    Kindly help how do we fetch open interest for historical data of options. I am using the below line of code but it is showing an error as

    Historic Api failed: 'Series' object has no attribute 'open_interest' BANKNIFTY20DEC2346000CE

    Code is as below:
    historicParam = {
    "exchange" : symbolInfo.exch_seg,
    "symboltoken": symbolInfo.token,
    "interval": "ONE_MINUTE",
    "fromdate": "2023-12-15 09:15",
    "todate": "2023-12-15 15:30",
    }
    res_json = obj.getCandleData(historicParam)
    columns = ["timestamp", "open", "high", "low", "close", "volume"]
    df = pd.DataFrame(res_json["data"], columns= columns )
    df["open_interest"] = symbolInfo.open_interest

    Without Open interest the code works fine. Thanks in advance


  • Hi @Gunjit

    Apologies for delayed response.
    We have started providing historical data for index. Kindly check.

    Thanks & Regards,
    SmartAPI team