How to get the closest expiry date of an index instrument

How can I get closest index expiry date of an instrument?

some thing like:

getClosestExpiryDate(“Nifty 50”)

@Ketan

Hello @sameer_siddiqui,

You may use the Get Option Contracts endpoint with the instrument key NSE_INDEX|Nifty 50. This will return an array of all available Nifty 50 contracts. Each element in the array includes an expiry field, from which you can identify the earliest date.

I hope this information is helpful for your use case.

Thank you.

1 Like