There’s one more problem we’re going to address. Suppose you have an opaque fund, i.e. a robo trader or just an actively managed portfolio where you’re not the manager. In that case you can put money in and get money out but either you have limited control of the underlying actives or it’s too complicated to track it in all the details. In this case you want to track only total value of the fund over time and take all the case in- and out- flows in consideration.

Using the approach mentioned above you could do this with balance and pad statements. In this case all the differences will be tracked in something like Income:Fund:PnL account. The problem is that these updates will result in the differences tracked in the Income/Expenses and treated like a realized gain/loss. This is not factually correct and there’s a way to improve on that.

To address the problem there’s a valuation plugin, see detailed description with example in README. Instead of pad + balance operation you would use a valuation operation and provide total value of the fund over time. See the description and setup on the plugin page.

If you’re using the gen_accounts script to track totals, you just need to switch from opaque_funds to opaque_funds_valuation in the config. The correct corresponding statements will be generated for you.

If you’ve read through this and roughly understand what this is about, I’d recommend to use this plugin right away where appropriate. Otherwise you can migrate between two approaches later, it’s also not complicated.

Note that in order for the plugin to work properly you need to have at least a single transaction (or a pad instruction) to the corresponding account before the first valuation check (it requires a non-zero balance on the account). Otherwise you will see an error in the ledger.