0
$\begingroup$

Suppose I have daily adjusted closing prices for SPY, for example from yahoo finance. How from this calculate annual return?

Note: It's NOT about issues like 1.2 means 20% or 0.2 means 20%.

The most trivial solution is:

(adj. closing price at 31.12)/(adj. closing price at 1.1)

But:

  1. Result is different from the data appears on the web.
  2. The data appears on the web is not adequate. For example from here 2014 return was 11.39%, but from here it's 13.46% (This first result on Google so I suppose it's reasonable resource). Same one can find clicking other web sites...

Thanks,

$\endgroup$
  • 1
    $\begingroup$ If you have daily prices, then why not just throw away all the middle ones and take the return as final/initial? $\endgroup$ – will Dec 1 '16 at 13:47
1
$\begingroup$

My formula example does not include cash dividend, management fees (ie. SPY), holding taxes.

Daily %=(px[i]-px[i-1])/px[i-1], where px[i] today and px[i-1] is yesterday.

Annual %=(daily[Jan 1st]+1)*(daily[Jan 2nd]+1)....about 252 days terms)-1.

In Java, you could use this function. Pass in a daily time-series of returns.

    public static List<Tuple2<LocalDate,Double>> calcAnnualReturns(List<LocalDate> date, List<Double> values) {
    List<Tuple2<LocalDate,Double>> list = new ArrayList<>();
    int lastYear=-1; 
    BigDecimal tally=BigDecimal.ZERO;
    if( values.size()>0 ) {
        for (int i = 0; i < values.size(); i++) {
            LocalDate ldt=date.get(i);
            double value=values.get(i);
            if( i==0 ) {
                tally=BigDecimal.valueOf(value+1);
            }else{
                if( ldt.getYear()>lastYear ) {
                    // calculate
                    tally=tally.subtract(BigDecimal.ONE);                                                   
                    // add result
                    list.add(new Tuple2(LocalDate.of(lastYear, 12, 31), tally.doubleValue()));
                    // reset to new year
                    tally=BigDecimal.valueOf(value+1);
                }else{
                    tally=tally.multiply(BigDecimal.valueOf(value+1));
                }
            }
            //
            lastYear=ldt.getYear();
        }               
        // finish last value
        tally=tally.subtract(BigDecimal.ONE);                                   
        list.add(new Tuple2(LocalDate.of(lastYear, 12, 31), tally.doubleValue()));          
    }

    return list;
}
$\endgroup$
2
$\begingroup$

You can take the log difference: log(price_12-31-2014)-log(price_01-01-2014)

You can calculate the simple rate of return as: (price_12-31 - price_01-01)/price_01-01

$\endgroup$
2
$\begingroup$

Apples and oranges.

S&P 500 index (your first link) is not the same as SPY (your second link) so the results of course need not be the same.

S&P 500 is a statistical index published by Standard and Poors, it is generally given as price change only, although as a supplement a total return version is available from Wilshire and others; these TR figures differ slighlty from each other depending on how you assume dividends are reinvested. But if not otherwise specified S&P 500 is a price only (no dividends) figure.

SPY is an actual investable ETF which tracks the S&P 500 stocks. The shareholders of SPY collect both price change and dividends, which are distributed once a quarter. Also some modest fees are subtracted. The return on SPY is a good measure of achievable total return including realistic costs.

So it is not surprising that your second figure is about 2% higher than the first: the dividend yield on American stocks is about 2%!

$\endgroup$
  • $\begingroup$ Thanks, and how to get annual return from daily prices? Is there is something wrong with the way I wrote? Why use log? Also I saw some using formulas like (1+r)=(1+r)*(1+r)... Thanks, $\endgroup$ – michael Mar 20 '16 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.