calculate average purchase price