According to the announcement of the people's Bank of China, the conversion of pricing benchmark for stock floating rate loans was started as scheduled on March 1, 2020. According to the regulations, the lender of stock floating rate housing loan can choose fixed interest rate or floating interest rate of loan market quotation rate (LPR) when signing the contract again. Pricing benchmark can only be converted once, and cannot be converted again after conversion. Note that the meaning here should be that the bp value of LPR can only be changed once, not the value of LPR.

So, how do you choose to buy a house or have a mortgage? In response, experts said that the regulatory authorities clearly need to continue to promote LPR reform and guide the overall market interest rate and loan interest rate downward. LPR may be a better choice. In addition, the change of anchor will promote the "two tracks and one track" of interest rate marketization, first incremental and then stock gradual reform, effectively guarantee the smooth conversion of loan contract benchmark, and open a new space for the real economy to reduce costs.

But are experts reliable? I think most people have never succeeded in collecting socialist wool. So, we write our own program to determine whether we should replace LPR or not. Here is the source code. Brothers and sisters run for a while, and they have a bottom in mind.

# -*- coding: utf-8 -*- # @Time : 20/2/27 11:14 # @Author : Jay Lam # @File : LPR_Calculator.py # @Software: PyCharm import math import random import numpy as np # LPR computing def LPRCalculator(): currentLPR = round(float(input("Enter when changing the contract LPR interest rate(%): ")), 2) currentInterest = round(float(input("Enter the fixed interest rate when changing the contract(%): ")), 2) totalMonth = int(input("Enter total months of loan:")) residueMonth = int(input("Enter remaining loan months:")) paymentPlan = int(input("Enter the repayment method. Enter 0 for equal principal and 1 for equal principal and interest:")) rangeLimit = int(input("Enter whether to restrict the future LPR Interest rate forecast. Unlimited 0, reduced input-1，Add input 1:")) totalLoan = round(float(input("Enter total loan amount(element): ")), 2) bp = currentInterest - currentLPR # Base point calculation changeTimes = math.floor((totalMonth - residueMonth) / 12) # Once a year allowed to change interest rate if paymentPlan == 0: oldTotalPayment = averageCapital(totalLoan, 1, currentInterest, totalMonth)[0] oldResidueAmount = oldTotalPayment - averageCapital(totalLoan, 1, currentInterest, totalMonth)[1][ 0:(totalMonth - residueMonth)].sum() print(oldResidueAmount) print("LPR The difference between the total expenditure and the original plan is:", round(LPR(changeTimes, bp, rangeLimit, totalLoan, residueMonth, currentLPR)[0] - oldResidueAmount, 2), "element") elif paymentPlan == 1: oldTotalPayment = averageCapitalPlusInterest(totalLoan, 1, currentInterest, totalMonth)[0] oldResidueAmount = averageCapitalPlusInterest(totalLoan, 1, currentInterest, totalMonth)[1]*residueMonth print("LPR The difference between the total expenditure and the original plan is:", round(LPR(changeTimes, bp, rangeLimit, totalLoan, residueMonth, currentLPR)[1] - oldResidueAmount, 2), "element") # Random prediction LPR def LPR(changeTimes, bp, rangeLimit, totalLoan, resMonth, currentLPR): plan0 = [] plan1 = [] if rangeLimit == 0: for i in range(1, changeTimes): actualRatio = random.random() + bp currentYearPayment0 = averageCapital(totalLoan, 1, actualRatio, resMonth)[1][0:12].sum() currentYearPayment1 = averageCapitalPlusInterest(totalLoan, 1, actualRatio, resMonth)[1] * 12 # The equivalent principal and interest method is directly multiplied by 12 every month to obtain the annual expenditure value plan0.append(currentYearPayment0) plan1.append(currentYearPayment1) actualTotalPayment0 = np.array(plan0).sum() actualTotalPayment1 = np.array(plan1).sum() elif rangeLimit == 1: actualRatio = randAscending(changeTimes, currentLPR + 0.15, currentLPR - 0.15) # The future change range shall not exceed LPR ± 0.15 at the time of signing the contract for i in range(0, len(actualRatio)): currentYearPayment0 = averageCapital(totalLoan, 1, actualRatio[i], resMonth)[1][0:12].sum() currentYearPayment1 = averageCapitalPlusInterest(totalLoan, 1, actualRatio[i], resMonth)[1] * 12 plan0.append(currentYearPayment0) plan1.append(currentYearPayment1) actualTotalPayment0 = np.array(plan0).sum() actualTotalPayment1 = np.array(plan1).sum() elif rangeLimit == -1: actualRatio = randDecending(changeTimes, currentLPR + 0.15, currentLPR - 0.15) for i in range(0, len(actualRatio)): currentYearPayment0 = averageCapital(totalLoan, 1, actualRatio[i], resMonth)[1][0:12].sum() currentYearPayment1 = averageCapitalPlusInterest(totalLoan, 1, actualRatio[i], resMonth)[1] * 12 plan0.append(currentYearPayment0) plan1.append(currentYearPayment1) actualTotalPayment0 = np.array(plan0).sum() actualTotalPayment1 = np.array(plan1).sum() return round(actualTotalPayment0, 2), round(actualTotalPayment1, 2) # Generating ascending random number sequence def randAscending(changetimes, uplimit, lowlimit): se = [] for _ in range(changetimes): se.append(round(random.uniform(lowlimit, uplimit), 4)) se.sort(reverse=False) return se # Generating a sequence of descending random numbers def randDecending(changetimes, uplimit, lowlimit): se = [] for _ in range(changetimes): se.append(round(random.uniform(lowlimit, uplimit), 4)) se.sort(reverse=True) return se # Equal principal and interest method def averageCapitalPlusInterest(principal, principalRatio, anualInterestRate, month): # Principal represents the total house price, principal ratio represents the percentage of house loan, annual interest rate represents the annual interest rate of house loan, and month represents the month of house loan mortgage = np.around(principal * principalRatio, 2) # Calculate the amount of loan required monthlyPayment = np.around(mortgage * averageCapitalPlusInterestRate(month, monthlyInterestRate(anualInterestRate)), 2) # Calculate the monthly repayment amount totalInt = np.around(totalInterest(mortgage, monthlyPayment, month), 2) mortgageIntoTenThousand = np.around(mortgage / 10000, 2) # Convert the total amount of loan into ten thousand yuan print("loan:", mortgageIntoTenThousand, "Ten thousand yuan") # Output result print("Annual interest rate:", anualInterestRate, "%") print("Mortgage months:", month, "month") print("Monthly repayment:", monthlyPayment, "element") # Output result print("Interest payable:", totalInt, "element") totalPayment = np.around(monthlyPayment * month, 2) # Total repayment return totalPayment, monthlyPayment # Calculation of monthly interest rate with equal principal and interest method def monthlyInterestRate(anualInterestRate): return (anualInterestRate / 12) / 100 # Annual interest rate /12 # Calculation of proportion coefficient with equal principal and interest method def averageCapitalPlusInterestRate(month, monthlyInterestRate): R = monthlyInterestRate N = month I = R * math.pow(1 + R, N) / (math.pow(1 + R, N) - 1) return I def totalInterest(mortgage, monthlyPayment, month): return monthlyPayment * month - mortgage # Equal principal method def averageCapital(principal, principalRatio, anualInterestRate, month): # Principal represents the total house price, principal ratio represents the percentage of house loan, annual interest rate represents the annual interest rate of house loan, and month represents the month of house loan monthlyPayment = np.zeros(month) # Initialize monthly repayment amount cont = 0 mortgage = np.around(principal * principalRatio, 2) # Calculate the amount of loan required mortgageIntoTenThousand = np.around(mortgage / 10000, 2) # Convert the total amount of loan into ten thousand yuan print("loan:", mortgageIntoTenThousand, "Ten thousand yuan") # Output result print("Annual interest rate:", anualInterestRate, "%") print("Mortgage months:", month, "month") for i in range(0, month): monthlyPayment[i] = np.around((mortgage / month) + (mortgage * monthlyInterestRate2(anualInterestRate)) - ( i * (mortgage / month) * monthlyInterestRate(anualInterestRate)), 2) # Monthly repayment amount cont += np.around(monthlyPayment[i], 2) print("The first", i + 1, "Monthly repayment:", monthlyPayment[i], "element") # Output result totalPayment = np.around(sum(monthlyPayment), 2) # Calculation of total repayment print("Total repayment:", totalPayment, "element") return totalPayment, monthlyPayment # Calculating monthly interest rate with equal principal method def monthlyInterestRate2(anualInterestRate): return (anualInterestRate / 12) / 100 # Annual interest rate /12 if __name__ == "__main__": #print(LPR(25, 0.833, -1, 2730000, 300, 4.9)) #print(averageCapitalPlusInterest(2000000,1,4.3,360)) LPRCalculator()