My fear in such calculations is that we leave the big whales that do not move, outside. For example the CEO of Nvidia has 4% Nvidia that in today's value is 160B, but the basis is from the IPO, so more like $40M. So now our back-of-the envelope calculation is 160B off.
People with large holdings are required to file with the SEC and you can search those records online going back to the mid 1980s.
Someone could download a dump of the whole thing (the SEC has a link and updates it every night) and assemble all of the various documents in a way to get a decent estimate.
An example Form 4 (which will show cost basis of acquisitions):
In my humble opinion,It would be 0 as there is no transaction taking place. The original question is about stock buyers not stock holders which is often related but not always.