Reference 〉Hook

checkBalance( Agent agent, num balance, Helipad model )

Modifies the value returned by agent.balance. Allows agents’ money balances to be filtered, e.g. if they hold money in a form other than the registered money good that ought to be counted toward total balances.

Required Parameters

  • agent Agent

    The agent whose balance is being checked.

  • balance num

    The agent's holdings of the registered monetary good.

  • model Helipad

    The model object.

Expected Return Value num

The money balance to be reported for the agent.

Notes and Examples

  1. charwick

    Mar 28, 2020 at 5:33

    Suppose you have a model where agents hold stocks of the monetary good, as well as accounts at a bank located at model.bank. This example has agent.balance return the sum of these two.

    @heli.hook
    def checkBalance(agent, balance, model):
    	balance += model.bank.account(agent)
    	return balance
  2. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.