Reconcile an account's cash balance to a stated figure.
const url = 'https://api.tradr.cloud/api/ledger/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/reconcile';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"targetBalance":"10250.00"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
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).
Example
10250.00Responses
Section titled “Responses”The adjustment entry, plus the balance either side of it.
object
object
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.