最大夏普比率 vs. 最小波動

Python 投資組合分析入門

Charlotte Werger

Data Scientist

還記得有效邊界嗎?

$$

  • 有效邊界:風險與報酬權衡最佳的所有投資組合
  • 最大夏普組合:有效邊界上夏普比率最高者
  • 最小波動組合:有效邊界上風險最低者

$$ Graph of the efficient frontier

Python 投資組合分析入門

調整 PyPortfolioOpt 最佳化

Chart of options in PyPortfolioOpt

Python 投資組合分析入門

最大夏普組合

最大夏普組合:有效邊界上的「最高夏普比率」

from pypfopt.efficient_frontier import EfficientFrontier
# Calculate the Efficient Frontier with mu and S
ef = EfficientFrontier(mu, Sigma)
raw_weights = ef.max_sharpe()
# Get interpretable weights 
cleaned_weights = ef.clean_weights()
{'GOOG': 0.01269,'AAPL': 0.09202,'FB': 0.19856,
 'BABA': 0.09642,'AMZN': 0.07158,'GE': 0.02456,...}
Python 投資組合分析入門

最大夏普組合

# Get performance numbers
ef.portfolio_performance(verbose=True)
預期年化報酬:33.0%
年化波動:21.7%
夏普比率:1.43
Python 投資組合分析入門

最小波動組合

最小波動組合:有效邊界上的「風險最低」

# Calculate the Efficient Frontier with mu and S
ef = EfficientFrontier(mu, Sigma)
raw_weights = ef.min_volatility()
# Get interpretable weights and performance numbers
cleaned_weights = ef.clean_weights()
{'GOOG': 0.05664, 'AAPL': 0.087, 'FB': 0.1591,
'BABA': 0.09784, 'AMZN': 0.06986, 'GE': 0.0123,...}
Python 投資組合分析入門

最小波動組合

ef.portfolio_performance(verbose=True)
預期年化報酬:17.4%
年化波動:13.2%
夏普比率:1.28
Python 投資組合分析入門

再看一次有效邊界

Graph of efficient frontier with minimum volatility and maximum Sharpe portfolio indicated

Python 投資組合分析入門

最大夏普 vs. 最小波動

Graph of efficient frontier with minimum volatility and maximum Sharpe portfolio indicated

Python 投資組合分析入門

一起來練習吧!

Python 投資組合分析入門

Preparing Video For Download...