# Cost Basis

### Cost Basis

We should linger on Cost basis for a moment. When Google Finance presents summary statistics for your portfolio, it computes those numbers based on the number of shares *you still own*. So, if you bought 100 shares of XYZZ, then sold them all, your cost basis will be reported as 0, as will your market value, gain, etc. If you only sold 25 shares, then all of your statistics will be based on the 75 shares that you still own. Notice that since this ratio is applied to your entire initial investment, which includes commission costs, only the portion of your commission costs that applied to the stocks you still own will be considered.

Some examples:

*Suppose you buy 100 shares of XYZZ on April 1, 2008:*

Transaction: 4/1/2008 BUY XYZZ 100 @ $471.09 ($15 commission) -> the cost basis is 100 * 471.09 + 15 = $47.124.00

*Now Suppose you buy 100 shares of XYZZ on April 1, 2008, but sell 50 on 5/5/2008:*

Transaction: 4/1/2008 BUY XYZZ 100 @ $471.09 ($15 commission) -> At this point you own 100 shares.

Transaction: 5/5/2008 SELL XYZZ 50 @ $573.20 ($15 commission) -> Now you own 50 shares. The cost basis is 50 * 471.09 + 7.50 = $23,562.

*(Remember that commission costs are apportioned across all the shares you bought originally.)*

### Overall Return

The *overall return* will consider all the shares in your transaction history, whether you still own them or not. This is useful for evaluating your overall investment strategy, rather than simply tracking the stocks you currently own. We start by looking at all the transactions in the lot, and adding up how much money each of these transactions either cost you, or made you.

**For example:**

Transaction: 4/1/2008 BUY XYZZ 100 @ $471.09 ($15 commission) -> costs $47,124.00. We call this *cash out.*

Transaction: 5/5/2008 SELL XYZZ 50 @ $573.20 ($15 commission) -> makes $28,645.00. We call this *cash in.*

**Now we can compute the returns gain?** This is similar to the gain computed earlier, except that it takes into account the money you made on all transactions.

*returns gain = market_value + cash in - cash out.*

In our example, suppose XYZZ is trading at $484.77 today. That means that market value (based on the 50 shares still owned) is $24,238.50. Plugging this in to our equation gives us a returns gain of $5,759.50.

The overall return rate is just the returns gain divided by the amount you paid to establish the lot:

*Overall return = returns gain /cash out*

**the computation of return for short sales is somewhat different: see our page 'Short Lots'