用通膨調整未來價值
你現在可以把前面練習學到的內容整合起來,依照一個簡單的方法進行:
- 先用報酬率預測投資的未來價值
- 再用預測的通膨率把這個未來價值折現
上述方法會同時用到 .fv() 和 .pv() 兩個函式,求出某項投資換算成今日幣值、並已考量通膨後的估計價值。
本練習屬於課程
Python 金融概念入門
練習說明
- 使用
.fv()計算一筆 $10,000 投資以每年 8% 報酬率持有 10 年的未來價值,並指定給investment_1。 - 以每年 3% 的通膨率,計算
investment_1的通膨調整後現值,並指定給investment_1_discounted。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
import numpy as np
# Calculate investment_1
investment_1 = ____(rate=____, nper=____, pmt=0, pv=____)
print("Investment 1 will yield a total of $" + str(round(investment_1, 2)) + " in 10 years")
# Calculate investment_2
investment_1_discounted = ____(rate=____, nper=____, pmt=____, fv=____)
print("After adjusting for inflation, investment 1 is worth $" + str(round(-investment_1_discounted, 2)) + " in today's dollars")