Let's assume below as my transactions:

bought 10 at 120
bought 20 at 150
sold 15 at 170

What will be the average price of my holdings i.e., for 18 shares.

Is it 110 ?

image of OP's spreadsheet calculations

  • Do you want the average price from your perspective, as opposed to the market's? If yes, then this is correct
    – user56973
    Commented Jun 30, 2017 at 11:48

1 Answer 1


Your sheet shows math. OK math, but probably not good accounting for taxes. You can set up your account for FIFO (first in first out) LIFO (last in first out) or specific shares identified by lot. Average cost basis is available, and you did the math right, but it is less common, and not a default broker choice. Some also offer a tax optimized sale choice, which would choose higher cost lots for short term gain, or longer term lots to capture long term cap gains.

Note: The choice has to be made with the broker prior to the sales. You don't get to choose after the fact.

  • 1
    OP doesn't say where they're from; but in the UK "average price" appears to be the way things are taxed (HMRC page) -- I believe that in essence they regard the shares as "indistinguishable" so you cannot "pick" which ones to sell.
    – TripeHound
    Commented Jun 30, 2017 at 14:36
  • @TripeHound That would correct for Canadian tax treatment as well. Commented Jun 30, 2017 at 14:39
  • You are both right, that I should have first asked for a country tag. Although, I suppose I could have phrased the answer to be more inclusive. Commented Jun 30, 2017 at 14:48
  • @Grade'Eh'Bacon Yes, in the simplest case it is the same for Canada. I'll just add that in some cases, the Adjusted Cost Base changes further based on the nature of distributions (dividend, return of capital, reinvested or not, etc.) But for no distributions it is simple enough. Commented Jun 30, 2017 at 14:48
  • I just need this for creating an app for cryptocurrency..Soon I publish in market. So I am not taking care of Tax related stuff for now atleast.
    – iappmaker
    Commented Jun 30, 2017 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .