fengling.eth
Linking agent-based and stochastic models of markets
← Back

Econophysics · PNAS 2012

Linking agent-based models and stochastic models of financial markets

Ling Feng, Baowen Li, Boris Podobnik, Tobias Preis, H. Eugene Stanley

National University of Singapore (Graduate School for Integrative Sciences and Engineering · Physics) · Boston University · University of Rijeka · University of Ljubljana · Zagreb School of Economics and Management · ETH Zurich · Artemis Capital Asset Management

Daily stock returns have fat tails and a long memory. We start from what traders are documented to do, copy each other’s technical strategies and judge prices over different horizons, and obtain both features quantitatively, with every parameter taken from market data rather than from a statistical fit.

The claim

Fat tails appear when technical traders act in concert after large price moves; long memory appears because they look back over different horizons.

One mechanism, opinion convergence among technical traders, drives both an agent-based model and the stochastic model derived from it. The agent-based model gives return tails with exponent close to 4 for any number of agents; the stochastic model predicts how the memory of |returns| and of squared returns decays, from a single exponent measured in a survey of fund managers.

0 · Context

Two ways of modelling prices, each missing what the other has

Two empirical facts about stock returns are known to hold across markets and decades. Large price changes are far more common than a Gaussian bell curve allows: the probability that a daily return exceeds xx falls off as a power law, P(∣r∣>x)∼x−ξP(|r|>x)\sim x^{-\xi}, with a tail exponent ξ\xi of about 3 to 4 (a fat tail). And the size of price changes has a long memory: a turbulent day is followed by turbulent days, and the correlation of absolute returns decays slowly, as a power of the time lag, over months.

Two traditions model these facts. Stochastic models, starting with Engle’s ARCH and Bollerslev’s GARCH processes, let the variance of tomorrow’s return depend on past returns. They reproduce the statistics accurately, but their parameters are fitted to the data and say nothing about why traders produce them. Agent-based models, from statistical physics and economics, simulate individual traders and give a qualitative picture of where the regularities come from. But they rarely match the data quantitatively, and in many of them the fat tails fade away when the number of agents grows unless the interaction strength is re-tuned.

In our paper we combine the two: an agent-based model built only from documented trading behaviour, a stochastic model derived from it, and parameters that are measured in markets and surveys instead of fitted.

1 · Evidence

Technical traders, not fundamentalists, drive daily price changes

Fundamentalists try to work out what a company is worth. They hold most of the shares, institutional owners held 83 % of the outstanding shares on average in our data, but they trade rarely. Technical traders instead make decisions from price patterns, and they trade their smaller holdings much more often, so they account for most of the daily trading. We therefore model only technical traders and treat fundamentalists as background noise. The data end in 2006, before high-frequency trading became significant.

The model rests on four documented features of their behaviour:

  1. Daily decisions that look random. Each trader uses a different strategy, so from outside, the decision to buy, sell or hold appears random. Decisions are made once a day, because intraday trading shows little persistence.
  2. Price change follows the order imbalance. The price moves with the difference between buy and sell orders on a day; the largest move happens when everyone buys or everyone sells.
  3. Interaction through the price. Technical traders all read the same input, the past price movement, so the price itself couples them. The coupling then grows with the number of traders and needs no network of who talks to whom.
  4. Opinions converge after large moves. Traders copy the most profitable strategy. After a small price change, differences in their strategies (timing, risk tolerance, portfolio) dominate and they act independently. After a large one, such as a crash, they act in concert regardless of those differences, as in the spreading panic of a sell-off. This is the mechanism that distinguishes our model from others.

2 · Model

Three steps, and a large price move today merges traders into fewer groups tomorrow

The agent-based model has n0n_0 traders, each trading one unit. Every day it runs three steps.

Step 1 · Decide

Each trader ii decides ψi(t)=+1\psi_i(t)=+1 (buy) with probability pp, −1-1 (sell) with probability pp, and 00 (hold) with probability 1−2p1-2p.

Step 2 · Move the price
rt≡k dt=k∑i=1n0ψi(t) r_t \equiv k\,d_t = k\sum_{i=1}^{n_0}\psi_i(t)
(1)

The price change rtr_t (of the log price) is proportional to the demand imbalance dtd_t. The sensitivity kk does not change the statistics, so k=1k=1. The trading volume is the number of traders who trade, Nt=∑i∣ψi(t)∣N_t=\sum_i|\psi_i(t)|.

Step 3 · Converge
ct+1=(n0∣rt∣)ω c_{t+1} = \left(\frac{n_0}{|r_t|}\right)^{\omega}
(3)

The next day, traders are split at random into ct+1c_{t+1} opinion groups, and all members of a group take the same action, again buy, sell or hold with probabilities p,p,1−2pp, p, 1-2p. If everyone traded the same way today (∣rt∣=n0|r_t|=n_0), there is a single opinion tomorrow; after a minimal price move there are n0n_0 groups and everyone acts alone. With market noise from news, ct+1c_{t+1} is drawn from a normal distribution with mean n0/∣rt∣n_0/|r_t| and variance b n0/∣rt∣b\,n_0/|r_t|. We use ω=1\omega=1 in most simulations.

The trading probability pp is measured, not fitted. For the 309 companies that stayed in the S&P 500 throughout 1997–2006, a share changed hands V=1.64V=1.64 times a year on average (the trading velocity, between 1.3 and 1.9 over the decade). Taking institutional owners, who held 83 % of the shares, as fundamentalists who trade less than once a year (velocity Vf<1V_f<1), the technical traders’ velocity is Vc=(V−0.83 Vf)/(1−0.83)V_c=(V-0.83\,V_f)/(1-0.83), and with about 250 trading days a year, p=Vc/(250⋅2)p=V_c/(250\cdot 2). For Vf=0.2V_f=0.2 to 0.80.8 this gives p=0.0174p=0.0174 to 0.01150.0115; with Vf=0.4V_f=0.4, p=0.0154p=0.0154 and technical traders make about 80 % of the volume.

The behavioural model, live
n0=1024n_0=1024 traders, p=0.0154p=0.0154, noise b=1b=1, as in Fig. 1 of our paper

Scroll the panel sideways →

—

Top left: the daily price change rtr_t in units of its standard deviation σ\sigma (dashed lines at ±4σ\pm4\sigma). Bottom left: the number of opinion groups ctc_t, on a log scale from 1 to n0n_0; each large move collapses it. Right: the probability that ∣rt∣|r_t| exceeds xx standard deviations, against the Gaussian curve (dashed). The readout gives the tail exponent ξ\xi by the Hill estimator on the largest 1 % of days.

Switch to independent traders (every trader is their own group) and the tail collapses onto the Gaussian. Raise ω\omega and the tail thins; lower it and it fattens, as in Table 1 below. In our checks this browser version gives ξ≈3.8\xi\approx3.8 at ω=1\omega=1 after a few hundred thousand days.

3 · Fat tails

The model matches the S&P 500 in returns and in the number of trades, for any number of agents

We compared simulated returns with about 800,000 daily returns of the 309 S&P 500 stocks (open to close, so overnight news is excluded, each stock normalized to zero mean and unit variance). Both the distribution of absolute returns and the distribution of the daily number of trades agree with the data over the whole range, centre and tail. The Hill estimator gives tail exponents ξr=3.69±0.07\xi_r=3.69\pm0.07 (S&P 500) and 4.08±0.084.08\pm0.08 (simulation) for returns, and ξn=4.02±0.07\xi_n=4.02\pm0.07 and 4.02±0.084.02\pm0.08 for the number of trades. Capturing both of these highly correlated quantities at once makes the mechanism plausible.

Two log-log plots of cumulative distributions. Left: probability that the absolute daily return exceeds x, empirical S&P 500 in red and simulation in blue, overlapping with a power-law tail. Right: the same for the daily number of trades.
Fig. 1 of our paper. Cumulative distributions of (A) absolute daily returns and (B) daily number of trades, for 309 S&P 500 stocks, 1997–2006 (empirical) and the model with Vf=0.4V_f=0.4, n0=210n_0=2^{10}, b=1b=1. Tap to enlarge.

The exponent ω\omega in Eq. 3 sets how strongly a price move merges opinions, and ω=1\omega=1 is the value closest to the data:

ω\omega0.50.60.70.80.91.01.11.21.41.52.0
ξr\xi_r2.32.52.73.03.33.84.34.45.97.89.4
Table 1 of our paper: tail exponent of the absolute-return distribution for different ω\omega.

The tail exponent also does not depend on the number of agents or on the fundamentalists’ trading velocity: it stays between 3.66 and 3.89 for n0n_0 from 282^8 to 2142^{14} and VfV_f from 0.2 to 0.8 (Table 2 of the paper). Most agent-based models lose their fat tails as the population grows; here the interaction runs through the price, so its strength grows with the population by construction.

Fat tails need no tuning: they come from traders who act together after a large move.

4 · Stochastic model

Averaging over traders turns the behaviour into an equation for the volatility

Log-log plot of the percentage importance fund managers place on technical analysis against time horizon in days, falling along a straight line of slope minus 1.12.
Fig. 2. Importance placed on technical analysis by US fund managers (survey by Menkhoff) at horizons from days to a year: a power law with exponent −1.12.

Step 3 makes tomorrow’s price change random, with a variance set by today’s move. On average each of the ct=n0/∣rt−1∣c_t=n_0/|r_{t-1}| groups has ∣rt−1∣|r_{t-1}| members and moves the price by ±∣rt−1∣\pm|r_{t-1}| with probability pp each, so

σt2≡E ⁣(rt2∣rt−1)=2p n0 ∣rt−1∣. \sigma_t^2 \equiv E\!\left(r_t^2 \mid r_{t-1}\right) = 2p\,n_0\,|r_{t-1}| .
(8)

Writing rt=σtηtr_t=\sigma_t\eta_t with ηt\eta_t a random number of zero mean and unit variance (we use a normal distribution; a tt-distribution gives similar results) gives a time-dependent variance of the kind modelled by ARCH processes. Here it has a behavioural reading: a large price change brings traders’ opinions closer, and that produces large price changes afterwards.

Equation 8 remembers only yesterday. Two more pieces of evidence extend it. (v) Technical strategies are applied at different horizons, from one day to more than a year, and the survey of US fund managers in Fig. 2 shows that the share αi\alpha_i of traders with horizon ii days decays as αi∝i−d\alpha_i\propto i^{-d} with d≈1.12d\approx1.12. (vi) Traders trade more after large moves, because their strategies set price thresholds, so the trading probability rises with past price changes: pt+1≈p0+α′Σtp_{t+1}\approx p_0+\alpha'\Sigma_t, with p0p_0 the background activity, mostly of fundamentalists.

A trader with horizon ii reacts to the price change over the last ii days, ∣st−st−i∣|s_t-s_{t-i}|, where sts_t is the log price. Opinion convergence then depends on a weighted sum over horizons up to a maximum MM,

ct+1=n0∑i=1Mαi∣st−st−i∣,Σt≡∑i=1Mi−d ∣st−st−i∣, c_{t+1}=\frac{n_0}{\sum_{i=1}^{M}\alpha_i|s_t-s_{t-i}|},\qquad \Sigma_t\equiv\sum_{i=1}^{M} i^{-d}\,|s_t-s_{t-i}| ,
(9)

and with both extensions, keeping the dominant term, the volatility becomes

σt+1≈2αα′n0(Σt+p02α′)=A+B Σt. \sigma_{t+1}\approx\sqrt{2\alpha\alpha'n_0}\left(\Sigma_t+\frac{p_0}{2\alpha'}\right)=A+B\,\Sigma_t .
(11)

Here α=[∑i=1Mi−d]−1\alpha=\big[\sum_{i=1}^{M}i^{-d}\big]^{-1} normalizes the horizon weights. AA sets the typical size of returns and BB the share of trading triggered by technical thresholds relative to background trading. The form resembles fractionally integrated volatility models, with one difference: σt+1\sigma_{t+1} depends on absolute aggregate returns over past days, weeks and months rather than on past daily returns, and each term has a behavioural meaning.

5 · Long memory

One survey exponent fixes how slowly the market forgets its volatility

Scatter of the autocorrelation exponent of squared returns against that of absolute returns for 30 Dow Jones stocks; nearly all points fall between the lines gamma2 equals gamma1 and gamma2 equals 2 gamma1.
Fig. 3. Exponents of the autocorrelation of absolute returns (γ1\gamma_1) and squared returns (γ2\gamma_2) for the 30 Dow Jones stocks, daily closes 1971–2010, lags 11–250 days: the data fall in the band γ1≤γ2≤2γ1\gamma_1\le\gamma_2\le2\gamma_1 predicted by Eq. 12. Axes show −γ-\gamma.

Long memory shows up in the autocorrelation function (ACF) of absolute returns, ρℓ∝ℓ−γ1\rho_\ell\propto\ell^{-\gamma_1}, and of squared returns, ρℓ′∝ℓ−γ2\rho'_\ell\propto\ell^{-\gamma_2}, at lag ℓ\ell days. From Eq. 11 we derive scaling relations between these exponents and the survey exponent dd, much like the relations between critical exponents at a phase transition:

{γ1=2d−2,2d−2≤γ2≤4d−4,γ1≤γ2≤2γ1. \left\{\begin{aligned} &\gamma_1=2d-2,\\ &2d-2\le\gamma_2\le4d-4,\\ &\gamma_1\le\gamma_2\le2\gamma_1 . \end{aligned}\right.
(12)

Ding, Granger and Engle had observed that absolute returns stay correlated longer than squared returns. Eq. 12 makes this quantitative and ties it to the behaviour of traders through dd.

To simulate, every parameter comes from data: M=500M=500 trading days (about two years, the longest horizon in the survey), d=1.2d=1.2 in line with the survey, and A=0.002A=0.002, B=0.05B=0.05 from trading-volume fluctuations and the unconditional variance of price changes. So σt+1≈0.002+0.05∑i=1500i−1.2∣st−st−i∣\sigma_{t+1}\approx0.002+0.05\sum_{i=1}^{500}i^{-1.2}|s_t-s_{t-i}|. Simulation and the S&P 500 index (daily closes 1971–2010) give similar ACFs and return distributions (Fig. 4), with γ1=0.40\gamma_1=0.40, γ2=0.53\gamma_2=0.53 for the simulation and γ1=0.44\gamma_1=0.44, γ2=0.7\gamma_2=0.7 for the index. Eq. 11 is still a stationary process, unlike many other power-law memory processes.

Left: four autocorrelation plots against lag up to 600 days, for absolute and squared returns of the simulation and of the S&P 500, all decaying slowly. Right: cumulative distribution of normalized absolute returns, simulation and S&P 500 overlapping.
Fig. 4. (A) Autocorrelation of absolute and squared returns, simulation (50,000 days) vs. S&P 500 index (about 10,000 days, 1971–2010). (B) Cumulative distribution of absolute returns. Tap to enlarge.
The stochastic model (Eq. 11), live
A=0.002A=0.002, B=0.05B=0.05, M=500M=500, 50,000 simulated days

Scroll the panel sideways →

—

Left: absolute daily returns ∣rt∣|r_t| over the 50,000 days; calm and turbulent stretches alternate on all time scales. Right: the ACF of ∣rt∣|r_t| (pine) and rt2r_t^2 (plum) on log–log axes, with straight-line fits over lags 11–250 as in the paper, and the slope −(2d−2)-(2d-2) that Eq. 12 predicts (dashed). A single 50,000-day sample is noisy: at d=1.2d=1.2 the fitted γ1\gamma_1 scatters with a standard deviation of about 0.1 in our checks. Press new sample a few times; the readout keeps the mean over all samples at the current dd, which follows 2d−22d-2. At d=1.2d=1.2 most samples also satisfy γ1≤γ2≤2γ1\gamma_1\le\gamma_2\le2\gamma_1.

Long memory in volatility is the trace of traders who watch different horizons, mostly short ones.

6 · Summary

Behaviour in, stylized facts out, parameters measured

Agent-based model

Fat tails without tuning

Opinion convergence after large price moves gives power-law tails in returns and in the number of trades, ξ≈4\xi\approx4, unchanged from 256 to 16,384 agents.

Stochastic model

ARCH with a reason

The same mechanism, averaged, makes tomorrow’s variance grow with today’s move; heterogeneous horizons turn this into long memory, σt+1≈A+BΣt\sigma_{t+1}\approx A+B\Sigma_t.

Scaling relations

One exponent from a survey

γ1=2d−2\gamma_1=2d-2 and γ1≤γ2≤2γ1\gamma_1\le\gamma_2\le2\gamma_1, with dd from how fund managers weight their horizons; confirmed on the Dow Jones stocks.

The agent-based model singles out the dominant mechanism; the stochastic model allows a detailed analysis. Both share the same mechanism and both take their parameters from market data with a clear behavioural meaning. The study covers data before 2006, ignores high-frequency trading, and treats fundamentalists only as background noise.