未来价值与复利频率

用 Python 进行债券定价与分析

Joshua Mayhew

Options Trader

含多次现金流的复利

  • 初始存款 USD 1,000
  • 月付息年利率 3%
  • 每月末追加 USD 100
  • 3 个月后有多少钱?
用 Python 进行债券定价与分析

含多次现金流的复利

deposit_fv = 1000 * (1 + 0.03) ^ 3

topup_1_fv = 100 * (1 + 0.03) ^ 2
topup_2_fv = 100 * (1 + 0.03) ^ 1
topup_3_fv = 100
print(deposit_fv + topup_1_fv + topup_2_fv + topup_3_fv)
1401.82
print(deposit_fv + topup_1_fv + topup_2_fv + topup_3_fv - 1000 - 100 - 100 - 100)
101.82
用 Python 进行债券定价与分析

未来价值函数

  • 之前的方法会非常重复
  • NumPy Financial 可简化这些计算
import numpy_financial as npf

?npf.fv
Signature: npf.fv(rate, nper, pmt, pv)

Given: * an interest `rate` compounded once per period, of which there are
* `nper` total
* a (fixed) payment, `pmt`
* a present value, `pv`
Return: the value at the end of the `nper` periods
用 Python 进行债券定价与分析

未来价值函数

  • 利率:每期3%(每月)
  • 期数:3 个月
  • 支付:每月末追加 USD -100
  • PV:初始存款 USD -1,000
用 Python 进行债券定价与分析

未来价值函数

npf.fv(rate=0.03, nper=3, pmt=-100, pv=-1000)
1401.82
用 Python 进行债券定价与分析

复利频率

投资10年、一次性投入$1,000(无追加)后可得多少?

  • 年利率5%,按年付息
  • 年利率5%,按月付息
  • 年利率5%,按日付息
用 Python 进行债券定价与分析

复利频率

  • 将利率除以复利频率,期数乘以复利频率
# Using annual compounding frequency
npf.fv(rate=0.05, nper=10, pmt=0, pv=-1000)
1628.89
# Using monthly compounding frequency
npf.fv(rate=0.05/12, nper=10*12, pmt=0, pv=-1000)
1647.01
# Using daily compounding frequency
npf.fv(rate=0.05/365, nper=10*365, pmt=0, pv=-1000)
1648.66
用 Python 进行债券定价与分析

让我们来练习!

用 Python 进行债券定价与分析

Preparing Video For Download...