MngDeleteTradesList¶
Description: Allows a manager to submit delete requests for multiple trades at once by specifying a list of order IDs.
Warning
This command only accepts closed market BUY/SELL trades in TS_CLOSED_NORMAL,
TS_CLOSED_PART, or TS_CLOSED_BY.
Access Control¶
Requires del_trades for manager/dealer sessions. The target account must also match the manager groups and brand scope loaded from the cached manager record. Token payload is used only for manager id and session type.
Copy-Follower Manual-Write Checks¶
For SESSION_USER or SESSION_CUSTOMER requests, this mutation applies the
copy-follower manual_trading_mode after the usual account/order ownership
checks. The check applies only when the target account has an enabled follower
profile. Mode 0 rejects all manual writes; mode 1 permits new or non-copied
orders but rejects changes to linked copied orders; mode 2 permits both.
Manager/admin/dealer staff sessions bypass this follower policy.
Batch responses use the existing per-order failures collection. A policy
rejection is serialized with error: "PERMISSION_DENIED"; the handler discards
the specific copy-policy error code and message for this item. It is therefore
not reported as COPY_MANUAL_TRADING_DISABLED or
COPY_COPIED_ORDER_MANUAL_FORBIDDEN in the batch response. Account/order access
is checked first, and the batch continues processing independent items.
Each requested ticket is checked and reserved independently, in request order.
A successful item moves to TS_DELETE_REQUEST before it is added to rows; a
rejected or already-reserved ticket is added to failures. The batch is not
atomic: accepted tickets remain admitted even when other items fail. Repeated
IDs in one list or overlapping concurrent lists can therefore produce one
accepted row and a failure for the repeated ticket.
The top-level TCP command status is 200 when every requested item is accepted,
207 when accepted and failed items are mixed, and 409 when none is accepted.
matched counts request entries, including repeated IDs; deleted counts items
accepted for deletion, not completed removals. failed is matched - deleted.
Request Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
| orders | array | Yes | Ordered list of trade order IDs (integers). Duplicate IDs are processed as separate entries; only the first can reserve a given eligible ticket. |
| __access | object | Yes | Access object containing session type information. |
Request Example¶
{
"orders": [1001234, 1001235, 1001236],
"__access": {
"type": 1
}
}
Response Parameters¶
| Name | Type | Description |
|---|---|---|
| rows | array | Accepted per-ticket acknowledgments. Each row contains accepted (boolean), order (integer), and state (integer, TS_DELETE_REQUEST, value 8). |
| matched | integer | Number of request entries, including repeated IDs. |
| deleted | integer | Number of entries admitted for deletion; this does not count completed removals. |
| failed | integer | Number of entries not admitted (matched - deleted). |
| failures | array | Present when one or more entries fail. Each item contains order and error; message is also present for trade-manager admission errors, but access/policy denials contain only error. |
Complete mixed-result TCP response example¶
Here the first two unique tickets are reserved; the repeated first ticket is
rejected because its state has already changed to TS_DELETE_REQUEST:
{
"extID": "delete-list-1",
"status": 207,
"data": {
"rows": [
{ "accepted": true, "order": 1001234, "state": 8 },
{ "accepted": true, "order": 1001235, "state": 8 }
],
"matched": 3,
"deleted": 2,
"failed": 1,
"failures": [
{
"order": 1001234,
"error": "RET_TRADE_INCORRECT_STATE",
"message": "Unknown error"
}
]
}
}
Notes¶
statusis the TCP command status.datacontains the per-ticket result and aggregate counts.- A successful row acknowledges that the delete request was admitted, not that final removal has completed. Track each
orderthrough trade events or follow-up queries. - If no order is admitted, the command status is
409; if some are admitted and others fail, it is207.
Atomic per-ticket admission¶
Each ticket is checked and reserved under the same trade-cache lock. Only closed
market BUY/SELL records in TS_CLOSED_NORMAL, TS_CLOSED_PART, or
TS_CLOSED_BY are eligible. The reservation changes the record to
TS_DELETE_REQUEST before the row is returned. Already-reserved, deleted, open,
pending, or otherwise ineligible records fail independently; they do not prevent
other valid list entries from being accepted. Concurrent and repeated requests
cannot reserve the same ticket twice.
A trade-manager admission failure such as an invalid current state includes the
mapped error code and message. For example, the current error mapping returns
RET_TRADE_INCORRECT_STATE with Unknown error. A manager/account access denial
is serialized as PERMISSION_DENIED without a message. Access and missing-record
checks happen before the delete reservation; the batch continues with remaining
entries.