Sharpe ratios
The Sharpe ratio is a simple metric of risk adjusted return which was pioneered by William F. Sharpe. Sharpe ratio is useful to determine how much risk is being taken to achieve a certain level of return. In finance, you are always seeking ways to improve your Sharpe ratio, and the measure is very commonly quoted and used to compare investment strategies.
The original 1966 Sharpe ratio calculation is quite simple:
$$ S = \frac{ R_a - r_f }{\sigma_a} $$
- S: Sharpe Ratio
- \( R_a \): Asset return
- \( r_f \): Risk-free rate of return
- \( \sigma_a \): Asset volatility
The randomly generated portfolio is available as RandomPortfolios.
Cet exercice fait partie du cours
Introduction to Portfolio Risk Management in Python
Instructions
- Assume a
risk_freerate of 0 for this exercise. - Calculate the Sharpe ratio for each asset by subtracting the risk free rate from returns and then dividing by volatility.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Risk free rate
risk_free = ____
# Calculate the Sharpe Ratio for each asset
RandomPortfolios['Sharpe'] = ____
# Print the range of Sharpe ratios
print(RandomPortfolios['Sharpe'].describe()[['min', 'max']])