It looks like you're new here. If you want to get involved, click one of these buttons!
List<Order> orders = kite.GetOrders().Where(o => o.Status == "OPEN" && scriptNames.Contains(o.Exchange + ":" + o.Tradingsymbol) && o.ParentOrderId != "").ToList(); writeLog(logFile, "End kite.GetOrders()"); foreach (Order order in orders) { try { if (orders.Where(o => o.ParentOrderId == order.ParentOrderId && o.Product == "BO" && o.Tag == tagString).ToList().Count > 0) { kite.CancelOrder(order.OrderId, Constants.VARIETY_BO, order.ParentOrderId); await Task.Delay(334); } else if (order.Product == "CO" && order.Tag == tagString) { writeLog(logFile, "Cancelling CO Order"); kite.CancelOrder(order.OrderId, Constants.VARIETY_CO, order.ParentOrderId); await Task.Delay(334); } } catch (Exception ex) { writeLog(logFile, "Error: " + ex.Message); } }
Thanks for pointing it out.We will rectify this.
kite.CancelOrder(order.OrderId, Constants.VARIETY_CO, order.ParentOrderId);
please correct my code.
List orders = kite.GetOrders().Where(o => o.Status == "OPEN" && scriptNames.Contains(o.Exchange + ":" + o.Tradingsymbol) && o.ParentOrderId != "").ToList();
if (order.Product == "CO" && order.Tag == tagString)
{
kite.CancelOrder(order.OrderId, Constants.VARIETY_CO, order.ParentOrderId);
await Task.Delay(334);
}
PS: We use the same code in our production apps. You must be going wrong somewhere. I suggest going through codebase properly once.