How do you calculate the average price of a stock?
Multiply each purchase's shares by its price, add those amounts together, and divide by the total number of shares. 10 shares at $100 and 30 shares at $80 cost $3,400 for 40 shares, an average of $85.