This is specific to Indian Stock Market but I'd like to know about other markets as well if it works differently there.
Here's the scenario:-
I bought 10 units for INR 10 each.
The stock went up by 10, now each of my purchased unit is worth INR 20 each.
I bought another 10 units at INR 20 each.
After this, the stock went down by 5, so I sold 12 units, now I have 8 remaining.
Question: How many units did I sell of which purchase price? Is it 10 of the ones bought at INR 10 and 2 of the ones bought at INR 20 (Account Balance +40) or is it the other way around (Account Balance -40)? Just to confirm, what happens if I had another set of 10 that were purchased at INR 5?
Please let me know if this is a dumb question and I'm missing something obvious.