[GNC-dev] New report for commodities performance over time

Johan Vanbockryck gnc at vanbockryck.com
Mon May 2 11:11:49 EDT 2022


Hi,

I've been using gnucash for a couple of years now, and have been using the
"Advanced Portfolio" report to check on investment funds performances.
While this report gives a great overview of the current status of the
investments, I started missing a historical overview of the funds. E.g. a
fund that had a super performance at the start, but then stayed the same
(or even went down slightly) for a couple of years can have a better
"current status" then a fund that wasn't doing as well initially, but
started picking up recently. Of course this information can also be looked
up online on several websites, but that usually requires some manual
comparison setup and maintenance. But the raw data for this is available in
gnucash (especially when Online Quotes are set up, and executed on a
regular basis).

So I started looking into custom gnucash reports, and ended up writing an
"Investment Commodities Over Time" report. It was started based on the
"Investment Portfolio" report, has some items added to it from the
"Advanced Portfolio" report (for detecting stock splits) and has some bits
from other reports thrown in (e.g. the "Net Worth Linechart" report for the
optional chart). Note that this is my first time writing in Scheme (or
similar programming languages), so it is very likely that I used some
unusual constructions/syntax.

The report shows a table (and optionally the same data in a chart) for a
configurable time window and interval step size. In each interval, the
performance of the selected accounts is shown (based on the available
entries in the price database). The performance calculation can be either
"compare the increase within the interval with the start of the interval",
"compare the increase within the interval with the start of the report
window" or "compare the increase since the start of the report window with
the start of the report window". Only the price value of the commodity will
be used for the calculations, so the performance is independent of the
amount that is invested in the commodity. The amount invested in the
commodity is only relevant for (a) detecting stock splits/mergers and (b)
the performance of the commodity will only be calculated in those intervals
where there was an actual investment in the account.
By default, only accounts which have shares at the end of the reporting
window are included in the report, but empty shares can be turned on in the
Accounts settings tab.
During the calculations, it is assumed that the price values for a single
commodity are always in the same currency (I only have funds that are in
Euros, so I didn't go down that rabbit hole).

Hope somebody else also finds this report useful.


Kind regards,

-Johan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: investment-commodities-over-time.scm
Type: application/octet-stream
Size: 37239 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20220502/af9a5bac/attachment.obj>


More information about the gnucash-devel mailing list