ñòð. 15 |

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

137

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

form

dp=dt Â¼ gDex (12:4:6)

where the excess demand, Dex , is proportional to the excess number of

buyers

Dex Â¼ d(nÃ¾ Ã€ nÃ€ ) Â¼ d(2nÃ¾ Ã€ 1) (12:4:7)

138 Agent-Based Modeling of Financial Markets

12.4.2 PRICE-DEMAND RELATIONS

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)

adgn

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

Price

Dex

1 0

âˆ’0.1

0.95

âˆ’0.2

0.9

âˆ’0.3

0.85

Price

Time Dex

âˆ’0.4

0.8

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.

139

Agent-Based Modeling of Financial Markets

1.6 1

0.8

1.4

0.6

1.2 0.4

0.2

1

Price

Dex

0

0.8

âˆ’0.2

âˆ’0.4

0.6

âˆ’0.6

0.4

âˆ’0.8

Price

Time

Dex

âˆ’1

0.2

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

12.4.3 WHY TECHNICAL TRADING SUCCESSFUL

MAY BE

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

8

< 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

1.08

1.06

1.04

1.02

Price

1

0.98

0.96

nT = 0

nT = 0.005

0.94

Time

0.92

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.

141

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.

12.4.4 THE BIRTH LIQUID MARKET

OF A

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

[19]

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

[19].8

143

Agent-Based Modeling of Financial Markets

1

n/no

0.9

0.8

0.7

1

0.6

2

0.5

3

0.4

0.3

0.2

0.1

Time

0

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.

12.5 REFERENCES FOR FURTHER READING

Reviews [1, 5] and the recent collection [6] might be a good starting

point for deeper insight into this quickly evolving field.

12.6 EXERCISES

**

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

Comments

CHAPTER 1

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.

CHAPTER 2

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

145

146 Comments

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-

fatsion/emarketh.htm.

CHAPTER 4

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.

t!0

CHAPTER 5

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

CHAPTER 7

1. Ironically, markets may react unexpectedly even at â€˜â€˜expectedâ€™â€™ news.

Consider a Federal Reserve interest rate cut, which is an economic

ñòð. 15 |