15. Agent-based modeling of financial markets

15. Agent-based modeling of financial
markets
15.1 Dynamical systems
15.1.1 Motivation
What’s the cause of price randomness?
Peters (1996); Schmidt (2004).
Chaos: small changes in the initial conditions or parameters of a
system can lead to drastic changes in its behavior => system is
unpredictable.
If this price is determined with deterministic chaos, then price is partly
forecastable…
So far, no low-dimensional chaos was found in financial time series
Chaos as an artifact of the model…
Nonlinear continuous systems exhibit possible chaos if their dimension
exceeds two. However, 1D discrete systems may become chaotic.
1
15. Agent-based modeling of financial
markets
15.1.2 Logistic map
Generic map and iteration function: Xk = f(Xk-1)
Logistic map: Nk = ANk-1 – BNk-12
In units of Nmax = A/B,
Xk = A Xk-1 (1 - Xk-1), 0 ≤ Xk ≤ 1
10.2.4 Fixed point: X* = f(X*)
X*1 = 0, X*2 = (A – 1)/A
2
15. Agent-based modeling of financial
markets
15.1.2 Logistic map (continued 1)
If A ≤ 1, attractor in X*1; basin: 0 ≤ X ≤ 1
If 1 < A ≤ 3, attractor in X*2; basin: 0 ≤ X ≤ 1;
X*1 is repellent
If A > 3, bifurcations.
For A = 3.1, period-2: X1 ≈ 0.558 and X2 ≈ 0.764.
For A > 3.45, period-4; For A > 3.57, period-8;
3
15. Agent-based modeling of financial
markets
15.1.2 Logistic map (continued 2)
0.95
XIf
k
0.85
A ≤ 1, attractor in X*1; basin: 0 ≤ X ≤ 1
If 1 < A ≤ 3, attractor in X*2; basin: 0 ≤ X ≤ 1;
X*1 is repellent
0.75
If A > 3, bifurcations.
For A = 3.1, period-2: X1 ≈ 0.558 and X2 ≈ 0.764.
For A > 3.45, period-4; For A > 3.57, period-8;
0.65
0.55
0.45
0.35
A = 2.0
A = 3.1
k
A = 3.6
0.25
1
11
21
31
41
4
15. Agent-based modeling of financial
markets
15.1.2 Logistic map: bifurcation map
0
X
3 ≤ A < 4 (vertical axis)
1
5
15. Agent-based modeling of financial
markets
15.2 Highly stylized models
15.2.1 El Farol's bar problem (Arthur (1994))
N patrons are willing to attend a bar with a number of sits Ns < N.
Every patron prefers to stay at home if he expects that the
number of people attending the bar will exceed Ns. Patrons make
decisions using only the information on past attendance and
different predictors. No communications.
15.2.2 Minority game (Challet et al (2001))
A binary choice problem in which players have to choose between
two sides, and those on the minority side win. Given set of the
forecasting strategies defines the player decisions.
No communications.
6
15. Agent-based modeling of financial
markets
15.3 Adaptive equilibrium models
Brock & Hommes (1998); Chiarella & He (2001)
Total number of shares is fixed and distributed among M agents:
ΣNi= N = const, i = 1, ..M.
Return on a risky asset at time t: ρt = (pt - pt-1 + yt)/pt-1; yt is dividend.
Wealth expectation: Ei,t [Wi,t+1] = Wi,t [R + πi,t (Ei,t [ρt+1] - r)],
R = 1+r; r is risk-free interest rate;
πi,t is the wealth share invested in stock (demand) that is found from:
max { Ei,t [U(Wi,t+1)] }
πi,t
7
15. Agent-based modeling of financial
markets
15.3 Adaptive equilibrium models (continued 1)
CARA: U(Wi,t+1) = Ei,t [Wi,t+1] – 0.5aσ2
Demand: πi,t =
E i,t [  t 1 ] - r
a 2
Number of shares: Ni,t = πi,t Wi,t/pt
Then the market-clearing price equals
pt = Σ πi,t Wi,t/N
Ei,t[ρt+1] = fi(ρt, ..., ρt-Li ),
8
15. Agent-based modeling of financial
markets
15.3 Adaptive equilibrium models (continued 2)
Fundamentalists: EF,t[ρt+1] = r + δF; δF >0.
L
Chartists: EF,t[ρt+1] = r + δC +
a
k 1
k
 t  k ak > 0.
Contrarians: chartists with ak < 0.
Heterogeneous beliefs and bounded rationality (finite L): two steps
away from CAPM.
9
15. Agent-based modeling of financial
markets
15.4 Non-equilibrium price models
Beja & Goldman (1980), Lux & Marchesi (2000), Farmer & Joshi (2002).
dP/dt = γDex
15.4.1 Lux(1998):
nc(t) + nf(t) = N, nc(t) = n+(t) + n-(t)
dn = (n-p+- - n+p-+)(1 - nf/N) +
nf n+(p+f – pf+)/N +
dt
mimetic contagion
changes of strategy
market entry and exit
(b – a) n+
bnc = aN
p+- = 1/ p-+ = ν1 exp(-U1), U1 = α1(n+- n-)/nc + (α2/ν1) dP/dt
Dex = tc(n+- n-) + γnf(Pf – P)
Fat tails. Volatility clustering. Market booms and crashes.
10
15. Agent-based modeling of financial
markets
15.4 Non-equilibrium price models
15.4.2 Observable-variable model (Schmidt (1999))
No way to discern chartists and fundamentalists when price is below
(above) the fair value and is growing (falling).
N+(t) + N-(t) = N; Dex = δ(N+ - N-)
dN+/dt = v+-N- - v-+N+
dN-/dt = v-+N+ - v+-Nv+- = 1/ v-+ = ν exp(U), U =  P-1dP/dt +  (1 – P)
Equilibrium: n+ = n- = 0.5, P = 1.
Stability condition: αγδ < 1 + ε
11
15. Agent-based modeling of financial
markets
0.6
1.04
0.5
1.02
0.4
Price
1.06
1
0.3
0.98
0.2
0.96
0.1
Price
Number of buyers
0.94
Number of buyers
Decay of perturbations to equilibrium state in the observablevariables model with α = 1, β = 10, γ = 0.2, and δ = 1.
0
0
0.5
1
1.5
2
2.5
3
3.5
Time
4
4.5
5
5.5
6
12
15. Agent-based modeling of financial
markets
Limit cycle in the observable-variables model with α = 1.05, β = 1, γ = 1,
and δ = 1.
1.6
Number of buyers
Price
1.4
1.2
1
0.8
0.6
0.4
0.2
0
10
20
30
40
50
60
Time
13
15. Agent-based modeling of financial
markets
15.4. Why technical trading may work
Dex = d(n+ - n- + FnT)
Buying on dips – selling on tops:
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)
0, otherwise
If technical traders have sufficient trading volume, they can provoke the market
to follow them.
14
15. Agent-based modeling of financial
markets
1.08
1.06
1.04
1.02
Price
1
0.98
0.96
0.94
0.92
0.9
1
3
5
7
9
11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51
nT = 0
nT = 0.005
nT = 0.02
Time
15