I am trying to fetch the 5min candle data for expired contract but getting "Contract not found" error. I have saved the instrument token for all previous expired contracts in my database. I am using the correct instrument token for the given contract. Please guide me how to get this if I am going wrong.
Exchange re-uses the tokens once an instrument expires, so you can't really fetch historical data for expired instruments. You need to use continuous data feature to do so. You can check out documentation here.
Please do note that we only provide day candles data for expired future instruments.
Please do note that we only provide day candles data for expired future instruments.