I wanted to get my average buy price for some stocks I bought and see if I made money.
So far, for just buying and then later selling, I have been calculating the average buy price using this formula
((stockamount * price) + (stockamount * price)) / (stockamount + stockamount)
So if I buy 10 shares at 2.00 and 5 shares at 3, I would get an average buy price of
((10 * 2.00) + (5 * 3.00)) / (10 + 5) = 2.33
This is how I have calculated the average sell price as well.
Recently, I bought some shares, sold them at a higher cost, and then re-bought some when they slightly went under what I sold them at.
I have no idea how to determine my average buy price because I re-bought some. here is sample data
bought 10 @ 2.00
sold 7 @ 3.00
bought 2 @ 2.50
I thought maybe doing something like this
((10 * 2.00) - (7 * 3.00) + (2 * 2.50)) / (10 - 7 + 2) = 0.8
It does not make any sense that my average buy was 0.8
I have searched but can't find the answer to a buy, sell and rebuy. Please let me know if someone knows the correct formula to calculate the average buy price when you buy, sell and rebuy.
Thanks!