Reconcile Gateway Execution¶
Records an administrator's verified outcome for an MT5 execution and, when confirmed as executed, attempts to apply it to local trade state. This method does not issue or resend an MT5 operation.
POST /gateway/execution/reconcile
Authorization¶
Requires SESSION_ADMIN and the super_admin permission.
Send the administrator JWT in the Authorization header:
Authorization: <ADMIN_JWT>
Request Parameters¶
| Field | Type | Required | Description |
|---|---|---|---|
execution_id |
string | Yes | Journal ID, exactly 32 characters. |
resolution |
string | Yes | EXECUTED or NOT_EXECUTED. |
note |
string | Yes | Operator's reason, 1–2048 characters. |
provider_order |
string | For EXECUTED |
Confirmed non-zero MT5 position ticket, up to 32 characters. |
provider_uuid |
string | No | Provider UUID, up to 128 characters. |
provider_volume |
int | For EXECUTED |
Positive executed volume in SCT integer volume units; cannot exceed the requested volume. |
price |
number | For EXECUTED |
Positive provider execution price. |
local_price |
number | Conditional | Positive SCT execution price used when applying locally. Required if the captured request price is non-positive (typical market close); otherwise omit to use the captured request price. |
commission |
number | Conditional | Signed account-currency commission. Required for a partially filled OPEN operation. |
For a partially filled OPEN operation, provide the actual signed commission confirmed by the provider. The server does not prorate the commission automatically.
price is the confirmed external provider price; manual reconciliation requires
it to be positive. local_price is the SCT-side execution price for the local
trade record. When supplied it overrides the captured request price; when the
captured price is non-positive, it must be supplied. Reconciliation never uses
the current quote to fill this value. A normal MT5 market CLOSE result may
contain external price: 0 when MT5 did not provide a close price; this does
not invalidate that normal result, but manual confirmation still needs a
positive provider price and positive SCT local_price.
Confirmed execution request¶
{
"execution_id": "0123456789abcdef0123456789abcdef",
"resolution": "EXECUTED",
"note": "Verified against MT5 position history",
"provider_order": "123456789",
"provider_uuid": "mt5-position-123456789",
"provider_volume": 10000,
"price": 1.08452,
"local_price": 1.0845,
"commission": -2.5
}
For a market CLOSE whose captured request price is 0, provide the verified
SCT close price explicitly:
{
"execution_id": "0123456789abcdef0123456789abcdef",
"resolution": "EXECUTED",
"note": "Verified against MT5 deal history",
"provider_order": "123456789",
"provider_volume": 10000,
"price": 1.08452,
"local_price": 1.0845
}
Confirmed non-execution request¶
{
"execution_id": "0123456789abcdef0123456789abcdef",
"resolution": "NOT_EXECUTED",
"note": "Verified that no matching MT5 position or deal exists"
}
NOT_EXECUTED is accepted only for an uncertain execution and is an operator
attestation that the external operation did not occur. It is rejected when the
journal records positive filled volume or a non-zero numeric MT5 deal/UUID
identifier. A request still in SENT cannot be resolved. A confirmed
EXECUTED or APPLYING record cannot be discarded as not executed.
For EXECUTED, the server records the confirmed provider identity and applies
the result locally using the captured SCT request context and confirmed
provider price and volume. local_price, when provided, overrides the
captured SCT request price; otherwise the captured price is used. A close uses
the journal submission time (created_at) as its local close time, not the
reconciliation time. The server does not automatically apply a later result.
If the entry remains APPLYING, a repeated reconciliation request returns
GATEWAY_EXECUTION_IN_PROGRESS and does not repeat local application. After a
restart, an interrupted APPLYING entry is changed to EXECUTED and needs
operator follow-up. Before repeating the same EXECUTED reconciliation after
a local-apply failure or restart, inspect local trade state. If the operation
was already committed, the journal can recognize it by trade identity and
volume and mark the record LOCAL_APPLIED; it does not rewrite the already
booked trade price. local_price affects only a new local application.
Otherwise the confirmed operation is applied locally again. This never retries
the MT5 operation.
Response¶
execution is the full journal record documented by
Get Gateway Executions. local_apply_pending is
true only when its state is APPLYING.
Response Parameters¶
| Field | Type | Description |
|---|---|---|
execution |
object | Complete execution journal row, with the fields listed on the linked page. |
local_apply_pending |
boolean | true only while local application is pending (APPLYING). |
{
"execution": {
"execution_id": "0123456789abcdef0123456789abcdef",
"gateway_id": 12,
"login": 2000001,
"order": 900100,
"symbol": "EURUSD",
"provider_symbol": "EURUSD.a",
"operation": 1,
"volume": 10000,
"before_volume": 0,
"before_closed_volume": 0,
"correlation_id": 778812,
"state": "LOCAL_APPLIED",
"code": "",
"request_json": "{\"operation\":1,\"login\":2000001,\"order\":900100,\"open_time\":1794500000,\"source_symbol\":\"EURUSD\",\"target_symbol\":\"EURUSD.a\",\"cmd\":0,\"volume\":10000,\"lots\":100,\"price\":1.0845,\"sl\":0,\"tp\":0,\"parent_order\":0,\"gw_source\":\"\",\"gw_uuid\":\"\",\"gw_order\":\"\",\"gw_volume\":0,\"timeout_ms\":5000,\"trade_context\":\"{\\\"commission\\\":0,\\\"storage\\\":0,\\\"magic\\\":0,\\\"reason\\\":3,\\\"comment\\\":\\\"\\\",\\\"expiration\\\":0,\\\"close_time\\\":0}\"}",
"provider_order": "123456789",
"provider_uuid": "mt5-position-123456789",
"provider_source": "MT5",
"provider_deal": "",
"provider_request_order": "",
"provider_volume": 10000,
"price": 1.08452,
"created_at": 1794500000,
"updated_at": 1794500100,
"resolved_by": 7,
"resolution_note": "Verified against MT5 position history"
},
"local_apply_pending": false
}
Errors¶
| HTTP | Error | Description |
|---|---|---|
| 400 | INVALID_DATA |
Required field missing, invalid resolution, invalid execution data, missing positive local_price when the captured request price is non-positive, or missing commission for a partially filled OPEN. |
| 401 | PERMISSION_DENIED |
Missing or invalid administrator session. |
| 403 | PERMISSION_DENIED |
Session lacks super_admin. |
| 404 | RET_NOT_FOUND |
Execution ID does not exist. |
| 400 | RET_TRADE_INCORRECT_STATE |
Journal/local trade state does not permit this resolution, including execution evidence that prevents NOT_EXECUTED. |
| 409 | RET_DUPLICATE_RECORD |
The confirmed result conflicts with a previously applied result, including a mismatch with a previously recorded positive provider price. |
| 409 | GATEWAY_EXECUTION_IN_PROGRESS |
Local application is already in progress. |
| 500 | RET_TRADE_ORDER_LOCKED |
The request is still in-flight (SENT) and cannot be manually reconciled yet. |
| 500 | RET_TECH_PROBLEM / RET_ERROR |
Journal, restore barrier, or local application failure. |