Last active
July 1, 2025 10:06
-
-
Save bemitc/d24ed6c393fc0595a196054b491ded3a to your computer and use it in GitHub Desktop.
Variable percentage withdrawal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
def pmt(rate, nper, pv, fv=0, when=0): | |
if rate == 0: | |
return -(pv + fv) / nper | |
factor = (1 + rate) ** nper | |
return -(rate * (pv * factor + fv)) / ((1 + rate * when) * (factor - 1)) | |
def getVpw(port_eq, age): | |
eq_grt = 0.05 | |
bond_grt = 0.019 | |
port_bond = 1.0 - port_eq | |
grt = (port_bond * bond_grt) + (port_eq * eq_grt) | |
return pmt(grt, 100-age, -1, 0, 1) | |
r=getVpw(0.6, 60) | |
# if rate is more than 10%, constrain it to 10% like boglehead spreadsheet | |
if r > 0.1: | |
r = 0.1 | |
print(r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment