📜 ⬆️ ⬇️

How i played bank

Hi, Habr!
Summer, everyone is on vacation. All costs. Where to get money? At the bank!
Only this July, the largest bank of Russia issued loans to individuals for 73,545,493 thousand rubles. Mortgage loans of the North-West branch account for 53% of the total portfolio, consumer loans - 32%, according to a press release . The average size of a mortgage loan in March 2014 amounted to about 1.5 million rubles . The average size of a car loan is
not less than 0.5 million rubles . Thank you lany for the links provided.
Based on the above figures, it can be assumed that the bank managed to issue a loan of about two hundred thousand people in a month.
Of course, scoring systems are used in this bank.
I learned about scoring systems a couple of years ago and was shocked. The idea that a soulless machine can make a decision about a loan on the basis of statistical data did not go out of my head. I wanted to play bank and check if the computer would give credits to my friends, just for fun. I have never seen real scoring systems, but I decided that it doesn’t matter, I will write it myself.
No sooner said than done.

I attach the link to the scoring system .
The sources have asked me more than a dozen people. And how many are not asked, even difficult to imagine. I spread the source on my dropbox .

Be careful, many images!

Introduction


Of course, this is only a model in which you can teach economics students of junior courses,
but all my friends now know that differentiated payments are more profitable than annuity payments.
')
The program was written 2 years ago, 2 weeks ago, in C # + MSSQL.
Now I accidentally dug it out and decided to show it to the habrasoobschestvu. What if some small bank will buy?
I opened the code, got scared, added a little multithreading and closed it.



SQL queries right in the handlers are awful, I know. But it is not interesting to finish, already played enough.

Development


The algorithm from the client’s point of view is something like this:

  1. The client fills out a questionnaire with answer options.
  2. Next, it selects the loan amount, a request is created in the database
  3. The system counts points for selected answers and determines whether to issue a loan or not.
  4. If the loan is approved, a contract and a payment table are created in the database.
  5. The client makes payments.
  6. When statistics accumulate, you can see which customer criteria affect its solvency.
  7. ???????
  8. PROFIT!


So, first we need a questionnaire, which is cleverly called a “scoring card”.
On the sites of the 3 largest Russian banks, questionnaires for obtaining consumer loans were found. We collect from three one, we print out and we create an expert commission. 15 people were caught, that was enough. An expert evaluates each scorecard score in the range from 0 to 100 points. There are also the following options:



Then the average score for each criterion is found and the final questionnaire is obtained.

IndicatorValue of the indicatorScore
Surname-one
Name-one
middle name-one
Date of Birth-one
Place of Birth-one
Floor-one
Proof of identity-one
Serial number-one
Issued by-one
date of issue-one
Phone-one
Address-one
AgeLess than 20 yearseight
20-25 years21
25-30 years36
30-35 years53
35-50 years old60
50-60 years37
60-65 years old15
More than 65 years-ten
AccommodationOwn housing47
Rental of property13
Hosteleight
Relativesten
Military unit9
Other (specify)-one
CitizenshipRF43
Other (I am a resident of the Russian Federation) (specify)five
I am not a resident of the Russian Federation-ten
Family statusSingle, not married)40
Married)65
Married (but married) but separated26
Divorced29
Widower (widow)34
Having childrenNo children66
One57
Two48
Three36
More than three24
Presence of dependentsNot66
One57
Two48
Three36
More than three24
The level of educationBelow the averageeleven
The average21
Specialized secondary33
Incomplete higher39
Higher education58
Some higher77
Academic degree84
Position occupied (position)Leader (director, deputy chairman, chief boo.)94
PI92
Civil servant47
Serviceman56
Specialist46
Sportsmanthirty
Working32
Student (idle)9
Pensioner (idle)eight
Unemployed0
Number of jobs over the past 3 yearsOne thing52
Two38
Three21
More than three9
Experience at this place of workLess than 1 year7
Up to 3 years24
Up to 5 years40
More than 5 years56
Total work experienceLess than 1 yearten
Up to 3 years20
Up to 10 years37
More than 10 years62
Type of activity of the organizationFinance, banks, insurance37
Consulting services32
Building39
Authorities and management42
Industry and engineering37
Information Technology / Telecommunications38
Wholesale and retail trade35
Transportthirty
Tourism36
Security activities34
Education32
The medicinethirty
The science33
Military establishment31
Social sphere21
Other industries (specify)-one
Average monthly income-one
Average monthly expenses-one
Real estate propertyGarage38
Apartment58
House65
Country house51
Land plot63
Other (specify)-one
Vehicle availabilityName, brand, year of release (specify)-one
No vehicle0


This profile is entered into the system.



In general, there are only 2 obligatory questions - “Average monthly incomes” and “Average monthly expenses”. Without them, there is no point in lending at all. Other questions can be changed, deleted, or add your own.

The “Sort” button will determine the maximum and minimum score of the scoring card, as well as determine the type of question.
When passing the questionnaire elements are created automatically. If a question has one answer, it will be displayed as a field, if more than 1 answer, it becomes a drop-down list. This is how the questionnaire looks from a client’s point of view.



And this client indicated the presence of the vehicle, and described it. The loan officer scored this criterion.



Evaluation system questionnaire.



Net monthly income is the difference between income and expenses. To increase the guarantee of payment, the program takes into account the reduction rate of payment of net profit, for example, 0.7. This means that if the client indicates 100 rubles of net profit per month, the bank calculates up to 70 rubles of monthly payment. Net income is multiplied by this ratio. The coefficient can be changed in the settings.

The questionnaire has an upper and lower limit of passage. The lower limit reduces the number of approved loans, but increases customer solvency. The upper limit cuts off fraudsters who create the ideal profiles for the most profitable loan. The upper and lower limits are set in percent, they can be changed in the settings. If the client’s application form, or rather, the amount of points for the application passes through the window between the upper and lower limits, the loan is considered approved. Now the client can choose one of the credit offers, the amount and duration of payments. Payments can be calculated as annuity or differential payments.



The client wants to receive 230,000 rubles with a payment period of 24 months in differentiated payments at 22.5 percent. For 24 months, the client will pay 283,906 rubles.



Here is the payment schedule.



Sweat from the excitement hands pressed the button "Checkout". The first payment of the client is the largest, it amounts to 13,896 rubles. The client’s monthly solvency is set at 14,611 rubles, so the bank agrees to issue a loan.



Hooray! If the loan is approved, an application, contract and payment table are created.



Pay attention to the status - the client is bad. Statuses of all 2 - good and bad. Why is bad, the client just took out a loan? The fact is that the first payment should arrive today.



The system determines the status of the client according to the payment table. For each payment date is indicated. The payments that are currently due must be paid are determined. The client is considered bad if the amount of non-payment:



Further, the security service of the bank, collectors, etc. should enter the business, but they are not provided for in the program.
The "Pay" button will help you change the status of the payment.



Payment paid, transaction is over!
To be honest, the numbers of accounts, contracts, bids and payment transactions are generated randomly, and for the operation of the system are not needed at all. But I am a solid bank!
But the client has become good.



Dirty hack - you can make a good customer a bad one by canceling his payments.

Statistics


And finally we got to the most interesting - statistics!
The list of questions is formed from the questionnaires of customers who approved the loan.
You can choose any question and watch the ratio of good / bad customers.



Loan offer "Good loan"


You can create your own credit offers. The editor allows you to set the maximum amount and duration of payments, set the interest rate depending on the size of the loan.



And now I want to take 140,000 rubles a year under the "Good Credit".



Overpaying 303 rubles - a dream!

But all the friends got a loan, the statistics are perfect, the market was full. The bank is in stagnation. What to do? NEED MORE CUSTOMERS! Where to get them? Generate!

Customer generation


The following text files were found:



So, the generator for the standard questionnaire:

QuestionAnswer
FloorBy chance
NameFrom the list
SurnameFrom the list
middle nameName from the list plus “ovich” or “ram”
Place of BirthFrom the list
Date of BirthFrom 1940 to 1997
Proof of identityPassport
Passport ID0000 000000 to 9999 999999
date of issueAny moment since the client turned 14
Place of issueFrom the list
Average monthly incomeFrom 4 thousand to 60 thousand rubles.
Average monthly expensesFrom 2 thousand to 30 thousand rubles.
Other questionsBy chance
Loan offerBy chance
Credit amountFrom 1 thousand rubles. up to the maximum amount of the loan offer
Number of months of paymentsFrom minimum to maximum for a given loan offer


Although revenues are 2 times higher than expenses, it still sometimes happens that net income is negative.

If a response with a clarification is selected, the application is canceled, and the signature “It is not possible to generate an application with clarification” appears in the status bar.

If the loan is approved, payments are generated. The probability of default is 1/20, but some customers have no luck and they miss 4 payments in a row.

The generator was moved to the main menu, you can create 1 or 200 applications at once.



Also there is a generator during the passage of the questionnaire.



Points generated by customers are subject to normal distribution. The leftmost column is those who are denied credit.



In the questionnaires of course get stupid, but the statistics immediately became more fun!







Conclusion - the worst customer is a single (unmarried) individual entrepreneur, with several higher educations.

Cited the links above. Play on your health!

May need .NET Framework 4.5 and SQL LocalDB 2012 x86 or SQL LocalDB 2012 x64 .

Thanks for your attention and have a nice Friday everyone!

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


All Articles