Say you buy 1000 shares of stock XYZ at $5.00. Next you sell 500 shares at $7.00. That will leave you with 500 shares at a cost basis of $3.00. It went something like that.