Trigger recalculation
Rebuild gains and basis after ledger edits, then wait for the result to settle.
Check whether the ledger is dirty
graphql
query DirtyTransactions($clientId: ID!) {countDirty(clientId: $clientId)}
Start one recalculation
The mutation is named rerunGraph. Batch your edits first and avoid launching overlapping recalculations.
graphql
mutation Recalculate($clientId: ID!) {rerunGraph(clientId: $clientId)}
Poll until complete
Wait 5–10 seconds between checks. The ledger is settled when getActiveRecalculateJob returns null.
Verify after completion
Re-read the transactions or report totals affected by your edits only after the active job is gone.
graphql
query RecalculationStatus($clientId: ID!) {getActiveRecalculateJob(clientId: $clientId) {statusstepnumberOfTransactionsLeftfinishEta}}