Exchanges a quantity of one good for a quantity of another good, and records the demand for each. Requires at least two goods to have been registered, but does not require a monetary good. Ordinary usage would be giving up amt1
of good1
to get amt2
of good2
, but negative amounts can reverse the direction.
Parameters
partner — Agent, required
The agent object of the trading partner. The agent object can be retrieved by ID with
model.agent()
.good1 — str, required
The good to be sold (if
amt1>0
) or bought (ifamt1<0
). This good must have been previously registered withGoods.add()
.amt1 — num, required
The amount of
good1
to give up. Note thatamt1
can be negative, in which case the agent buys an amount ofgood1
.good2 — str, required
The good to be bought (if
amt2>0
) or sold (ifamt2<0
). This good must have been previously registered withGoods.add()
.amt2 — num, required
The amount of
good2
to obtain. Note thatamt2
can be negative, in which case the agent sells an amount ofgood2
.
Notes and Examples