When I do multiple order cancellation and placing one big order for SELL or BUY execution , I am getting error now. There is 1 second wait for each order cancellation.
Code snippet: List orders = kite.GetOrders(); List orderHistory = kite.GetOrderHistory(order.OrderId); if (orderHistory[orderHistory.Count - 1].Status != Constants.ORDER_STATUS_COMPLETE) kite.CancelOrder(order.OrderId); Place BUY or SELL order on leftover quantity.
I am not using Tread sleep or task delay method as somehow it was not working with windows for multiple treads. I am using below method to sleep the process for some milliseconds.