DeleteBalanceSync¶
Description: Requests deletion of a balance finance transaction and keeps the TCP request open until the trading runtime broadcasts the matching final delete or rejection update.
SEO¶
DeleteBalanceSync is the synchronous TCP balance transaction delete method for ScaleTrade manager API integrations. Use this endpoint when a CRM, cashier, payment gateway, or backoffice connector must delete a balance finance transaction and receive the final deleted trade payload by order.
Access Control¶
Requires del_accounts_balance for manager/dealer sessions. The target finance transaction 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.
Request Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
| order | int | Yes | Finance transaction order ID |
Final Response¶
The response contains the final transaction object from the matching trade:event. Inspect data.state rather than treating transport status = 200 as proof of deletion.
{
"extID": "delete-balance-req-1001",
"status": 200,
"data": {
"order": 1242279,
"state": 6
}
}
| Final state | Meaning |
|---|---|
TS_DELETED (6) |
The balance transaction was reversed and deleted |
TS_CLOSED_NORMAL (3) |
The runtime rejected deletion; the original transaction remains effective |
On rejection, the transaction remains effective. The exact runtime rejection code and projected account values are written to the server finance log.
Deposit reversal rules¶
For an executed deposit, group field deposit_reversal_policy determines whether deletion may produce a negative cash balance. Value 0 rejects that reversal; value 1 permits it and immediately recalculates equity, margin, free margin, and Margin Call/Stop Out state. This policy does not affect ordinary withdrawals, credit, or bonus transactions.
Event Matching¶
TCP waits for trade:event with matching data.order and either type = EV_RECORD_DELETE (deleted) or type = EV_RECORD_UPDATE (runtime rejection).
Timeout¶
The default timeout is 5000 ms. If no matching trade event arrives before timeout, TCP returns status = 504 with SYNC_TIMEOUT.