I want to select my options dynamically.
For example I want to buy in the money PUT option for BANKNIFTY, or Sell CALL that is 10 strikes away. How do i find this dynamically?
Do I need to identify it by looping through the all available options?
Hi - BankNifty Options are 100 pts wide. You can simply determine the nearest hundred from the underlying price and calculate the strike that is 1000 (10 * 100) pts from the U/L.
BankNifty Index @ 35,291.65 int nearest100 = Math.Round(35291.65d /100d, 0) * 100 int callStrike = nearest100 + 1000d; string bnfCallOption = "BANKNIFTYYYMDD{callStrike}CE";
BankNifty Index @ 35,291.65
int nearest100 = Math.Round(35291.65d /100d, 0) * 100
int callStrike = nearest100 + 1000d;
string bnfCallOption = "BANKNIFTYYYMDD{callStrike}CE";
hope this helps.