Simple Monetary Circuit Model

Simple Monetary Circuit Model preview image

1 collaborator

Default-person Per Hung Yap (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.3.0 • Viewed 60 times • Downloaded 2 times • Run 0 times
Download the 'Simple Monetary Circuit Model' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [households household]
breed [banks bank]

banks-own [assets liabilities LoansCreated networth deposits reserves Total-Loans-Outstanding deposit-to-asset loans-to-reserve]
households-own [MPC ExpenditureLag Gestation origin
  deposits ;; by this we meant ready deposits
  RM ;; currency
  FixedDeposits ;; real savings kind of situation
  ExpenditurePlans ;; schedule for expenditure, list of list have 3 things (amount to be spent, how much to spend this time, and how many tick left to be spent)
  orders]
globals [
  transactions
  output
  New-Output
  New-Transactions
]

to setup
  clear-all
  create-households No.Households
  ask households [
    set color white
    set shape "person"
    setxy random-xcor random-ycor
    set MPC ConsumptionPropensity  ;; How much to spend given income
    set ExpenditureLag LagDenom   ;;A denominator on how to chop up planned expenditure
    set Gestation lagOutput   ;;Time taken for output to be produced
    set origin 0
    set deposits endowment     ; change this soon. Give endowment
    set RM 0
    set FixedDeposits 0
    set ExpenditurePlans []
    set orders []
  ]
  create-banks 1
  ask banks [
    set color green
    set shape "house"
    set reserves Initial-Reserves
    set assets reserves
    set deposits endowment * No.Households
    set liabilities deposits


    set deposit-to-asset (deposits + 0.001) / (assets + 0.001)
    set Total-Loans-Outstanding deposits
    set loans-to-reserve Total-Loans-Outstanding / reserves
  ]
  set transactions 0
  set output 0
  set New-Transactions 0
  set New-Output 0
  UpdateNetworth
  reset-ticks
end 

to step
  if CreateLoan?  [
  CreateTheLoan ;; banks create loans and same amount of deposit is created
  ]
  OrganiseSavings  ;; Decide how much of income to save in FD (determined by MPC), convert deposits to currency
  Expend  ;; spend money, get recievers to process orders
  ProcessOrder
  UpdateNetworth
  tick
end 

to CreateTheLoan
  ask banks [
    if reserves > 0 [
    if (liabilities + 0.01) / assets < liability-to-asset-ratio  [
      if reserves < 0 [ print "negative!"]
      set LoansCreated loan-creation
      set Total-Loans-Outstanding Total-Loans-Outstanding + LoansCreated
      set deposits deposits + loan-creation
      let random-household one-of households
      send-loan-to random-household LoansCreated]
    ]

  ]
end 

to send-loan-to [recipient transfer]
  ask recipient [
    set deposits deposits + transfer
    set color red
    set origin 1
  ]
end 

to OrganiseSavings
  ask households [
    ifelse origin = 0 [
      let SavingsRate 1 - ConsumptionPropensity
      let current-household who
      ifelse deposits * (1 - SavingsRate) > MinimumSpending [        ;; if your deposit (after savings) is already higher than minimum spending
        PlanExpendProcess current-household SavingsRate LagDenom
        ][         ;; if existing deposits alone can't cover it all
          set color yellow
          set SavingsRate 0
          ifelse FixedDeposits + deposits >= MinimumSpending [    ; if still have money in FD, just don't have enough existing deposits
              let ExistingDeposit deposits
              let shortfall (MinimumSpending - ExistingDeposit)
              AltPlanExpendProcess current-household shortfall LagDenom
              ] [   ; if don't even have enough savings
                  set color pink
                  set SavingsRate 0
                  ifelse FixedDeposits > 0 [     ; gather crumbs
                  let leftover FixedDeposits
                  AltPlanExpendProcess current-household leftover LagDenom
                    ] [
                        PlanExpendProcess current-household SavingsRate LagDenom
                    ]
                ]
        ]
      ]
    [
      let SavingsRate 0
      if deposits > 0 [
        let current-household who
        PlanExpendProcess current-household SavingsRate LagDenom

        set origin 0   ;; return back as normal spender
      ]
    ]
  ]
end 

to AltPlanExpendProcess [OwnHousehold FDWithdrawal OwnLagDenom]
  ask household OwnHousehold [

        set FixedDeposits FixedDeposits - FDwithdrawal  ;; Keep this in bank as permanent savings
        let SpendingAcc deposits + FDwithdrawal

        BankWithdrawal SpendingAcc  ;; Update bankside (reduce reserve and deposit)
        set deposits 0  ;; Update deposit depletion
        set RM RM + SpendingAcc   ;; Update currency accumulation
        let chunks OwnLagDenom
        let amount SpendingAcc ;; new amount planned to be spent
        let delay ownLagDenom
        PlanExpenditure OwnHousehold amount chunks delay
  ]
end 

to PlanExpendProcess [OwnHousehold OwnSavingsRate OwnLagDenom]
  ask household OwnHousehold [
        let savings deposits * OwnSavingsRate   ;; determine how much to save
        set FixedDeposits FixedDeposits + savings ;; Keep this in bank as permanent savings
        let SpendingAcc deposits - savings
        set savings 0
        let withdrawal SpendingAcc ;; Intend to withdraw this much from bank
        BankWithdrawal SpendingAcc  ;; Update bankside (reduce reserve and deposit)
        set deposits 0  ;; Update deposit depletion
        set RM RM + withdrawal   ;; Update currency accumulation
        let chunks OwnLagDenom
        let amount SpendingAcc ;; new amount planned to be spent
        let delay ownLagDenom
        PlanExpenditure OwnHousehold amount chunks delay
  ]
end 

to Expend
  ask households [
    let pending-chunks []
    foreach ExpenditurePlans [
      [x] ->
      set pending-chunks filter [y -> item 1 y <= ticks] ExpenditurePlans ;;go through EP to find list with tick <= current tick
    ]
    foreach pending-chunks[
      [z] ->
      let chunk-size item 0 z  ;;get the amount to be spent in this ExpenditurePlans list
      let target-household one-of other households
      if target-household != nobody [
        send-money chunk-size target-household   ;;send money to this household
        place-order chunk-size target-household  ;;place orders towards the targeted household
      ]
      UpdateTransactions chunk-size
      set RM RM - chunk-size  ;; once money is sent, deducted from own account
      banktransaction chunk-size ;; hard currency returns back to bank, and so does deposit
    ]
    foreach pending-chunks [
      [sub] ->
      set ExpenditurePlans remove sub ExpenditurePlans
    ]
  ]
end 

to ProcessOrder
  ask households [
    let pending-order []
    foreach orders [
      [x] ->
      set pending-order filter [y -> item 1 y <= ticks] orders
    ]
    foreach pending-order [
      [z] ->
      let EconActivity item 0 z
      UpdateGDP EconActivity

      ]
    foreach pending-order [
      [sub] ->
      set orders remove sub orders
    ]
  ]
end 

to UpdateGDP [amount]
  set output output + amount
  set New-Output amount
end 

to UpdateTransactions [amount]
  set transactions transactions + amount
  set New-Transactions amount
end 

to send-money [amount target]
  ask target [
    set deposits deposits + amount
    set color blue
  ]
end 

to banktransaction [amount]
  ask banks [
    set reserves reserves + amount
    set deposits deposits + amount
  ]
end 

to place-order [amount target]
  ask target [
    let current-tick ticks
    let scheduled-tick current-tick + Gestation
    let NewOrder (list amount scheduled-tick)
    set orders fput NewOrder orders
  ]
end 

to PlanExpenditure [current-household amount chunks delay]   ;;; determine your expenditure chunks
  let ExpendChunk amount / chunks   ;; calculate the size of chunks
  let current-tick ticks
  let ExpendDelay 1
  ask household current-household [
    repeat chunks [
      let scheduled-tick current-tick + ExpendDelay
      let new-chunk (list ExpendChunk scheduled-tick)
      set ExpenditurePlans fput new-chunk ExpenditurePlans
      if ExpendDelay != Delay [
        set ExpendDelay ExpendDelay + 1
      ]
      if ExpendDelay > Delay [
        print "error!"
      ]
    ]
  ]
end 

to FDPlacement [placement]   ;; Cement savings decision
  ask banks [
    set deposits deposits + placement
    set reserves reserves + placement
  ]
end 

to BankWithdrawal [withdrawal]  ;; Update bankside
  ask banks [
    set reserves reserves - withdrawal
    set deposits deposits - withdrawal
  ]
end 

to UpdateNetworth  ;;Update bank networth
  ask banks [
    set assets Total-Loans-Outstanding + reserves
    set liabilities deposits
    set networth assets - liabilities
    set deposit-to-asset liabilities / assets
    set loans-to-reserve Total-Loans-Outstanding / (reserves + 0.001)
  ]
end 

There is only one version of this model, created 8 months ago by Per Hung Yap .

Attached files

File Type Description Last updated
Simple Monetary Circuit Model.png preview Preview for 'Simple Monetary Circuit Model' 8 months ago, by Per Hung Yap Download

This model does not have any ancestors.

This model does not have any descendants.