Session Ready
Exercise

S&P500 Sharpe ratio

In this exercise, you're going to calculate the Sharpe ratio of the S&P500, starting with pricing data only. In the next exercise, you'll do the same for the portfolio data, such that you can compare the Sharpe ratios of the two.

Available for you is the price data from the S&P500 under sp500_value. The risk-free rate is available under rfr, which is conveniently set to zero. Let's give it a try!

Instructions
100 XP
  • Calculate the total return of the S&P500 pricing data sp500_value using indexing and annualize the total return number; the data spans 4 years.
  • Calculate the daily returns from the S&P500 pricing data, you'll need this for the volatility calculation.
  • Calculate the standard deviation from the returns data and annualize the number using 250 trading days.
  • Finally, calculate the Sharpe ratio using the annualized return and the annualized volatility and print the results.