I need to display in my system the amount of stocks that I own and the average price it took me to buy them. I am having a problem doing that when I include the selling.
Lets say I bought 4 stocks in 100 usd each.
and I sold 2 stocks for 110 usd each.
Now my position is 2 stocks for what average price ?
Option A: (4 * 110 + 2 * 100)/6 = 106.667
or
Option B: (4 * 110 - 2 * 100)/2 = 120 (doesnt think so )
If I do go with option A then if I sold 2 more for 110 I would get 0 amount but average (4*100+2*110+2*110)/8 - 105 . 0 stocks for 105 doesnt make any sense. thanks.
current share price * number of shares. Maybe you need to rephrase your question. And BTW, I don't think it's very on topic here in its current form. – Karol J. Piczak Apr 13 '11 at 13:30