ICEACE Model: Closed Economy
1.0.0
Design Documentation of ICEACE Model
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
Pages
IceaceModel1.0
Market_Housing
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
*/
12
int
bank_housing_compute_capital_status
()
13
{
14
double
risk;
15
/* liquidity is removed from the risk */
16
risk =
MORTGAGES
+
LOANS_START
;
17
add_bank_reagency_credibility_message
(
ID
,
EQUITY
, risk);
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
*/
26
int
bank_housing_deliver_mortages
()
27
{
28
double
amount = 0;
29
30
START_MORTGAGE_REQUESTS_MESSAGE_LOOP
31
/* The message is filtered via xmml. */
32
amount =
mortgage_requests_message
->
amount
;
33
MORTGAGES
+=
mortgage_requests_message
->
amount
;
34
LIQUIDITY
-= amount;
35
if
(
PRINT_DEBUG_MODE
) {
36
printf(
"Bank ID = %d has given %f amount of mortgages. \n"
,
ID
, amount);
37
}
38
FINISH_MORTGAGE_REQUESTS_MESSAGE_LOOP
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
*/
47
int
bank_housing_recieve_mortgage_principals
()
48
{
49
double
amount;
50
51
START_MORTGAGE_PAYMENT_FROM_SALE_MESSAGE_LOOP
52
/* The message is filtered via xmml. */
53
amount =
mortgage_payment_from_sale_message
->
amount
;
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
60
FINISH_MORTGAGE_PAYMENT_FROM_SALE_MESSAGE_LOOP
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
*/
69
int
bank_housing_recieve_mortgages
()
70
{
71
double
principal;
72
double
interest;
73
74
START_MORTGAGE_PAYMENT_MESSAGE_LOOP
75
/* The message is filtered via xmml. */
76
principal =
mortgage_payment_message
->
principal
;
77
interest =
mortgage_payment_message
->
interest
;
78
79
MORTGAGES
-= principal;
80
LIQUIDITY
+= principal + interest;
81
/* Households gets mortgages from their own bank only. */
82
INTERESTS_ACCRUED
+= interest;
83
84
FINISH_MORTGAGE_PAYMENT_MESSAGE_LOOP
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
*/
93
int
bank_housing_debt_writeoff
()
94
{
95
double
amount = 0;
96
97
START_MORTGAGE_WRITEOFF_MESSAGE_LOOP
98
/* The message is filtered via xmml. */
99
amount =
mortgage_writeoff_message
->
amount
;
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
115
FINISH_MORTGAGE_WRITEOFF_MESSAGE_LOOP
116
117
return
0;
/* Returning zero means the agent is not removed */
118
}
119
Generated on Tue Apr 8 2014 13:25:19 for ICEACE Model: Closed Economy by
1.8.3.1