PendingOrders.Delete
We send a request to delete a pending order.
int PendingOrders.Delete(id, isAsync = false)
Input parameters
Parameter | Type | Description |
id | int | Pending order identifier |
isAsync | bool | Asynchronous mode (enabled or disabled). Disabled by default = false |
Return value
If isAsync = false (synchronous mode by default), it returns the code of the operation execution result:
0 |
The request to delete a pending order was successfully sent to the server. It does not mean that the pending order has already been deleted or will definitely be deleted. |
If an error occurs, it returns the error code received on the client. The codes match the server error codes. |
Example:
// Delete all pending SellLimit orders
private void DelSellLimitOrders()
{
string line = "";
int err = 0;
if (PendingOrders.Count > 0) {
for (var i = PendingOrders.Count - 1; i >= 0; i--) {
PendingOrder order = PendingOrders.Find(PendingOrders[i].OrderId);
if (order != null) {
if (order.OrderType == (int)OrderType.SellLimit && order.SymbolName == Symbol.SymbolName) {
err = PendingOrders.Delete(order.OrderId);
if (err == 0) {
line = DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss:fff") + " Delete Failed, ServerErrorCode = " + Environment.NewLine;
Print(mCommonLog, line);
}
}
}
}
} else {
line = DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss:fff") + " Positions not found! ";
}
}