To calculate weighted (average) price per unit, sum all the buying prices of particular stock (including taxes and commission paid during buying) and divide it with total number of shares.