股息再投资计算器
计算股息再投资(DRIP)如何随时间增长您的投资组合。对比有无再投资的差异。
$88,810
最终价值(含DRIP)
$38,697
最终价值(不含DRIP)
$28,477
已获股息总额
$50,113
DRIP红利
| 年份 | 含DRIP | 不含DRIP |
|---|---|---|
| 1 | $11,154 | $10,700 |
| 2 | $12,441 | $11,449 |
| 3 | $13,876 | $12,250 |
| 4 | $15,477 | $13,108 |
| 5 | $17,263 | $14,026 |
| 6 | $19,255 | $15,007 |
| 7 | $21,476 | $16,058 |
| 8 | $23,954 | $17,182 |
| 9 | $26,718 | $18,385 |
| 10 | $29,801 | $19,672 |
| 11 | $33,240 | $21,049 |
| 12 | $37,075 | $22,522 |
| 13 | $41,352 | $24,098 |
| 14 | $46,124 | $25,785 |
| 15 | $51,446 | $27,590 |
| 16 | $57,381 | $29,522 |
| 17 | $64,002 | $31,588 |
| 18 | $71,387 | $33,799 |
| 19 | $79,623 | $36,165 |
| 20 | $88,810 | $38,697 |
常见问题
代码实现
def drip_calculator(
initial: float,
annual_yield: float,
annual_growth: float,
years: int,
periods_per_year: int = 4 # quarterly
) -> list[dict]:
"""Calculate DRIP portfolio growth year by year."""
period_yield = annual_yield / 100 / periods_per_year
period_growth = (1 + annual_growth / 100) ** (1 / periods_per_year)
portfolio = initial
results = []
for year in range(1, years + 1):
year_dividends = 0
for _ in range(periods_per_year):
div = portfolio * period_yield
year_dividends += div
portfolio = (portfolio + div) * period_growth
results.append({
"year": year,
"portfolio_value": round(portfolio, 2),
"year_dividends": round(year_dividends, 2),
})
return results
results = drip_calculator(
initial=10000,
annual_yield=4.0,
annual_growth=7.0,
years=20,
periods_per_year=4
)
for r in results[-5:]:
print(f"Year {r['year']}: ${r['portfolio_value']:,.2f} (dividends: ${r['year_dividends']:,.2f})")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.