The below code for fetching options data works for ‘NSE_INDEX|Nifty 50’ instrument key and return proper data, but for ‘NSE_INDEX|Nifty Bank’ it does not work. ‘{“status”:“success”,“data”:}’ is the response. Please help.
The code you’ve shared is operational and functions correctly. According to NSE India, there are no option contracts available on May 23, 2024 for Bank Nifty. Could you please verify this information independently from your side?
The National Stock Exchange (NSE) in December had revised the expiry day of Nifty Bank monthly and quarterly contract cycle which is set to be applicable from March 01, 2024.
With this revision, all contracts of Bank Nifty - weekly, monthly and quarterly - will now expire on Wednesdays. Source → Livemint
When we set the expiry to be on Wednesday, the option chain becomes available for Bank Nifty. You can refer to the code snippet below. Rest assured, this code is fully functional
I was able to get ‘NSE_INDEX|Nifty Bank’ to work by using date as “2024-05-22”, but using this date did not fetch nifty 50 options. For that I had to use date as “2024-05-23”. Don’t know why this is happening.
I modified my code to set the date accordingly for further use.
Bank Nifty option chain works on “2024-05-22” as its a Wednesday, and Nifty 50 works on “2024-05-23” as its a Thursday. As per NSE all contracts of Bank Nifty - weekly, monthly and quarterly - will now expire on Wednesdays. Source → Livemint