eos.bank
Class Bank

Object
  extended by eos.bank.Bank

public class Bank
extends Object

Bank. There is only one bank in the current model. Each agent has a checking account and a savings account. All transactions are settled exclusively through transfers between the checking accounts. A positive balance in the savings account signifies deposit and earns interest. A negative balance signifies loans and pays interest. There are two interest rates - loan interest rate and deposit interest rate. Loan interest rate is determined by the demand and supply of loans. Deposit interest rate is computed by distributing interest payment from all debtors to creditors.

Author:
zhihongx

Nested Class Summary
static class Bank.Account
          An account of an agent
 
Field Summary
static int CHECKING
          account type - checking account
static double INIT_LOAN_IR
          initial loan interest rate
static double IR0
          interest rate when total loan == total deposit
static int LT_IR_WIN
          time window within which long-term interest rate is measured
static double MAX_LOAN_IR
          max loan interest rate
static double MIN_LOAN_IR
          min loan interest rate
static int OTHER
          other payment
static int PRIIC
          primary income: wage for laborers, sales revenue for firms
static int SAVINGS
          account type - savings account
static int SECIC
          secondary income: e.g.
static double tao
          sensitivity of interest rate to a change in total loan
 
Constructor Summary
Bank()
           
 
Method Summary
static void act()
          Called by Economy.step() in every time step
static void closeAcct(int agentID)
          Close an account
static double deposit(int agentID, double amt)
          Deposit amt from agent's checking account to the savings account.
static Bank.Account getAcct(int agentID)
          Return a reference to the agent's account
static double getBalance(int agentID, int acctType)
          Return the balance of the specified account
static double getDepositIR()
          Return the deposit interest rate in the last step
static double getLoanIR()
          Return the loan interest rate in the last step
static double getLTDepositIR()
          Return the long-term deposit interest rate in the last step
static double getLTLoanIR()
          Return the long-term loan interest rate in the last step
static double getTotalDeposit()
          Return the total deposit in the last step
static double getTotalLoan()
          Return the total loan in the last step
static void openAcct(int agentID, double initCheckingBal, double initSavingsBal)
          Open an account, which includes a checking account and a savings account;
static void pay(int payerID, int payeeID, double amt, int purpose)
          Transfer amt from payer's checking account to payee's checking account.
static void payFrom(int payerID, double amt)
          Deduct amt from the payer's checking account.
static void payTo(int payeeID, double amt, int purpose)
          Add amt to payee's checking account.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT_LOAN_IR

public static final double INIT_LOAN_IR
initial loan interest rate

See Also:
Constant Field Values

IR0

public static final double IR0
interest rate when total loan == total deposit

See Also:
Constant Field Values

tao

public static double tao
sensitivity of interest rate to a change in total loan


LT_IR_WIN

public static final int LT_IR_WIN
time window within which long-term interest rate is measured

See Also:
Constant Field Values

MAX_LOAN_IR

public static double MAX_LOAN_IR
max loan interest rate


MIN_LOAN_IR

public static double MIN_LOAN_IR
min loan interest rate


CHECKING

public static final int CHECKING
account type - checking account

See Also:
Constant Field Values

SAVINGS

public static final int SAVINGS
account type - savings account

See Also:
Constant Field Values

PRIIC

public static final int PRIIC
primary income: wage for laborers, sales revenue for firms

See Also:
Constant Field Values

SECIC

public static final int SECIC
secondary income: e.g. dividend

See Also:
Constant Field Values

OTHER

public static final int OTHER
other payment

See Also:
Constant Field Values
Constructor Detail

Bank

public Bank()
Method Detail

openAcct

public static void openAcct(int agentID,
                            double initCheckingBal,
                            double initSavingsBal)
Open an account, which includes a checking account and a savings account;

Parameters:
agentID -
initCheckingBal - initial checking account balance
initSavingsBal - initial savings account balance

closeAcct

public static void closeAcct(int agentID)
Close an account

Parameters:
agentID -

getBalance

public static double getBalance(int agentID,
                                int acctType)
Return the balance of the specified account

Parameters:
agentID -
acctType - account type, either CHECKING or SAVINGS
Returns:
the balance of the specified account

getAcct

public static Bank.Account getAcct(int agentID)
Return a reference to the agent's account

Parameters:
agentID -
Returns:
a reference to the agent's account

payFrom

public static void payFrom(int payerID,
                           double amt)
Deduct amt from the payer's checking account. If the checking account contains an insufficient balance, funds would be withdrawn from the savings account to make up the difference.

Parameters:
payerID -
amt - amount to be paid

payTo

public static void payTo(int payeeID,
                         double amt,
                         int purpose)
Add amt to payee's checking account.

Parameters:
payeeID -
amt - amount to be paid
purpose - purpose of the payment (either PRIIC or SECIC)

pay

public static void pay(int payerID,
                       int payeeID,
                       double amt,
                       int purpose)
Transfer amt from payer's checking account to payee's checking account. If payer's checking account has a balance less than amt , funds will be withdrawn from the savings account to make up the difference.

Parameters:
payerID -
payeeID -
amt - amount to be paid
purpose - either PRIIC or SECIC

deposit

public static double deposit(int agentID,
                             double amt)
Deposit amt from agent's checking account to the savings account. If the checking account balance is less than amt, all remaining balance in checking account is deposited

Parameters:
agentID -
amt - amount to be paid
Returns:
actual amount of money deposited into the savings account

act

public static void act()
Called by Economy.step() in every time step


getLoanIR

public static double getLoanIR()
Return the loan interest rate in the last step

Returns:
the loan interest rate in the last step

getDepositIR

public static double getDepositIR()
Return the deposit interest rate in the last step

Returns:
the deposit interest rate in the last step

getLTDepositIR

public static double getLTDepositIR()
Return the long-term deposit interest rate in the last step

Returns:
the long-term deposit interest rate in the last step

getLTLoanIR

public static double getLTLoanIR()
Return the long-term loan interest rate in the last step

Returns:
the long-term loan interest rate in the last step

getTotalLoan

public static double getTotalLoan()
Return the total loan in the last step

Returns:
the total loan in the last step

getTotalDeposit

public static double getTotalDeposit()
Return the total deposit in the last step

Returns:
the total deposit in the last step