Python 投資組合分析入門
Charlotte Werger
Data Scientist
$ $
投資組合 1
$ $
投資組合 2
$$
$ Sharpe \; ratio = \frac{R_p - R_f} {\sigma_p} $
其中:$ R_p$ 為投資組合報酬,$R_f$ 為無風險利率,${\sigma_p} $ 為投資組合的標準差
還記得投資組合 ${\sigma_p} $ 的公式嗎?
$$
# Calculate the annualized standard deviation
annualized_vol = apple_returns.std()*np.sqrt(250)
print (annualized_vol)
0.2286248397870068
# Define the risk free rate
risk_free = 0.01
# Calcuate the sharpe ratio
sharpe_ratio = (annualized_return - risk_free) / annualized_vol
print (sharpe_ratio)
0.6419569149994251
$ $
投資組合 1
$ $
投資組合 2
Python 投資組合分析入門