I would like to ask about the NumPy functions such as NumPy.fv(). I am aware of how to execute this function but ONLY for interest rates that are fixed. I would like to ask what if the rates are floating/varying interest rate?
For example, ABC deposited $1,000,000 into a bank, the bank pays a floating rate annually as shown: [1.2%, 1%, 1.8%, 1.2%, 0.9%]. What is the total amount ABC will receive after 5 years?
What I understand is through the use of for-loops and I know how to work this out via Excel but I have been scratching my head around this if the TVM functions may be implemented inside this for-loop to work out the final compounded amount after 5 years?
I don't think you really need anything complicated for this:
principal = 1000000
rates = [0.012, 0.01, 0.018, 0.012, 0.009]
for r in rates:
principal = principal*(1+r)
print("${:,.2f}".format(principal))
Output:
$1,062,481.42