Method

scrub.currency

Give transactions whose currency is not a currency the most common currency of their splits.

Gives a transaction whose currency is not a currency (a security, say) the most common currency of its splits, and re-values its splits to match. Scope it with transaction, or account and subaccounts; with neither it covers the whole book. A clean book gives an empty repairs list. To change a transaction's currency on purpose, use transaction.update.

Examples

Example: with a copy of the gnucash/taxreport example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"scrub.currency","params":{}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "repairs": []
  }
}

Command line

red-ale exec --book book.gnucash scrub.currency

It prints:

{
  "repairs": []
}

MCP tool call

Tool call:

{"name":"scrub.currency","arguments":{}}

Result:

{
  "structuredContent": {
    "repairs": []
  }
}

Effect: destructive, on the Book.

Params

Params of the scrubs. Give a transaction, or an account (with or without its sub-accounts); give neither for the whole book.

  • transaction (Guid or null): Scrub this transaction only.
  • account (AccountRef or null): Scrub the transactions with a split in this account.
  • subaccounts (boolean): With account: its sub-accounts too.

Result

What a scrub did.

  • repairs (array of RepairWire, required): Every change, in the order made. Empty when there was nothing to repair.