public OptionStrike GetOptionStrike(int bankNiftyVal) { OptionStrike strike = new OptionStrike(); int modVal = bankNiftyVal % 100; if (modVal <= 35) { strike.CE = strike.PE = bankNiftyVal - modVal; } else if (modVal > 35 && modVal < 70) { strike.CE = bankNiftyVal + (100 - modVal); strike.PE = bankNiftyVal - modVal; } else { strike.CE = strike.PE = bankNiftyVal + (100 - modVal); } return(strike); }
private async void PlaceOrderForthisStategy(object obj) { if (DateTime.Now.Hour >= 11 && DateTime.Now.Minute > 1) { timer.Dispose(); return; } OptionStrike optionStrike = new OptionStrike(); if (CurrentBankNifty != null) { optionStrike = GetOptionStrike((int)CurrentBankNifty); } apiProcessor.IsCEOrder = true; apiProcessor.IsPEOrder = true; apiProcessor.CEStrike = optionStrike.CE; apiProcessor.PEStrike = optionStrike.PE; apiProcessor.LogAdded += ApiProcessor_LogAdded; apiProcessor.UserTransType = "SELL"; await apiProcessor.PlaceEntryOrder(); }