Các thước đo rủi ro thay thế

Nhập môn Phân tích Danh mục đầu tư với Python

Charlotte Werger

Data Scientist

Nhìn vào rủi ro phía giảm

Biểu đồ rủi ro tăng và giảm

  • Một thước đo rủi ro tốt nên tập trung vào khả năng thua lỗ, tức rủi ro phía giảm
Nhập môn Phân tích Danh mục đầu tư với Python

Tỷ lệ Sortino

$$

  • Tương tự tỷ lệ Sharpe, nhưng dùng độ lệch chuẩn khác
  • $ Sortino \; Ratio = \frac{R_p - R_f}{\sigma_d}$
  • $\sigma_d$ là độ lệch chuẩn của phía giảm.

$$

Tính rủi ro phía giảm

Nhập môn Phân tích Danh mục đầu tư với Python

Tỷ lệ Sortino trong Python

# Define risk free rate and target return of 0
rfr = 0
target_return = 0
# Calcualte the daily returns from price data
apple_returns=pd.DataFrame(apple_price.pct_change())
# Select the negative returns only 
negative_returns = apple_returns.loc[apple_returns['AAPL'] < target]
Nhập môn Phân tích Danh mục đầu tư với Python
# Calculate expected return and std dev of downside returns
expected_return = apple_returns['AAPL'].mean()
down_stdev = negative_returns.std()
# Calculate the sortino ratio
sortino_ratio = (expected_return - rfr)/down_stdev
print(sortino_ratio)
0.07887683763760528
Nhập môn Phân tích Danh mục đầu tư với Python

Mức sụt giảm tối đa (Maximum drawdown)

  • Mức sụt giảm phần trăm lớn nhất từ đỉnh xuống đáy
  • Phụ thuộc vào cửa sổ thời gian chọn
  • Thời gian hồi phục: thời gian trở lại hòa vốn

Các mức drawdown của S&P500 theo thời gian

Nhập môn Phân tích Danh mục đầu tư với Python

Mức sụt giảm ngày tối đa trong Python

# Calculate the maximum value of returns using rolling().max()
roll_max = apple_price.rolling(min_periods=1,window=250).max()

# Calculate daily draw-down from rolling max daily_drawdown = apple_price/roll_max - 1.0
# Calculate maximum daily draw-down max_daily_drawdown = daily_drawdown.rolling(min_periods=1,window=250).min()
# Plot the results daily_drawdown.plot() max_daily_drawdown.plot() plt.show()
Nhập môn Phân tích Danh mục đầu tư với Python

Mức sụt giảm tối đa của Apple

Biểu đồ mức sụt giảm tối đa của giá Apple

Nhập môn Phân tích Danh mục đầu tư với Python

Hãy thực hành!

Nhập môn Phân tích Danh mục đầu tư với Python

Preparing Video For Download...