Report

Securities

Shows a piechart with distribution of assets over securities

A pie chart of the value of each security held at a date, largest first. Use it to see how a portfolio is spread. In GnuCash: Reports ▸ Assets & Liabilities ▸ Security Piechart.

The options that matter are Accounts/Accounts, General/End Date, General/Price Source and Display/Maximum Slices.

Examples

Example: with a copy of the reports/stock-test-data example book open as book.gnucash, at 2024-03-15T12:00:00Z.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"report.run","params":{"report":"Securities","options":{"General":{"End Date":{"absolute":"1981-04-01"}}}}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "title": "Securities",
    "sections": [
      {
        "blocks": [
          {
            "kind": "chart",
            "type": "pie",
            "title": [
              "Securities",
              "Balance at 04/01/81: $9,999.00"
            ],
            "…": "…"
          },
          "…"
        ],
        "…": "…"
      },
      "…"
    ],
    "…": "…"
  }
}

Command line

red-ale exec --book book.gnucash report.run '{"report":"Securities","options":{"General":{"End Date":{"absolute":"1981-04-01"}}}}'

It prints:

{
  "title": "Securities",
  "sections": [
    {
      "blocks": [
        {
          "kind": "chart",
          "type": "pie",
          "title": [
            "Securities",
            "Balance at 04/01/81: $9,999.00"
          ],
          "…": "…"
        },
        "…"
      ],
      "…": "…"
    },
    "…"
  ],
  "…": "…"
}

MCP tool call

Tool call:

{"name":"report.run","arguments":{"report":"Securities","options":{"General":{"End Date":{"absolute":"1981-04-01"}}}}}

Result:

{
  "structuredContent": {
    "title": "Securities",
    "sections": [
      {
        "blocks": [
          {
            "kind": "chart",
            "type": "pie",
            "title": [
              "Securities",
              "Balance at 04/01/81: $9,999.00"
            ],
            "…": "…"
          },
          "…"
        ],
        "…": "…"
      },
      "…"
    ],
    "…": "…"
  }
}

Template GUID: e9418ff64f2c11e5b61d1c7508d793ed · Script: standard/account-piecharts.rhai

Options

Accounts

  • Accounts (accountList, default []): Report on these accounts, if chosen account level allows.

Display

  • Show long names (boolean, default false): Show the full security name in the legend?
  • Show Totals (boolean, default true): Show the total balance in legend?
  • Show Percents (boolean, default true): Show the percentage in legend?
  • Maximum Slices (numberRange, default 7): Maximum number of slices in pie.
  • Plot Width (plotSize, default {"percent":100}): Width of plot, 10 - 100 in percent, above in pixels.
  • Plot Height (plotSize, default {"percent":100}): Height of plot, 10 - 100 in percent, above in pixels.
  • Sort Method (multichoice, default "amount"): Choose the method for sorting accounts.

General

  • Report name (string, default "Securities"): Enter a descriptive name for this report.
  • Stylesheet (multichoice, default "Default"): Select a stylesheet for the report.
  • Add options summary (multichoice, default "never"): Add summary of options.
  • End Date (date, default {"relative":"end-accounting-period"}): Select a date to report on.
  • Report's currency (currency, default "CURRENCY::USD"): Select the currency to display the values of this report in.
  • Price Source (multichoice, default "pricedb-nearest"): The source of price information.