Add a mechanism to automatically mark shares that were sold. I believe most people use First-in, First-out (FIFO) method for selling shares (they could use last-in, first-out (LIFO)). The FIFO or LIFO option could be selected when the investment is created. When shares are sold with a FIFO setting, the application starts with the latest, non-sold, shares and marks them sold up to the actual amount sold. For partial amount sold (ie 300 shares where bought on 3/20/2000; 200 shares were sold on 8/14/2018), a new, read-only, field to indicate how many shares are remaining. In my example, this new field's value would be 100. Marking sold share affects the average price for the shares. May also affect other reports. The way you calculate the number of shares will need to be modified. Once the shares are marked as sold. You only need to add all purchase related actives.