I have an idea on how to average price. When I had it at school, it was called "Boxplot", I don't know if there is an English word for it, but this is how it works:
Let's pretend the same item is in stock for x times. For every piece, its price is listed in a list, which is sorted by price. x divided by 2 gives you the number, which price is considered to be the average price.
For example, if the same item is sold for 10g, with 9 items at this price in stock, and for 10000g with one item in stock at this price. The list would look like this:
10g 10g 10g 10g 10g 10g 10g 10g 10g 10000g
(9x 10g; 1x 10000g, so we have a total stock of x=10 items)
x=10, so x divided by 2 is 5, so the 5th price is considered to be the average price, which 10g.
I think the normal way of getting the average price is adding every price and dividing it by x, so in this case the normal average price would be 1009g, which is far away from the "real" average price.
There are ways to make Boxplots better, for example a average price span could be created, but this works more or less the same way.