Report

Investment Portfolio

The Investment Portfolio report.

A short table of the investment accounts at a date: the shares held, the price and the value, with a total. Use it for a quick portfolio value; the Advanced Portfolio adds basis and gains. In GnuCash: Reports ▸ Assets & Liabilities ▸ Investment Portfolio.

The options that matter are General/Date, Accounts/Accounts, General/Price Source and General/Share decimal places. Accounts with no shares are left out unless Accounts/Include accounts with no shares is on.

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

Response:

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

Command line

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

It prints:

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

MCP tool call

Tool call:

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

Result:

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

Template GUID: 4a6b82e8678c4f3d9e85d9f09634ca89 · Script: standard/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.

General

  • Report name (string, default "Investment 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-latest"): The source of price information.
  • Share decimal places (numberRange, default 2): The number of decimal places to use for share numbers.