📜 ⬆️ ⬇️

Full cost of the loan (loan) - an example / calculation algorithm

Not so long ago, Federal Law No. 353 came into force, obliging financial institutions to disclose information about the so-called “Total Cost of a Credit (Loan)” (hereinafter referred to as PSC).
In this article (in principle, relating only to workers in the financial sphere), I would like to give an example of the calculation of the CPM. Perhaps someone will come in handy.

Important! Not so long ago, lawmakers make changes to the formula, which comes into force only from September 1, 2014. Everything described below is suitable only for a new formula. The article describes only the technical implementation of the calculation of the CPM in accordance with the norms of the law.

More importantly! All the information below is relevant for the case when the loan is issued by ONE payment, i.e. the borrower receives money once, and returns are made according to a predetermined payment schedule. This option covers 99% of loans issued (credit cards are not counted).

Actually, here is the beast itself:

We understand the meaning of terms.

UCS is defined as the product of 3 quantities - i, ChBP and the number 100. Let us examine the terms and notation used:
  1. What is BP (base period)
    BP under a consumer credit (loan) contract is a standard time interval that occurs with the highest frequency in the payment schedule for a consumer credit (loan) contract. If there are no time intervals between payments of less than one year or equal to one year in the payment schedule for a consumer credit (loan) agreement, the BP is one year.
    In fact, BP is the most common time interval between payments. If there are no recurring time intervals in the payment schedule and another order is not established by the Bank of Russia, the base period is a time interval that is arithmetic average for all periods, rounded to the standard time interval. The standard time interval is day, month, year, and also a certain number of days or months, not exceeding the duration of one year. So you can define your BP. If monthly payments, then BP = 365/12 ~ = 30
  2. What is PSB (number of base periods in a calendar year)
    The definition in the law is very vague, but as I understand it - this is the number of base periods that “fit” in one calendar year, ie:
    • For a standard payment schedule with monthly payments: ChBP = 12
    • Quarterly payments: ChBP = 4
    • Payments once a year or less: BSB = 1
    • If the payment schedule is tricky: for example, there are 2 payments once a quarter, and then 6 payments once a month, then 3 payments once a day, then the base period is 1 month. And ChBP = 12 (12 BP for a calendar year).

  3. What is i (interest rate base period, expressed in decimal form)
    It is impossible to understand (at least to me). Perhaps there is some meaning in determining the number i, but it is not intuitively possible to grasp this meaning. How to count i - we will analyze in the next section.

')

How to count i

Let us leave for later attempts to understand the “physical” meaning of the number i, and give it the following definition:
The number i is calculated by solving the following equation:
Where:


PSC calculation algorithm

Input: two arrays. The key is the cash flow number, the values ​​are the payment dates and the payment amount.
Outgoing data: UCS value (number).
Calculation procedure:
  1. Calculate ChBP (the number of base periods). The number of base periods - how many such periods will fit in 365 days, i.e. BSB = floor [365 / BP].
  2. For each k-th payment, consider the DP k , Q k , E k .
  3. We consider i as the methods of approximate calculation up to two decimal places.
  4. Multiply ChBP * i * 100.

Code!

There is a ready-made solution for javascript, as well as for VBA (there will even be an excel file for calculations).
Why VBA and Excel?
If suddenly you have a fire and nothing will work on September 1, 2014, then the most reasonable thing is to send out an excel-plate to the places of conclusion of contracts so that the PSC can be calculated at least that way at first.

In the examples, a schedule was taken for a loan of 100,000 rubles for 3 months at a rate of 12% per annum. Date of issue - September 1, 2014:
KeyCash flow dateCash flow amount
009/01/2014-100 000
one10/01/201434 002.21
211/01/201434 002.21
312/01/201434 002.21
Javascript solution
code
function psk() { //  -   var dates = [ new Date(2014, 8, 01), new Date(2014, 9, 01), new Date(2014, 10, 01), new Date(2014, 11, 01)]; //  -   var sum = [-100000, 34002.21, 34002.21, 34002.21 ]; var m = dates.length; //   //   bp bp=30; //     : var cbp = Math.round(365 / bp); //          -  var days = []; for (k = 0; k < m; k++) { days[k] = (dates[k] - dates[0]) / (24 * 60 * 60 * 1000); } //   Q    var e = []; var q = []; for (k = 0; k < m; k++) { e[k] = (days[k] % bp) / bp; q[k] = Math.floor(days[k] / bp); } //     0  i      s var i = 0; var x = 1; var x_m = 0; var s = 0.000001; while (x > 0) { x_m = x; x = 0; for (k = 0; k < m; k++) { x = x + sum[k] / ((1 + e[k] * i) * Math.pow(1 + i, q[k])); } i = i + s; } if (x > x_m) { i = i - s; } //  var psk = Math.floor(i * cbp * 100 * 1000) / 1000; //  alert(" = " + psk + " %"); } 

Jsfiddle demo: jsfiddle.net/exmmo/m5kbb0up/7

VBA + excel solution
Code
In column A, starting from the 2nd row are the dates of cash flows.
In column B, starting from the 2nd row are the cash flow amounts.
 Sub psk() Dim dates() Columns("A:A").Select dates() = Application.Transpose(Range(ActiveCell, Cells(Rows.count, ActiveCell.Column).End(xlUp))) Dim summa() Columns("B:B").Select summa = Application.Transpose(Range(ActiveCell, Cells(Rows.count, ActiveCell.Column).End(xlUp))) Dim m As Integer m = UBound(dates) bp = 30 cbp = Round(365 / bp) ReDim Days(m) For k = 2 To m Days(k) = dates(k) - dates(2) Next ReDim e(m) ReDim q(m) For k = 2 To m q(k) = Days(k) \ bp e(k) = (Days(k) Mod bp) / bp Next i = 0 x = 1 x_m = 0 s = 0.000001 Do While x > 0 x_m = x x = 0 For k = 2 To m x = x + summa(k) / ((1 + e(k) * i) * ((1 + i) ^ q(k))) Next i = i + s Loop If x > x_m Then i = i - s End If psk = Round(i * cbp, 5) Cells(3, 7).Value = psk End Sub 

Excel + VBA Demo: yadi.sk/i/oRTa8Id-a6UfV

Conclusion

The code is far from perfect, you can even say that it is poor. For example, an approximate calculation is performed by the most stupid way known to mankind. Please understand and forgive, in the current situation there is definitely not enough time to write something presentable. I'm sorry, I'll fix it.

If you have any comments or you have found a mistake - please report, I will be grateful. The most dangerous thing that can be - initially incorrect interpretation of the text of the law.

UPD UCS online calculator with user-friendly sane interface

Source: https://habr.com/ru/post/233987/


All Articles