How to find the end amount using annual rate compounding by using specific dates from a starting date?

Viewed 30

I am writing a code to give me overall return on an initial $2500 deposit on a savings account since I opened it in July 2018 11:59pm. I have been depositing $800 every month since then; that is, on the last day of August 2018, 11:59 pm, I deposited $800 to the account, and on the last day of September 2018, 11:59 pm, you deposited another $800 to account, and so on. This account guarantees an annual rate of return of (rf% + 2.02%), where rf% is the annual deposit rate and 2.02% is the annual return.

I have found and listed the rf amounts from August '18-Feb '22. monthret is just the monthly return of the monthly annual rate at the time. :

rate = [1.91, 1.95, 2.19, 2.20, 2.27, 2.40, 2.40, 2.41, 2.42, 2.39, 2.38, 2.40, 2.13, 2.04, 1.83, 1.55, 1.55, 1.55, 1.58, 0.65, 0.05, 0.05, 0.08, 0.09, 0.10, 0.09, 0.09, 0.09, 0.09, 0.09, 0.08, 0.07, 0.07, 0.06, 0.08, 0.10, 0.09, 0.08, 0.08, 0.08, 0.08, 0.08]
monthret= [0.030263219, 0.004294301, -0.069403359, 0.017859382, -0.091776956, 0.078684405, 0.02972893, 0.017924288, 0.039313435, -0.065777726, 0.068930183, 0.013128195, -0.018091653, 0.017181168, 0.020431747, 0.034047064, 0.028589803, -0.00162809, -0.084110469, -0.125119321, 0.126844103, 0.045281775, 0.018388403, 0.055101297, 0.070064687, -0.039227954, -0.027665775, 0.107545658, 0.037121407, -0.01113664, 0.026091475, 0.042438634, 0.052425313, 0.005486503, 0.022213976, 0.022748109, 0.028990321, -0.04756914, 0.069143873, -0.008333731, 0.043612875, -0.052585089]

The main driver code so far that I have coded is:

t= int(input("Enter the amount of years.\n")) #the dates that will be 10,1,18 and 2,1,22 
P=2500 #this is starting principle 
r=int(2.02)
n=int(2.02//365)

for t in range(1, t+1):
    final = P * (((1 + (r/n)) ** (n*t)))
    t += 1
    print ("The value of my account on", round(t-1), "00:00 am, is", round(final,2))

I know that t needs some working on. I am having trouble for example when I want to know my value on September 1, 2018 that it will give me 3308 using this formula. "2500*(1+(1.91+2.02)/100/12)+800"

0 Answers
Related