1
4

ETFを100万投資した時の10年後の金額は?

Posted at

前回はYahooファイナンスのAPIを使って年利を出すコードを書いたが、
今回は実際に100万円入金したら10年後にいくらになるか計算するプログラムを書いたよ!
NISAの投資に役立ててね!

# 初期投資額
initial_investment = 1000000  # 100万円

# VYMとVTIの想定年間リターン率
annual_return_vym = 0.05  # 5%
annual_return_vti = 0.07  # 7%

# 投資期間(年)
years = 10

# VYMとVTIの平均配当利回り
dividend_yield_vym = 0.0328  # 3.28%
dividend_yield_vti = 0.0142  # 1.42%

# 年間総リターン率(価格上昇+配当)
total_annual_return_vym = annual_return_vym + dividend_yield_vym
total_annual_return_vti = annual_return_vti + dividend_yield_vti

# 配当再投資を含む複利計算
final_amount_vym_dividends = initial_investment* (1 + total_annual_return_vym) ** years
final_amount_vti_dividends = initial_investment * (1 + total_annual_return_vti) ** years

# 各ETFの10年後の総額(配当再投資含む)
print("VYM:"+str(final_amount_vym_dividends)+"")
print("VTI:"+str(final_amount_vti_dividends)+"")

出力例
VYM:2215554.670181221円
VTI:2244367.80105035円

1
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4