ICEACE Model: Closed Economy  1.0.0
Design Documentation of ICEACE Model
 All Data Structures Files Functions Variables Typedefs Macros Pages
bank_functions_housing.c
Go to the documentation of this file.
1 #include "../header.h"
2 #include "../bank_agent_header.h"
3 
4 /*
5  * \fn: int bank_housing_compute_capital_status()
6  * \brief: The bank sends out its equity and risky assets.
7  * The risky assets are loans to firms and mortgages to households plus liquidity.
8  * The message is recieved by the real estate agency to while 'counselling'
9  * households regarding their mortgage applications. The policy which
10  * requires a base for equity is applied. See Real Estate Agent implementation.
11  */
13 {
14  double risk;
15  /* liquidity is removed from the risk */
16  risk = MORTGAGES + LOANS_START;
18 
19  return 0; /* Returning zero means the agent is not removed */
20 }
21 
22 /*
23  * \fn: int bank_housing_deliver_mortages()
24  * \brief:
25  */
27 {
28  double amount = 0;
29 
31  /* The message is filtered via xmml. */
34  LIQUIDITY -= amount;
35  if (PRINT_DEBUG_MODE) {
36  printf("Bank ID = %d has given %f amount of mortgages. \n",ID, amount);
37  }
39 
40  return 0; /* Returning zero means the agent is not removed */
41 }
42 
43 /*
44  * \fn: int bank_housing_recieve_mortgage_principals()
45  * \brief: Bank recieves the mortgage principals from households.
46  */
48 {
49  double amount;
50 
52  /* The message is filtered via xmml. */
54  /* The amount recieved from households fire sale are considered solely as principal payment.
55  It does not contain interests.
56  */
57  MORTGAGES -= amount;
58  LIQUIDITY += amount;
59 
61 
62  return 0; /* Returning zero means the agent is not removed */
63 }
64 
65 /*
66  * \fn: int bank_housing_recieve_mortgages()
67  * \brief: Bank recives regular mortgage payments.
68  */
70 {
71  double principal;
72  double interest;
73 
75  /* The message is filtered via xmml. */
78 
79  MORTGAGES -= principal;
80  LIQUIDITY += principal + interest;
81  /* Households gets mortgages from their own bank only. */
82  INTERESTS_ACCRUED += interest;
83 
85 
86  return 0; /* Returning zero means the agent is not removed */
87 }
88 
89 /*
90  * \fn: int bank_housing_mortage_writeoff()
91  * \brief: Bank recieves mortgages that are written off.
92  */
94 {
95  double amount = 0;
96 
98  /* The message is filtered via xmml. */
100  MORTGAGES -= amount;
101  TOTAL_WRITEOFFS += amount;
102 
103  if (DATA_COLLECTION_MODE) {
104  char * filename;
105  FILE * file1;
106  filename = malloc(100*sizeof(char));
107  filename[0]=0;
108  strcpy(filename, "./outputs/data/BankruptcyInspection.txt");
109  file1 = fopen(filename,"a");
110  fprintf(file1,"%d %d %s %s %d %f\n",IT_NO, ID, "Bank", "Mortgages", ID, amount);
111  fclose(file1);
112  free(filename);
113  }
114 
116 
117  return 0; /* Returning zero means the agent is not removed */
118 }
119