Skip to content
These docs describe Tradr v0.14.0. Running an older release? Check the release notes for what changed.

Reconcile an account's cash balance to a stated figure.

POST
/api/ledger/{accountId}/reconcile
curl --request POST \
--url https://api.tradr.cloud/api/ledger/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/reconcile \
--header 'Content-Type: application/json' \
--data '{ "targetBalance": "10250.00" }'

Posts a single balance_adjustment ledger entry for the difference between the account’s current derived balance and targetBalance, so the balance afterwards equals targetBalance exactly. The client sends the TARGET balance, never a delta — the server computes the difference inside the transaction that writes the row, behind a row lock on the account, so a concurrent position close cannot race it. The balance being reconciled is Tradr’s cash balance for the account: starting balance plus realized P&L from closed trades. Tradr holds no mark-to-market, so it excludes the market value of open positions. Open positions do not block or alter this operation. Append-only: this adds a row and never edits or deletes one. A wrong figure is corrected by reconciling again; both entries persist.

accountId
required
string format: uuid
Media typeapplication/json
object
targetBalance
required

Decimal string with at most 4 fractional digits, and no more than the account currency’s minor units. May be negative (a margin/debit balance).

string
Example
10250.00

The adjustment entry, plus the balance either side of it.

Media typeapplication/json
object
entry
object
newBalance
string
previousBalance
string
Example
{
"newBalance": "10250.0000",
"previousBalance": "10000.0000"
}

TargetBalance is malformed or too precise for the currency.

Not authenticated.

No such account for this user.

The balance already equals targetBalance — nothing to adjust.