Your cost basis is what you paid for the shares you still hold. Buy in stages and the app uses your average cost: everything you've paid divided by all the shares you've bought, so each new purchase moves it. When you sell, the shares sold take the average cost with them, and the average on what's left stays the same. Fees count only if you include them: the app uses the total cost you record for each purchase, so add dealing charges and stamp duty there if you want them in.
A corporate action can rewrite it, and it's the most common reason a cost basis goes wrong. After a share split the price falls — it halves in a two-for-one — but your recorded share count doesn't change, so the holding suddenly looks half its value. The app doesn't adjust for splits, so edit your buy lots: double the shares for a two-for-one and leave the total cost as it was. A consolidation works the other way round. After a spin-off, the company publishes how to divide your cost between the old shares and the new ones: reduce the original holding's cost by that amount and add the new holding with it. If your holdings sync from a broker, check whether the next sync has already done this.
A split changes the share count, not the cost. Record both, or the app shows a loss that didn't happen.
Educational content only. It is not personal financial advice.