Optimise calculating pre/post realisation amounts.

Add associations so they can be eager-loaded, then sum with Ruby.