Nag
 · Trader, Algo enthusiast

Any sample code to get bank nifty nearest expiry date using python?

given the date, it is easy to find the nearest expiry if we have same weekday. But, now weekly 'Wednesday' and Monthly 'Thursday' .

For now I'm calculating the wednesday expiry till 3rd wednesday, then written a logic to find 3rd Thursday from that date on wards calculating Monthly expiry. Is there any simple way to do this with Fyers API? or with little logic?

4 replies