<< . .

. 14
( : 18)

. . >>

outliers. Different data weighting schemes are used to address this
problem. In a simple approach, the historical data X(t À k) are multi-
plied by the factor lk where 0 < l < 1. Another interesting idea is
weighting the historical data with their volatility [4]. Namely, the asset
returns R(t) at time t used in forecasting VaR for time T are scaled
with the volatility ratio
R0 (t) ¼ R(t)s(T)=s(t) (11:2:1)
where s(t) is the historical forecast of the asset volatility.3 As a result,
the actual return at day t is increased if the volatility forecast at day T
is higher than that of day t, and vice versa. The scaled forecasts R0 (t)
are further used in calculating VaR in the same way as the forecasts
R(t) are used in equal-weight historical simulation. Other more so-
phisticated non-parametric techniques are discussed in [2] and refer-
ences therein.
An obvious advantage of the non-parametric approaches is their
relative conceptual and implementation simplicity. The main disad-
vantage of the non-parametric approaches is their absolute depend-
ence on the historical data: Collecting and filtering empirical data
always comes at a price.
The parametric approach is a plausible alternative to historical
simulation. This approach is based on fitting the P/L probability
distribution to some analytic function. The (log)normal, Student
126 Market Risk Measurement

and extreme value distributions are commonly used in modeling P/L
[2, 5]. The parametric approach is easy to implement since the analytic
expressions can often be used. In particular, the assumption of the
normal distribution reduces calculating VaR to (11.1.2). Also, VaR
for time interval T can be easily expressed via VaR for unit time (e.g.,
via daily VaR (DVaR) providing T is the number of days)
VaR(T) ¼ DVaR T (11:2:2)

VaR for a portfolio of N assets is calculated using the variance of the
multivariate normal distribution

sN ¼ (11:2:3)
i, j¼1

If the P/L distribution is normal, ETL can also be calculated analyt-

ETL(a) ¼ sPSN (Za )=(1 À a) À m (11:2:4)
The value za in (11.2.4) is determined with (11.1.3). Obviously, the
parametric approach is as good and accurate as the choice of the
analytic probability distribution.
Calculating VaR has become a part of the regulatory environment
in the financial industry [6]. As a result, several methodologies have
been developed for testing the accuracy of VaR models. The most
widely used method is the Kupiec test. This test is based on the
assumption that if the VaR(a) model is accurate, the number of the
tail losses n in a sample N is determined with the binomial distribu-
(1 À a)n a(NÀn)
PB (n; N, 1 À a) ¼ (11:2:5)
n!(N À n)!
The null hypothesis is that n/N equals 1 À a, which can be tested with
the relevant likelihood ratio statistic. The Kupiec test has clear mean-
ing but may be inaccurate for not very large data samples. Other
approaches for testing the VaR models are described in [2, 6] and
references therein.
Market Risk Measurement

The Jorion™s monograph [1] is a popular reference for VaR-based
risk management. The Dowd™s textbook [2] is a good resource for the
modern risk measurement approaches beyond VaR.

1. Consider a portfolio with two assets: asset 1 has current value $1
million and annual volatility 12%; asset 2 has current value $2
million and annual volatility 24%. Assuming that returns are
normally distributed and there are 250 working days per year,
calculate 5-day VaR of this portfolio with 99% confidence level.
Perform calculations for the asset correlation coefficient equal
to (a) 0.5 and (b) À0.5.
2. Verify (11.2.4).
*3. Implement the algorithm of calculating ETL for given P/L
density function. Analyze the algorithm accuracy as a function
of the number of integration points by comparing the calcula-
tion results with the analytic expression for the normal distribu-
tion (11.2.4).
This page intentionally left blank
Chapter 12

Agent-Based Modeling
of Financial Markets

Agent-based modeling has become a popular methodology in
social sciences, particularly in economics.1 Here we focus on the
agent-based modeling of financial markets [1]. The very idea of
describing markets with models of interacting agents (traders, invest-
ors) does not fit well with the classical financial theory that is based
on the notions of efficient markets and rational investors. However, it
has become obvious that investors are neither perfectly rational nor
have homogeneous expectations of the market trends (see also Section
2.3). Agent-based modeling proves to be a flexible framework for a
realistic description of the investor adaptation and decision-making
The paradigm of agent-based modeling applied to financial markets
implies that trader actions determine price. This concept is similar to
that of statistical physics within which the thermodynamic (macro-
scopic) properties of the medium are described via molecular inter-
actions. A noted expansion of the microscopic modeling methodology
into social systems is the minority game (see [2] and references therein).
Its development was inspired by the famous El Farol™s bar problem [3].
This problem considers a number of patrons N willing to attend a bar
with a number of seats Ns . It is assumed that Ns < N and every patron
prefers to stay at home if he expects that the number of people

130 Agent-Based Modeling of Financial Markets

attending the bar will exceed Ns . There is no communication among
patrons and they make decisions using only information on past
attendance and different predictors (e.g., attendance today is the
same as yesterday, or is some average of past attendance).
The minority game is a simple binary choice problem in which
players have to choose between two sides, and those on the minority
side win. Similarly to the El Farol™s bar problem, in the minority
game there is no communication among players and only a given set
of forecasting strategies defines player decisions. The minority game
is an interesting stylized model that may have some financial implica-
tions [2]. But we shall focus further on the models derived specifically
for describing financial markets.
In the known literature, early work on the agent-based modeling of
financial markets can be traced back to 1980 [4]. In this paper, Beja and
Goldman considered two major trading strategies, value investing and
trend following. In particular, they showed that system equilibrium
may become unstable when the number of trend followers grows.
Since then, many agent-based models of financial markets have
been developed (see, e.g., reviews [1, 5], the recent collection [6] and
references therein). We divide these models into two major groups. In
the first group, agents make decisions based on their own predictions
of future prices and adapt their beliefs using different predictor func-
tions of past returns. The principal feature of this group is that price is
derived from the supply-demand equilibrium [7“10].2 Therefore, we
call this group the adaptive equilibrium models. In the other group, the
assumption of the equilibrium price is not employed. Instead, price is
assumed to be a dynamic variable determined via its empirical relation
to the excess demand (see, e.g., [11, 12]). We call this group the non-
equilibrium price models. In the following two sections, we discuss two
instructive examples for both groups of models, respectively. Finally,
Section 12.4 describes a non-equilibrium price model that is derived
exclusively in terms of observable variables [13].

In this group of models [7“10], agents can invest either in the risk-
free asset (bond) or in the risky asset (e.g., a stock market index). The
risk-free asset is assumed to have an infinite supply and a constant
Agent-Based Modeling of Financial Markets

interest rate. Agents attempt to maximize their wealth by using some
risk aversion criterion. Predictions of future return are adapted using
past returns. The solution to the wealth maximization problem yields
the investor demand for the risky asset. This demand in turn deter-
mines the asset price in equilibrium. Let us formalize these assump-
tions using the notations from [10]. The return on the risky asset at
time t is defined as
rt ¼ (pt À ptÀ1 þ yt )=ptÀ1 (12:2:1)
where pt and yt are (ex-dividend) price and dividend of one share of
the risky asset, respectively. Wealth dynamics of agent i is given by
Wi, tþ1 ¼ R(1 À pi, t )Wi, t þ pi, t Wi, t (1 þ rtþ1 )
¼ Wi, t [R þ pi, t (rtþ1 À r)] (12:2:2)
where r is the interest rate of the risk-free asset, R ¼ 1 þ r, and pi, t is
the proportion of wealth of agent i invested in the risky asset at time t.
Every agent is assumed to be a taker of the risky asset at price that is
established in the demand-supply equilibrium. Let us denote Ei, t and
Vi, t the ˜˜beliefs™™ of trader i at time t about the conditional expect-
ation of wealth and the conditional variance of wealth, respectively. It
follows from (12.2.2) that
Ei, t [Wi, tþ1 ] ¼ Wi, t [R þ pi, t (Ei, t [rtþ1 ] À r)], (12:2:3)
Vi, t [Wi, tþ1 ] ¼ p2 t W2 t Vi, t [rtþ1 ] (12:2:4)
i, i,

Also, every agent i believes that return of the risky asset is normally
distributed with mean Ei, t [rtþ1 ] and variance Vi, t [rtþ1 ]. Agents choose
the proportion pi, t of their wealth to invest in the risky asset, which
maximizes the utility function U
max {Ei, t [U(Wi, tþ1 )]} (12:2:5)
pi, t

The utility function chosen in [9, 10] is
U(Wi, t ) ¼ log (Wi, t ) (12:2:6)
Then demand pi, t that satisfies (12.2.5) equals
Ei, t [rtþ1 ] À r
pi, t ¼ (12:2:7)
Vi, t [rtþ1 ]
132 Agent-Based Modeling of Financial Markets

Another utility function used in the adaptive equilibrium models
employs the so-called constant absolute risk aversion (CARA) function
[7, 8]
U(Wi, t ) ¼ Ei, t [Wi, tþ1 ] À Vi, t [Wi, tþ1 ] (12:2:8)
where a is the risk aversion constant. For the constant conditional
variance Vi, t ¼ s2 , the CARA function yields the demand
Ei, t [rtþ1 ] À r
pi, t ¼ (12:2:9)
The number of shares of the risky asset that corresponds to demand
pi, t equals
Ni, t ¼ pi, t Wi, t =pt (12:2:10)
Since the total number of shares assumed to be fixed
Ni, t ¼ N ¼ const , the market-clearing price equals
pt ¼ pi, t Wi, t (12:2:11)

The adaptive equilibrium model described so far does not contradict
the classical asset pricing theory. The new concept in this model is the
heterogeneous beliefs. In its general form [7, 10]
Ei, t [rtþ1 ] ¼ fi (rtÀ1 , . . . , rtÀLi ), (12:2:12)
Vi, t [rtþ1 ] ¼ gi (rtÀ1 , . . . , rtÀLi ) (12:2:13)
The deterministic functions fi and gi depend on past returns with lags
up to Li and may vary for different agents.3
While variance is usually assumed to be constant (gi ¼ s2 ), several
trading strategies fi are discussed in the literature. First, there are
fundamentalists who use analysis of the business fundamentals to
make their forecasts on the risk premium dF
EF, t [rtþ1 ] ¼ r þ dF (12:2:14)
In simple models, the risk premium dF > 0 is a constant but it can be a
function of time and/or variance in the general case. Another major
strategy is momentum trading (traders who use it are often called
chartists). Momentum traders use history of past returns to make
their forecasts. Namely, their strategy can be described as
Agent-Based Modeling of Financial Markets

EM, t [rtþ1 ] ¼ r þ dM þ ak rtÀk (12:2:15)

where dM > 0 is the constant component of the momentum risk
premium and ak > 0 are the weights of past returns rtÀk . Finally,
contrarians employ the strategy that is formally similar to the momen-
tum strategy
EC, t [rtþ1 ] ¼ r þ dC þ bk rtÀk (12:2:16)

with the principal difference that all bk are negative. This implies that
contrarians expect the market to turn around (e.g., from bull market
to bear market).
An important feature of adaptive equilibrium models is that agents
are able to analyze performance of different strategies and choose the
most efficient one. Since these strategies have limited accuracy, such
adaptability is called bounded rationality.
In the limit of infinite number of agents, Brock and Hommes offer
a discrete analog of the Gibbs probability distribution for the fraction
of traders with the strategy i [7]
nit ¼ exp [b(Fi, tÀ1 À Ci )]=Zt , Zt ¼ exp [b(Fi, tÀ1 À Ci )] (12:2:17)

In (12.2.17), Ci ! 0 is the cost of the strategy i, the parameter b is
called the intensity of choice, and Fi, t is the fitness function that
characterizes the efficiency of strategy i. The natural choice for the
fitness function is
Fi, t ¼ gFi, tÀ1 þ wi, t , wi, t ¼ pi, t (Wi, t À Wi, tÀ1 )=Wi, tÀ1 (12:2:18)
where 0 g 1 is the memory parameter that retains part of past
performance in the current strategy.
Adaptive equilibrium models have been studied in several direc-
tions. Some work has focused on analytic analysis of simpler models.
In particular, the system stability and routes to chaos have been
discussed in [7, 10]. In the meantime, extensive computational model-
ing has been performed in [9] and particularly for the so-called Santa
Fe artificial market, in which a significant number of trading strat-
egies were implemented [8].
134 Agent-Based Modeling of Financial Markets

The concept of market clearing that is used in determining price of
the risky asset in the adaptive equilibrium models does not accurately
reflect the way real markets work. In fact, the number of shares
involved in trading varies with time, and price is essentially a dynamic
variable. A simple yet reasonable alternative to the price-clearing
paradigm is the equation of price formation that is based on the
empirical relation between price change and excess demand [4].
Different agent decision-making rules may be implemented within
this approach. Here the elaborated model offered by Lux [11] is
described. In this model, two groups of agents, namely chartists and
fundamentalists, are considered. Agents can compare the efficiency of
different trading strategies and switch from one strategy to another.
Therefore, the numbers of chartists, nc (t), and fundamentalists, nf (t),
vary with time while the total number of agents in the market N is
assumed constant. The chartist group in turn is sub-divided into
optimistic (bullish) and pessimistic (bearish) traders with the numbers
nþ (t) and nÀ (t), respectively
nc (t) þ nf (t) ¼ N, nþ (t) þ nÀ (t) ¼ nc (t) (12:3:1)
Several aspects of trader behavior are considered. First, the chartist
decisions are affected by the peer opinion (so-called mimetic conta-
gion). Secondly, traders change strategy while seeking optimal per-
formance. Finally, traders may exit and enter markets. The bullish
chartist dynamics is formalized in the following way:
dnþ =dt ¼ (nÀ pþÀ À nþ pÀþ )(1 À nf =N) þ mimetic contagion
nf nþ (pþf À pfþ )=N þ changes of strategy
(b À a)nþ market entry and exit (12:3:2)
Here, pab denotes the probability of transition from group b to group
a. Similarly, the bearish chartist dynamics is given by
dnÀ =dt ¼ (nþ pÀþ À nÀ pþÀ )(1 À nf =N) þ mimetic contagion
nf nÀ (pÀf À pfÀ )=N þ changes of strategy
(b À a)nÀ market entry and exit (12:3:3)
It is assumed that traders entering the market start with the chartist
strategy. Therefore, constant total number of traders yields the
Agent-Based Modeling of Financial Markets

relation b ¼ aN=nc . Equations (12.3.1)“(12.3.3) describe the dynam-
ics of three trader groups (nf , nþ , nÀ ) assuming that all transfer
probabilities pab are determined. The change between the chartist
bullish and bearish mood is given by
pþÀ ¼ 1=pÀþ ¼ n1 exp(ÀU1 ),
U1 ¼ a1 (nþ À nÀ )=nc þ (a2 =n1 )dP=dt (12:3:4)
where n1 , a1 and a2 are parameters and P is price. Conversion of
fundamentalists into bullish chartists and back is described with
pþf ¼ 1=pfþ ¼ n2 exp(ÀU21 ),
U21 ¼ a3 ((r þ nÀ1 dP=dt)=P À R À sj(Pf À P)=Pj) (12:3:5)

where n2 and a3 are parameters, r is the stock dividend, R is the
average revenue of economy, s is a discounting factor 0 < s < 1, and
Pf is the fundamental price of the risky asset assumed to be an input
parameter. Similarly, conversion of fundamentalists into bearish
chartists and back is given by
pÀf ¼ 1=pfÀ ¼ n2 exp(ÀU22 ),
U22 ¼ a3 (R À (r þ nÀ1 dP=dt)=P À sj(Pf À P)=Pj) (12:3:6)

Price P in (12.3.4)“(12.3.6) is a variable that still must be defined.
Hence, an additional equation is needed in order to close the system
(12.3.1)“(12.3.6). As it was noted previously, an empirical relation
between the price change and the excess demand constitutes the
specific of the non-equilibrium price models4
dP=dt ¼ bDex (12:3:7)
In the model [11], the excess demand equals
Dex ¼ tc (nþ À nÀ ) þ gnf (Pf À P) (12:3:8)
The first and second terms in the right-hand side of (12.3.8) are the
excess demands of the chartists and fundamentalists, respectively;
b, tc and g are parameters.
The system (12.3.1)“(12.3.8) has rich dynamic properties deter-
mined by its input parameters. The system solutions include stable
equilibrium, periodic patterns, and chaotic attractors. Interestingly,
the distributions of returns derived from the chaotic trajectories
may have fat tails typical for empirical data. Particularly in [14], the
136 Agent-Based Modeling of Financial Markets

model [11] was modified to describe the arrival of news in the market,
which affects the fundamental price. This process was modeled with
the Gaussian random variable e(t) so that
ln Pf (t) À ln Pf (t À 1) ¼ e(t) (12:3:9)
The modeling results exhibited the power-law scaling and temporal
volatility dependence in the price distributions.


The models discussed so far are capable of reproducing important
features of financial market dynamics. Yet, one may notice a degree
of arbitrariness in this field. The number of different agent types and
the rules of their transition and adaptation vary from one model to
another. Also, little is known about optimal choice of the model
parameters [15, 16]. As a result, many interesting properties, such as
deterministic chaos, may be the model artifacts rather than reflections
of the real world.5
A parsimonious approach to choosing variables in the agent-based
modeling of financial markets was offered in [17]. Namely, it was
suggested to derive agent-based models exclusively in terms of observ-
able variables. Note that the notion of observable data in finance
should be discerned from the notion of publicly available data. While
the transaction prices in regulated markets are publicly available, the

<< . .

. 14
( : 18)

. . >>