<< . .

. 15
( : 18)

. . >>

market microstructure is not (see Section 2.1). Still, every event in the
financial markets that affects the market microstructure (such as
quote submission, quote cancellation, transactions, etc.) is recorded
and stored for business and legal purposes. This information allows
one to reconstruct the market microstructure at every moment. We
define observable variables in finance as those that can be retrieved or
calculated from the records of market events. Whether these records
are publicly available at present is a secondary issue. More import-
antly, these data exist and can therefore potentially be used for
calibrating and testing the theoretical models.
The numbers of agents of different types generally are not observ-
able. Indeed, consider a market analog of ˜˜Maxwell™s Demon™™ who is
Agent-Based Modeling of Financial Markets

able to instantly parse all market events. The Demon cannot discern
˜˜chartists™™ and ˜˜fundamentalists™™ in typical situations, such as when
the current price, being lower than the fundamental price, is growing.
In this case, all traders buy rather than sell. Similarly, when the
current price, being higher than the fundamental price, is falling, all
traders sell rather than buy.
Only price, the total number of buyers, and the total number of
sellers are always observable. Whether a trader becomes a buyer or
seller can be defined by mixing different behavior patterns in the
trader decision-making rule. Let us describe a simple non-equilibrium
price model derived along these lines [17]. We discern ˜˜buyers™™ (þ)
and ˜˜sellers™™ (À). Total number of traders is N
Nþ (t) þ NÀ (t) ¼ N (12:4:1)
The scaled numbers of buyers, nþ (t) ¼ Nþ (t)=N, and sellers, nÀ (t)
¼ NÀ (t)=N, are described with equations
dnþ =dt ¼ vþÀ nÀ À vÀþ nþ (12:4:2)
dnÀ =dt ¼ vÀþ nþ À vþÀ nÀ (12:4:3)
The factors vþÀ and vÀþ characterize the probabilities for transfer
from seller to buyer and back, respectively
vþÀ ¼ 1=vÀþ ¼ n exp (U), U ¼ apÀ1 dp=dt þ b(1 À p) (12:4:4)
Price p(t) is given in units of its fundamental value. The first term in
the utility function, U, characterizes the ˜˜chartist™™ behavior while the
second term describes the ˜˜fundamentalist™™ pattern. The factor n has
the sense of the frequency of transitions between seller and buyer
behavior. Since nþ (t) ¼ 1 À nÀ (t), the system (12.4.1)“(12.4.3) is re-
duced to the equation
dnþ =dt ¼ vþÀ (1 À nþ ) À vÀþ nþ (12:4:5)
The price formation equation is assumed to have the following
dp=dt ¼ gDex (12:4:6)
where the excess demand, Dex , is proportional to the excess number of
Dex ¼ d(nþ À nÀ ) ¼ d(2nþ À 1) (12:4:7)
138 Agent-Based Modeling of Financial Markets

The model described above is defined with two observable vari-
ables, nþ (t) and p(t). In equilibrium, its solution is nþ ¼ 0:5 and
p ¼ 1. The necessary stability condition for this model is
1 (12:4:8)
The typical stable solution for this model (relaxation of the initially
perturbed values of nþ and p) is given in Figure 12.1. Lower values of
a and g suppress oscillations and facilitate relaxation of the initial
perturbations. Thus, the rise of the ˜˜chartist™™ component in the utility
function increases the price volatility. Numerical solutions with the
values of a and g that slightly violate the condition (12.4.8) can lead to
the limit cycle providing that the initial conditions are very close to
the equilibrium values (see Figure 12.2). Otherwise, violation of the
condition (12.4.8) leads to system instability, which can be interpreted
as a market crash.
The basic model (12.4.1)“(12.4.7) can be extended in several
ways. First, the condition of the constant number of traders (12.4.1)

1.2 0.4

1.15 0.3

1.1 0.2

1.05 0.1


1 0



Time Dex
0 5 10 15 20 25 30 35 40 45
Figure 12.1 Dynamics of excess demand (Dex) and price for the model
(12.4.5)“(12.4.7) with a ¼ b ¼ g ¼ 1, nþ(0) ¼ 0.4 and p(0) ¼ 1.05.
Agent-Based Modeling of Financial Markets

1.6 1

1.2 0.4



0 5 10 15 20 25 30 35 40 45 50 55 60
Figure 12.2 Dynamics of excess demand (Dex) and price for the model
(12.4.5)“(12.4.7) with a ¼ 1.05, b ¼ g ¼ 1, nþ(0) ¼ 0.4 and p(0) ¼ 1.05.

can be dropped. The system has three variables (nþ , nÀ , p) and
therefore may potentially describe deterministic chaos (see Chapter
7). Also, one can randomize the model by adding noise to the utility
function (12.4.4) or to the price formation equation (12.4.6). Interest-
ingly, the latter option may lead to a negative correlation between
price and excess demand, which is not possible for the deterministic
equation (12.4.6) [17].


A simple extension of the basic model (12.4.1)“(12.4.7) provides
some explanation as to why technical trading may sometimes be
successful [18]. Consider a system with a constant number of traders
N that consists of ˜˜regular™™ traders NR and ˜˜technical™™ traders
NT : NT þ NR ¼ N ¼ const. The ˜˜regular™™ traders are divided into
buyers, Nþ (t), and sellers, NÀ (t): Nþ þ NÀ ¼ NR ¼ const. The rela-
tive numbers of ˜˜regular™™ traders, nþ (t) ¼ Nþ (t)=N and
nÀ (t) ¼ NÀ (t)=N, are described with the equations (12.4.2)“(12.4.4).
The price formation in equation (12.4.6) is also retained. However,
140 Agent-Based Modeling of Financial Markets

the excess demand, in contrast to (12.4.7), incorporates the ˜˜tech-
nical™™ traders
Dex ¼ d(nþ À nÀ þ FnT ) (12:4:9)
In (12.4.9), nT ¼ NT =N and function F is defined by the technical
trader strategy. We have chosen a simple technical rule ˜˜buying on
dips “ selling on tops,™™ that is, buying at the moment when the price
starts rising, and selling at the moment when price starts falling
< 1, p(k) > p(k À 1) and p(k À 1) < p(k À 2)
F(k) ¼ À1, p(k) < p(k À 1) and p(k À 1) > p(k À 2) (12:4:10)
0, otherwise
Figure 12.3 shows that inclusion of the ˜˜technical™™ traders in the
model strengthens the price oscillations. This result can be easily
interpreted. If ˜˜technical™™ traders decide that price is going to fall,
they sell and thus decrease demand. As a result, price does fall and
the ˜˜chartist™™ mood of ˜˜regular™™ traders forces them to sell. This
suppresses price further until the ˜˜fundamentalist™™ motivation of







nT = 0
nT = 0.005
1 5 9 13 17 21 25 29 33 37 41 45 49
Figure 12.3 Price dynamics for the technical strategy (12.4.10) for
a ¼ g ¼ d ¼ n ¼ 1 and b ¼ 4 with initial conditions nþ(0) ¼ 0.4 and p(0)
¼ 1.05.
Agent-Based Modeling of Financial Markets

˜˜regular™™ traders becomes overwhelming. The opposite effect occurs
if ˜˜technical™™ traders decide that it is time to buy: they increase
demand and price starts to grow until it notably exceeds its funda-
mental value. Hence, if the ˜˜technical™™ traders are powerful enough in
terms of trading volumes, their concerted action can sharply change
demand upon ˜˜technical™™ signal. This provokes the ˜˜regular™™ traders
to amplify a new trend, which moves price in the direction favorable
to the ˜˜technical™™ strategy.


Market liquidity implies the presence of traders on both the bid/ask
sides of the market. In emergent markets (e.g., new electronic
auctions), this may be a matter of concern. To address this problem,
the basic model (12.4.1)“(12.4.7) was expanded in the following way
dnþ =dt ¼ vþÀ nÀ À vÀþ nþ þ SRþi þ rþ (12:4:11)
dnÀ =dt ¼ vÀþ nþ À vþÀ nÀ þ SRÀi þ rÀ (12:4:12)
The functions RÆi (i ¼ 1, 2, . . . , M) and rÆ are the deterministic and
stochastic rates of entering and exiting the market, respectively. Let us
consider three deterministic effects that define the total number of
traders.6 First, we assume that some traders stop trading immediately
after completing a trade as they have limited resources and/or need
some time for making new decisions
Rþ1 ¼ RÀ1 ¼ Àbnþ nÀ , b > 0 (12:4:13)
Also, we assume that some traders currently present in the market will
enter the market again and will possibly bring in some ˜˜newcomers.™™
Therefore, the inflow of traders is proportional to the number of
traders present in the market
Rþ2 ¼ RÀ2 ¼ a(nþ þ nÀ ), a > 0 (12:4:14)
Lastly, we account for ˜˜unsatisfied™™ traders leaving the market.
Namely, we assume that those traders who are not able to find the
trading counterparts within a reasonable time exit the market
142 Agent-Based Modeling of Financial Markets

Àc(nþ À nÀ ) if nþ > nÀ
Rþ3 ¼
0, if nþ nÀ

Àc(nÀ À nþ ) if nÀ > nþ
RÀ3 ¼ (12:4:15)
0, if nÀ nþ
We call the parameter c > 0 the ˜˜impatience™™ factor. Here, we neglect
the price variation, so that vþÀ ¼ vÀþ ¼ 0. We also neglect the sto-
chastic rates rÆ . Let us specify
nþ (0) À nÀ (0) ¼ d > 0: (12:4:16)
Then equations (12.4.11)“(12.4.12) have the following form
dnþ =dt ¼ a(nþ þ nÀ ) À bnþ nÀ À c(nþ À nÀ ) (12:4:17)
dnÀ =dt ¼ a(nþ þ nÀ ) À bnþ nÀ (12:4:18)
The equation for the total number of traders n ¼ nþ þ nÀ has the
Riccati form7
dn=dt ¼ 2an À 0:5bn2 þ 0:5bd2 exp (À2ct) À cd exp (Àct) (12:4:19)
Equation (12.4.19) has the asymptotic solution
n0 ¼ 4a=b (12:4:20)
An example of evolution of the total number of traders (in units of n0 )
is shown in Figure 12.4 for different values of the ˜˜impatience™™
factor. Obviously, the higher the ˜˜impatience™™ factor, the deeper the
minimum of n(t) will be. At sufficiently high ˜˜impatience™™ factor, the
finite-difference solution to equation (12.4.19) falls to zero. This
means that the market dies out due to trader impatience. However,
the exact solution never reaches zero and always approaches the
asymptotic value (12.4.20) after passing the minimum. This demon-
strates the drawback of the continuous approach. Indeed, a non-zero
number of traders that is lower than unity does not make sense. One
way around this problem is to use a threshold, nmin , such that
n Æ (t) ¼ 0 if n Æ (t) < nmin (12:4:21)
Still, further analysis shows that the discrete analog of the system
(12.4.17)“(12.4.18) may be more adequate than the continuous model
Agent-Based Modeling of Financial Markets






0 2 4 6 8 10 12 14 16
Figure 12.4 Dynamics of the number of traders described with equation
(12.4.19) with a ¼ 0.25, b ¼ 1, nþ(0) ¼ 0.2, and nÀ(0) ¼ 0.1: 1 - c ¼ 1; 2 - c ¼
10; 3 - c ¼ 20.

Reviews [1, 5] and the recent collection [6] might be a good starting
point for deeper insight into this quickly evolving field.

1. Discuss the derivation of the GARCH process with the agent-
based model [21].
2. Discuss the insider trading model [22]. How would you model
agents having knowledge of upcoming large block trades?
3. Discuss the parsimony problem in agent-based modeling of
financial markets (use [16] as the starting point).
4. Discuss the agent-based model of business growth [23].
5. Verify if the model (12.4.1)“(12.4.7) exhibits a price distribu-
tion with fat tails.
This page intentionally left blank

1. The author calls this part academic primarily because he has difficulty
answering the question ˜˜So, how can we make some money with this
stuff?™™ Undoubtedly, ˜˜money-making™™ mathematical finance has deep
academic roots.
2. Lots of information on the subject can also be found on the websites
http://www.econophysics.org and http://www.unifr.ch/econophysics.
3. Still, Section 7.1 is a useful precursor for Chapter 12.
4. It should be noted that scientific software packages such as Matlab and
S-Plus (let alone ˜˜in-house™™ software developed with C/Cþþ) are often
used for sophisticated financial data analysis. But Excel, having a wide
array of built-in functions and programming capabilities with Visual
Basic for Applications (VBA) [13], is ubiquitously employed in the finan-
cial industry.

1. In financial literature, return is sometimes defined as [P(t) À P(tÀ1)] while
the variable R(t) in (2.2.1) is named rate of return.
2. For the formal definition of IID, see Section 5.1.
3. USD/JPY denotes the price of one USD in units of JPY, etc.
4. Technical analysis is based on the seeking and interpretation of patterns
in past prices [7]. Fundamental analysis is evaluation the company™s


business quality based on its growth expectations, cash flow, and so
on [8].
5. Arbitrage trading strategies are discussed in Section 10.4.
6. An instructive discussion on EMH and rational bubbles is given also on
L. Tesfatsion™s website: http://www.econ.iastate.edu/classes/econ308/tes-

1. In the physical literature, the diffusion coefficient is often defined as
D ¼ kT=(6pZR). Then E[r2 ] À r0 2 ¼ 6Dt.
2. The general case of the random walk is discussed in Section 5.1.
3. Here we simplify the notations: m(t) ¼ m, s(y(t), t) ¼ s.
4. The notation y ¼ O(x) means that y and x are of the same asymptotic
order, that is, 0 < lim [y(t)=x(t)] < 1.

1. See http://econ.la.psu.edu/$hbierens/EASYREG.HTM.

1. Ironically, markets may react unexpectedly even at ˜˜expected™™ news.
Consider a Federal Reserve interest rate cut, which is an economic

<< . .

. 15
( : 18)

. . >>