Assignment: Amortization and Rolling Window Statistics Professor Ahmad Namini Python and Applications to Business Analytics Python and Applications to Finannce Exercise 1. Amortization Amortization is a method of repaying a loan through regular payments of interest and principal. The size of the loan (the original balance) is reduced by the principal part of the payment. The interest part of the payment pays the interest incurred on the remaining principal balance. As the principal gets paid down over the term of the loan, the interest part of the payment diminishes. A new loan is typically issued with the following metrics: Principal: amount of the loan Interest Rate: annual interest rate Term: amount of time to pay back the loan with monthly payments For instance, a given 15-year $250,000 at an 8.0% interest rate, the monthly payment of $2,389.13 is expected over the 180 (15 years * 12 payments per year) payments. An online calculator exists to verify this calculation. Please note that borrowers have the option to make an extra payment which will be applied to the principal. Extra payments will lower the principal and thus the loan can be paid in full earlier than expected. A typical payment schedule with no extra payment is seen in the following. Month Begin P Payment Interest Extra Payment 1 250,000.00 2,389.13 1,666.66 0.00 2 249,277.53 2,389.13 1,661.85 0.00 3 248,550.25 2,389.13 1,657.00 0.00 178 7,072.94 2,389.13 47.15 0.00 179 4,730.97 2,389.13 31.53 0.00 180 2,373.38 2,389.13 15.82 0.00 Total 430,043.44 180,043.43 Write a Python computer program to do the following: 1 P Applied 722.46 727.27 732.12 2,341.97 2,357.59 2,373.30 250,000.00 End P 249,277.53 248,550.25 247,818.12 4,730.97 2,373.38 0.00 Get user input of principal, minimum expected payment, interest, and extra payment, and error check that all input is valid. If not valid, have the user re-enter. Note that one does not need to enter the term of the loan. Compute and print the schedule of payments, similar to the table shown above. Compute and print the total (sum of all) payments, interest paid, and principal applied. Compute and print the total time (in years) required to payoff the loan. The computer program should leverage comments, readability, and above all, efficiency. Please note that I have attached a spreadsheet that computes the payment schedule. The spreadsheet will greatly enhance your ability to code the solution by understanding the nature of calculations. Exercise 2. Rolling Window Statistics Attached is a file containing named GOOG.csv which has daily market prices over one year. With the data, compute a rolling window statistics with the statistics being: Min, Max, and Mean Bollinger Bands: Mean +/- 2.0 * Standard Deviation Write a Python computer program to do the following: From the user, input the rolling window size. For instance, inputting 5 would yield a weekly window, 20 would be a monthly window, etc. Make sure that the input is valid. For instance, if a user inputs 400 but the time series only has 250 daily prices, this is not valid input. Over the rolling window size, compute the statistics mentioned above. Attached also is a file named read file.py for reading data from a file. 2