Research Article

The Hesitation of Anxious Traders in an Agent-Based Model

Algorithm 1

The agent-based model with anxious and fundamentalist agents.
Initialization. Set the initial fundamental price, initial actual price, initial proportions of agents, and parameters for simulations.
(0)Begin Algorithm.
(1)For each period t, do
Procedure 1:
(a)  Let the fundamentalist agents observe the current fundamental () and actual prices (), as well as all available historical prices (). They thus form their beliefs regarding the expectation () and variance ( of price based on , , and .
(b) The fundamentalist agents’ demands () take shape in line with , , , and their risk tolerances ().
Procedure 2:
(a) Let the anxious agents discern the and , thereby calculating all their forecast errors (). Their beliefs with respect to the expectation () and variance ( of price come into being according to and .
(b)If or , then
 the anxious agents’ demands () emerge in light of , , and their risk tolerances ().
Elseif the signs of any two are unequal, then
is maintained as before.
End Elseif.
End if.
Procedure 3:
(a) The fundamentalist and anxious agents calculate their strategic benefits, say, and .
(b) The market proportions of fundamentalist agents evolve over time using the discrete choice model with the device of strategic benefits.
(c)If anxious agents are rational, then
 anxious agents’ proportions evolve using the discrete choice model with the device of strategic benefits.
Elseif anxious agents are irrational, then
 anxious agents’ proportions evolve when is higher than an upper bound.
End Elseif.
End if.
End for.
(2)For each period , do
The aggregate excess demand and are implemented to determine through a hyperbolic tangential function.
End for.
(3)End Algorithm.