シャープ比とソルティノ比

Pythonで学ぶ金融トレーディング

Chelsea Yang

Data Science Instructor

どの戦略が優れているか?

$$

戦略 1:
  • リターン:15%
  • ボラティリティ(標準偏差):30%

$$

戦略 2:
  • リターン:10%
  • ボラティリティ(標準偏差):8%
Pythonで学ぶ金融トレーディング

リスク調整後リターン

  • 異なる戦略の成績を比較可能にする
  • リターン獲得に要したリスクを示す指標

リスクとリターン

Pythonで学ぶ金融トレーディング

シャープ比

$$ \text{Sharpe Ratio} = (R_p - R_r)/\sigma_p $$

$$

  • $R_p $:戦略・ポートフォリオ・資産などのリターン
  • $R_r $:無リスク金利
  • $\sigma_p $:超過リターン($R_p-R_f$)の標準偏差

$$

  • シャープ比が大きいほど魅力的
Pythonで学ぶ金融トレーディング

もう一度選ぶ

$$

戦略 1:
  • リターン:15%
  • ボラティリティ(標準偏差):30%
  • シャープ比:15%/30% = 0.5

$$

戦略 2:
  • リターン:10%
  • ボラティリティ(標準偏差):8%
  • シャープ比:10%/8% = 1.25
Pythonで学ぶ金融トレーディング

bt のバックテストからシャープ比を取得

resInfo = bt_result.stats
# Get Sharpe ratios from the backtest stats
print('Sharpe ratio daily: %.2f'% resInfo.loc['daily_sharpe'])
print('Sharpe ratio monthly %.2f'% resInfo.loc['monthly_sharpe'])
print('Sharpe ratio annually %.2f'% resInfo.loc['yearly_sharpe'])
Sharpe ratio daily: 0.49
Sharpe ratio monthly 0.48
Sharpe ratio annually 1.34
Pythonで学ぶ金融トレーディング

シャープ比を手計算

# Obtain annual return
annual_return = resInfo.loc['yearly_mean']

# Obtain annual volatility volatility = resInfo.loc['yearly_vol']
# Calculate Sharpe ratio manually sharpe_ratio = annual_return / volatility print('Sharpe ratio annually %.2f'% sharpe_ratio)
Sharpe ratio annually 1.34
Pythonで学ぶ金融トレーディング

シャープ比の限界

  • 「良い」ボラティリティも「悪い」ボラティリティも罰する
  • 上方ボラは比率を不当に低く見せることがある

シャープ比の限界

Pythonで学ぶ金融トレーディング

ソルティノ比

$$ \text{Sortino Ratio} = (R_p - R_r)/\sigma_d $$

  • $R_p $:戦略・ポートフォリオ・資産などのリターン
  • $R_r $:無リスク金利
  • $\sigma_d $:超過リターン($R_p-R_f$)の下方偏差

下方ボラ

Pythonで学ぶ金融トレーディング

bt のバックテストからソルティノ比を取得

resInfo = bt_result.stats
# Get Sortino ratio from backtest stats
print('Sortino ratio daily: %.2f'% resInfo.loc['daily_sortino'])
print('Sortino ratio monthly %.2f'% resInfo.loc['monthly_sortino'])
print('Sortino ratio annually %.2f'% resInfo.loc['yearly_sortino'])
Sortino ratio daily: 0.70
Sortino ratio monthly 0.86
Sortino ratio annually 2.29
Pythonで学ぶ金融トレーディング

Let's practice!

Pythonで学ぶ金融トレーディング

Preparing Video For Download...