Need Historical data for NFO Contracts

sara_u
Hi there,

I would like to do backtest some of the strategies that we automate.
We need data of expired contracts to, let's say "9000PE" of JAN Expiry is what we need.
since we don't have the instrument token, gone through the documentation and used the "NIFTY20MAY9000PE" and changed the dates whichever we need and tried to get the data but all in vain.

Was going through ht he forum and learned we don't have data for option contracts? Is that true still?
How to do backtest in that case?

Please suggest some options to move forward with backtesting our logic.
  • sara_u
    Just FYR

    this is the sample code
    String instrument = "NFO:NIFTY20MAY9000PE";
    KiteConnect kiteConnect = algoUtils.getKiteConnect();
    String[] instruments = {instrument};
    Map quotes = kiteConnect.getQuote(instruments);
    System.out.println(quotes.get(instrument).instrumentToken+"");

    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date from = new Date();
    Date to = new Date();
    try {
    from = formatter.parse("2020-01-03 09:15:00");
    to = formatter.parse("2020-01-03 15:30:00");
    }catch (ParseException e) {
    e.printStackTrace();
    }
    HistoricalData historicalData = kiteConnect.getHistoricalData(from, to, "12175106", "15minute", true, true);
    System.out.println(historicalData.dataArrayList.size());
  • sujith
    We don't provide historical data for expired options instruments. You will have to contact some exchange registered data vendor for this.
  • sujith
    We only provide day candle data for expired futures instruments.
  • sara_u
    Thanks, @sujith, is that holds true for the current month contract also? for e.g NIFTY20MAY9000PE from May 1 to the current date?
  • sujith
    We provide intra-day data for the live options instruments.
Sign In or Register to comment.