Report

Advanced Portfolio

The Advanced Portfolio report.

Shows each investment account's holding at a date: shares, price, basis, value, the money paid in and taken out, realized and unrealized gains, income, fees and the return. It is the detailed view of a portfolio; the Investment Portfolio report is the short one. In GnuCash: Reports ▸ Assets & Liabilities ▸ Advanced Portfolio.

The options that matter are General/Date, Accounts/Accounts (the stock and fund accounts, or their parents), General/Basis calculation method, General/How to report brokerage fees and General/Price Source, which decides what price values the shares.

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":"Advanced Portfolio","options":{"General":{"Date":{"absolute":"1981-04-01"}}}}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "title": "Advanced Portfolio 04/01/81",
    "sections": [
      {
        "blocks": [
          {
            "kind": "table",
            "rows": [
              "…",
              "…",
              {
                "role": "grandTotal",
                "cells": [
                  {
                    "text": "Total",
                    "…": "…"
                  },
                  "…",
                  "…",
                  "…",
                  "…",
                  "…",
                  {
                    "display": "$484.88",
                    "…": "…"
                  },
                  "…"
                ],
                "…": "…"
              },
              "…"
            ],
            "…": "…"
          },
          "…"
        ],
        "…": "…"
      },
      "…"
    ],
    "…": "…"
  }
}

Command line

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

It prints:

{
  "title": "Advanced Portfolio 04/01/81",
  "sections": [
    {
      "blocks": [
        {
          "kind": "table",
          "rows": [
            "…",
            "…",
            {
              "role": "grandTotal",
              "cells": [
                {
                  "text": "Total",
                  "…": "…"
                },
                "…",
                "…",
                "…",
                "…",
                "…",
                {
                  "display": "$484.88",
                  "…": "…"
                },
                "…"
              ],
              "…": "…"
            },
            "…"
          ],
          "…": "…"
        },
        "…"
      ],
      "…": "…"
    },
    "…"
  ],
  "…": "…"
}

MCP tool call

Tool call:

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

Result:

{
  "structuredContent": {
    "title": "Advanced Portfolio 04/01/81",
    "sections": [
      {
        "blocks": [
          {
            "kind": "table",
            "rows": [
              "…",
              "…",
              {
                "role": "grandTotal",
                "cells": [
                  {
                    "text": "Total",
                    "…": "…"
                  },
                  "…",
                  "…",
                  "…",
                  "…",
                  "…",
                  {
                    "display": "$484.88",
                    "…": "…"
                  },
                  "…"
                ],
                "…": "…"
              },
              "…"
            ],
            "…": "…"
          },
          "…"
        ],
        "…": "…"
      },
      "…"
    ],
    "…": "…"
  }
}

Template GUID: 21d7cfc59fc74f22887596ebde7e462d · Script: standard/advanced-portfolio.rhai

Options

Accounts

  • Accounts (accountList, default []): Stock Accounts to report on.
  • Include accounts with no shares (boolean, default false): Include accounts that have a zero share balances.

Display

  • Show ticker symbols (boolean, default true): Display the ticker symbols.
  • Show listings (boolean, default true): Display exchange listings.
  • Show number of shares (boolean, default true): Display numbers of shares in accounts.
  • Share decimal places (numberRange, default 2): The number of decimal places to use for share numbers.
  • Show prices (boolean, default true): Display share prices.

General

  • Report name (string, default "Advanced Portfolio"): 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.
  • 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.
  • Basis calculation method (multichoice, default "average-basis"): Basis calculation method.
  • Set preference for price list data (boolean, default true): Prefer use of price editor pricing over transactions, where applicable.
  • How to report brokerage fees (multichoice, default "include-in-basis"): How to report commissions and other brokerage fees.