private Order GetLastOrder(string symbol) { int MaxLoop = 2; int loop = 0; while (loop < MaxLoop) { try { var orders = m_BinanceApi.GetAllOrders(symbol); if (orders == null) { return(null); } for (int i = orders.Count() - 1; i >= 0; i--) { if (orders.ElementAt(i).Status == "FILLED" || orders.ElementAt(i).Status == "PARTIALLY_FILLED") { return(orders.ElementAt(i)); } } break; } catch (Exception e) { string message; if (e.InnerException == null) { message = e.Message; } else { message = e.InnerException.Message; } string caption = "Exception Error"; MessageBoxEx(message, caption); Thread.Sleep(100); } } return(null); }