You can find the ATM strike based on the tick data of spot or future ( depending on which you want to base it on).
For example : if Nifty tick price is 17625--> then 17600CE and 17600 PE. If the tick price is above 17625 and below 17675 then 17650CE and 17650 PE
The above calculation differs for BankNIFTY as BNF does not have strikes of 50. It does have strikes of 100.
Once the strike is found then, search in the instruments list for all strikes with the selected strikes and then find the nearest expiry option (for weekly option).
If you want to store the data of option chain, you need to have a database to store, run the timers or jobs which runs periodically starting from 9:15 and then fetch the option chain and store in database.
Please let me know, if you need it get done by me at reasonable price.
For example : if Nifty tick price is 17625--> then 17600CE and 17600 PE.
If the tick price is above 17625 and below 17675 then 17650CE and 17650 PE
The above calculation differs for BankNIFTY as BNF does not have strikes of 50. It does have strikes of 100.
Once the strike is found then, search in the instruments list for all strikes with the selected strikes and then find the nearest expiry option (for weekly option).
If you want to store the data of option chain, you need to have a database to store, run the timers or jobs which runs periodically starting from 9:15 and then fetch the option chain and store in database.
Please let me know, if you need it get done by me at reasonable price.