年化收益率

Python 投资组合分析入门

Charlotte Werger

Data Scientist

比较收益

  1. 年收益率:一个公历年内获得的总收益

  2. 年化收益率:从任意期限推算出的年度收益率

  3. 平均收益率:较长时期的总收益,平均到较短周期

  4. 累计(复利)收益:包含利息、股息与资本利得再投资的复合收益

Python 投资组合分析入门

为何要年化?

$$ 投资组合收益表

$$

  • 平均收益 = (100 - 50) / 2 = 25%
  • 实际收益 = 0%,因此平均值并不适合评估表现!
  • 如何比较不同持有期的组合?
  • 如何计入长期的复利效应?
Python 投资组合分析入门

计算年化收益率

$$

  • N 为年数:$rate= (1 +Return)^{1/N} -1$

  • N 为月数:$rate= (1+Return)^{12/N} -1$

  • 将任意期限转为年化率:

  • Return 为要年化的总收益率。
  • N 为已历经的期数。
Python 投资组合分析入门

用 Python 计算年化收益

# 查看时间序列的起止
apple_price.head(1)
date
2015-01-06    105.05
Name: AAPL, dtype: float64
apple_price.tail(1)
date
2018-03-29    99.75
Name: AAPL, dtype: float64
# 指定月份数
months = 38
Python 投资组合分析入门

用 Python 计算年化收益

# 计算总收益率
total_return = (apple_price[-1] - apple_price[0]) / 
                apple_price[0]

print (total_return)
0.5397420653068692
Python 投资组合分析入门

用 Python 计算年化收益

# 按月计算年化收益率
annualized_return=((1 + total_return)**(12/months))-1
print (annualized_return)
0.14602501482708763
# 选取三年区间
apple_price = apple_price.loc['2015-01-01':'2017-12-31']
apple_price.tail(3)
date
2017-12-27    170.60
2017-12-28    171.08
2017-12-29    169.23
Name: AAPL, dtype: float64
Python 投资组合分析入门

用 Python 计算年化收益

# 计算3年期的年化收益率
annualized_return = ((1 + total_return)**(1/3))-1

print (annualized_return)
0.1567672968419047
Python 投资组合分析入门

Passons à la pratique !

Python 投资组合分析入门

Preparing Video For Download...