Reference 〉 Hook

preTrade(agentAgent, partnerAgent, good1str, amt1num, amt2num)

Runs before an agent completes a trade of one good for another. Note that because agent.buy() aliases agent.trade(), this hook will also run when agents buy using the monetary good as well.

Required Parameters

  • agent Agent

    The agent initiating the trade.

  • partner Agent

    The trading partner of the agent.

  • good1 str

    The name of the good being given up (if amt1>0) or received (if amt1<0).

  • amt1 num

    The amount of good1 being traded.

  • good2 str

    The name of the good being received (if amt2>0) or given up (if amt2<0).

  • amt2 num

    The amount of good2 being traded.

Notes and Examples

  1. 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.