I want to know the best way to figure out the nearest weekly expiry for NIFTY Options. I am using Instruments response. But if the Instruments API returns expiry in un sorted order, then my logic can go for toss. Assume that Today is Thursday, Today is working day and is Expiry, I get instrument with Expiry on next Tuesday First and then I get Expiry of Today.. Since the gap between today and Next Tuesday is less than 6 days, i may assume that this is nearest expiry.