Advanced Portfolio with a start date
John Ralls
jralls at ceridwen.us
Mon Nov 10 16:17:12 EST 2025
> On Nov 9, 2025, at 12:53, Haowen Liu <liu.haowen.andy at gmail.com> wrote:
>
> Hi all,
>
> Currently Advanced Portfolio report has a Date config that's end date for the report. Is there a way to specify the start date from which to start calculating returns?
>
> If not, would GNC maintainers be open to a patch adding such support? Any suggestions on how would I go about implementing it? The Advanced Portfolio implementation is here IIUC: https://github.com/Gnucash/gnucash/blob/stable/gnucash/report/reports/standard/advanced-portfolio.scm.
The only way to do it now is quite cumbersome: You’d need to create a new book that begins on the desired starting date. Some people do this every year, but when they do it they don’t have any transactions to carry over.
To get a starting date entry in the options dialog you could just copy that bit of the options from another report (the Income Statement Report comes to mind) that has one, replacing the single-date option currently in the report.
That’s the easy part. To make it actually work you’d need to rewrite the logic of the report to get the value of the securities at the beginning of the reporting period as well as the end and to filter the income and expense transaction for the period, then adjust the calculations of each field as necessary.
If you decide to do that I suggest that you copy the APR code and make a custom report of it. When you’ve got it working in that mode you can make a PR of the diff. I think you’ll find https://wiki.gnucash.org/wiki/Custom_Reports to be a helpful starting point.
Regards,
John Ralls
More information about the gnucash-devel
mailing list