Agent-Based Stock Market Model with Endogenous Agents' Impact
AAgent-Based Stock Market Model withEndogenous Agents’ Impact
Jan A. Lipski ∗ and Ryszard KutnerFaculty of Physics, University of Warsaw:Ho ˙za 69, PL-00681 Warsaw, PolandNovember 1, 2018 Abstract
The three-state agent-based 2D model of financial markets as proposed byGiulia Iori has been extended by introducing an increased trust in the correctlypredicting agents, a more realistic consultation procedure as well as a formal val-idation mechanism. This paper shows that such a model correctly reproduces thethree fundamental stylised facts: fat-tail log returns, power-law volatility autocor-relation decay over time and volatility clustering.
The non-Brownian dynamics of financial markets has been observed in their mod-ern study. Agent-based modelling is an attempt to mimic real markets, especially thefundamental stylised facts: fat-tail (non-Gaussian) log returns distribution, power-law absolute log returns (volatility) autocorrelation decay in time and time clusteringof high log returns and volatility. In such models individual investors make up thefinancial market and determine the price of the stock they trade.This paper extends our agent-based model [2], which is based on an establishedmodel by Giulia Iori [1]. Our initial improvement was to introduce endogenous herd-ing behaviour by increasing the esteem of the correctly predicting agents and mod-elling other agents as their followers. The next improvement is to introduce a morerealistic consultation procedure and to propose a formal validation mechanism for thefundamental stylised fact studied, that is, for the fat-tail distribution of log returns. ∗ corresponding author: [email protected] a r X i v : . [ q -f i n . T R ] D ec Highlights of the Iori model
The version of the three-state Ising model (also known as the Potts model) of finan-cial markets, proposed by Iori [1], gave results reproducing the fundamental stylisedfacts: volatility clustering, fat-tail log-return distribution, and power-law decay intime of the volatility autocorrelation function.The system consists of n agents placed in the nodes of of a 2D square lattice whodetermine the stock price P ( t ) at time t . Every agent i =
1, . . . , n can take one of threespin states representing three types of behaviours: + − Y i , being the sum of the forces exertedby its nearest neighbours J ij ( t ) and by a random noise η i ( t ) : Y i ( t ) = ∑ j = J ij ( t ) + η i ( t ) . (1)The temporal spin of the i th agent, σ i is governed by the rule: σ i ( t + ) = Y i ( t ) ≥ ξ i ( t ) ,0 if − ξ i ( t ) < Y i ( t ) < ξ i ( t ) − Y i ( t ) ≤ − ξ i ( t ) , , (2)where ξ i is the individual threshold, which is initially drawn from a standard normaldistribution and later thus adjusted: ξ i ( t ) = ξ i ( t − ) P ( t − ) P ( t − ) , t ≥
2. (3)In the Iori model, the price P ( t ) is determined as a function of supply S ( t ) (numberof negative spins) and demand D ( t ) (number of positive spins) as follows: P ( t ) = P ( t − ) (cid:18) D ( t − ) S ( t − ) (cid:19) κ ( t − ) , (4)where κ ( t − ) = α D ( t − ) + S ( t − ) n . (5)It is worth noting that this definition is Iori’s unique contribution, however theequation for price always mirrors the fundamental economic law of supply and de-mand as shown in [5], [3] (and refs. therein).The stylised facts reproduced by our simulations refer to a log return r definedover a time period t − t (cid:48) as a natural logarithm of the ratio of the corresponding2rices P ( t ) and P ( t − t (cid:48) ) : r ( t − t (cid:48) ) = ln (cid:18) P ( t ) P ( t − t (cid:48) ) (cid:19) , t (cid:48) ≤ t . (6)In this paper we further exploit the term volatility defined as the absolute value ofthe log return defined in the above Eq. (6). Our initial improvements, discussed in detail in [2], introduce a common senserelationship between the agents’ decisions and their influence on their nearest neigh-bours as well as the presence of fundamental behaviour from time to time.The influence of an agent should be great if the agent foresees the price movementcorrectly, and should be small in the opposite case. That is, the influence increases ifthe product of an individual agent’s spin value at a certain time in the past and thelog return over that time is positive and decreases if that product is negative. Thus,the J ij force exerted by agent j on agent i (as in Eq. (1)) is defined as: J ij ( t ) = W ij + t − ∑ τ (cid:48) = t − τ σ j ( τ (cid:48) ) ln (cid:18) P ( t − ) P ( τ (cid:48) ) (cid:19) , τ ≥
2. (7)The coefficient J ij ( t = ) is an initial value allotted at the beginning of the simula-tion: either 1 with a fixed probability p , or 0 with a probability of 1 − p (as in Iori’smodel) and W ij is the background static impact of agent j on agent i , randomly drawnfrom a uniform unit distribution. The sum over τ (cid:48) represents the altering componentof the impact with the agents’ memory being τ steps long. To avoid a persistent positive feedback effect resulting in constantly directed pricechanges, the fundamental agents’ behaviour is introduced. The fundamental be-haviour is constrained by positive factors a > b >
1. If the market price isgreater than the fundamental price by multiplier a , the agent sells shares. In the op-posite case, if the market price is lower than the fundamental price by factor b , theagent buys shares. An individual agent behaves this way with a globally-definedprobability P f und . We assume that each agent knows the share fundamental price.A detailed description of the algorithm which the simulation is based upon isdescribed in our previous paper [2]. 3 Further improvements
The first improvement was a more realistic model of the consultation round. Thatis, the Iori model [1] assumed that the agents can start trading only when stabilisationof their opinions occurs. However, in this paper we assumed that the agents tradedirectly after consulting their colleagues (the nearest neighbours). That is, they havetime to consult only a few times (namely, make only a few phone calls) before trading.We assumed that no opinion stabilisation, formally referred to as system relaxation orthermalisation, needs to be achieved, as indeed no real stock market stops if investorsare inactive.For instance, we have proposed only four consultation rounds in which the agentscan change their opinions. This improvement has led to more stable reconstruction offat-tail log returns and time decay of absolute log returns autocorrelation.
A key problem in agent-based models is the models’ validation and parameterestimation. In this section we present the tools for validation and estimation and inSection 5.1 we present our results.As revised by Helbing [4], a common approach is to check the stability of recon-struction of the fundamental stylised facts either by eye judgement or by using aformal statistical test. In this paper we propose to validate the log returns histogram,which, as commonly observed in stock markets, should exhibit a strong non-Gaussianbehaviour.In this paper we use the Kolmogorov - Smirnov (K-S) test [6], which is a fur-ther improvement of our initial model [2]. The K-S test is based upon computingthe maximum distance between two (empirical or theoretical) cumulative distributionfunctions. In our case, the test compares two empirical CDFs of log returns. One ofthe CDFs describes the simulation results while the other one describes the historicallog returns for Standard and Poor’s 500 index in the period from January 2nd 1980 toMay 10th 2013.From the total number of 23 parameters, only two, the most significant, parametershave been chosen. The altering parameters were the probability P f und of the agentstrading according to the stock fundamental value (cf. Section 3.2) and the range ofthe system’s memory τ (cf. Eq. (7)). 4 Simulation results
The result of the reconstruction of fat-tail log returns distribution is quite stable.In fact, the results of the K-S test for the altering parameters P f und (first column) and τ (second column) agree with the empirical data to a large extent, as shown in Tab. 1. P f und τ p-value60 20 0.99888160 24 0.99997260 32 0.98681870 20 0.99916370 24 0.99967570 28 0.99930870 32 0.99966580 20 0.99987780 24 0.99974180 36 0.99986580 40 0.99974990 20 0.99985990 24 0.99963990 40 0.988326Table 1: P-values of the K-S test comparing the log returns c.d.f. of simulation resultsto the historical data for the simulations with different parameter values P f und and τ .As shown in Tab. 1, the agreement with empirical data is stable for differentparameter values. The standard deviation of those p-values is small and equals 0.0044.A typical plot, for parameters P f und =
90 and τ =
24, is shown in Fig. 1. As shownin Fig. 1, the distribution of the historical data and simulation results exhibit a non-Gaussian behaviour. 5igure 1: Histograms of daily log returns obtained from historical data and fromsimulation for parameters P f und = τ = The (normalised) autocorrelation function (averaged over time t ) as a function oftime lag τ is defined as follows: C ( τ ) = (cid:104) r ( t ) r ( t − τ ) (cid:105) − (cid:104) r (cid:105) Var ( r ) , (8)where t is the decision round number, τ is the decision round time lag, (cid:104) ... (cid:105) is the timeaverage (cf. Eq. (6)), and Var ( r ) is the variance of the log return.The autocorrelation function of absolute daily log-returns reveals long-term power-law relaxation versus time: R ( τ ) ∝ τ − γ , γ >
0, (9)where R is the relaxation function of time lag τ and γ is a positive exponent. Thismodel gives astonishingly correct predictions for the values of γ for the first 500 timelag days (see Fig. 2 for details). For the S&P500 index γ ( SP ) = γ ( simul . ) = P f und = τ =
24, comparedwith power law distribution (solid line).confirmation of the validity of our model.
As shown below (see plots in Fig. 3) , we reproduced the temporal clustering ofhigh and low log returns and high and low volatility quite well. Apparently, the logreturns clustering obtained in the variogram of the simulation is not as pronouncedas for empirical data. However, the regions of high and low absolute log returns (thatis, high and low volatility) are clearly visible.7igure 3: Comparison of volatility clustering for historical data and results of thesimulation with parameters P f und = τ = In this paper we have proposed a sufficiently realistic and tractable agent-basedmodel of financial markets. In our earlier paper [2], we extended the basic algorithmof the Iori model by introducing an increasing trust in agents who predict marketmovements correctly, and a decreasing trust in agents who fail to do so. However,in this paper we have proposed a more realistic scheme of consultation rounds be-tween agents. The model has been extended to short and non-thermalising (non-equilibrium) consultation rounds. This has increased the validity of our highly non-Gaussian log return distributions.We have also introduced a formal way of validating the model with the Kolmogorov-Smirnov test for different sets of parameters. It has also reproduced two other fun-damental stylised facts: volatility and log returns clustering as well as the power-lawdecay of volatility autocorrelation.Apparently, we have achieved a stable reconstruction of the fundamental stylisedfacts corroborated with formal tests. Moreover, it is tractable and easy to alter model,which makes promising and capable predictions of real market price changes afterfurther improvements. 8 eferences [1] G. Iori:
A microsimulation of traders in the stock market: the role of heterogeneity,agents’ interactions and trade frictions. , J. Econom. Behav. Organiz. 49 (2), 269 (2002).[2] J. A. Lipski, R. Kutner:
Trust in Foreseeing Neighbours - a Novel Threshold Model ofFinancial Market , Acta Phys. Pol. A 123 (3), pp. 584-588 (2013).[3] M. Denys, T. Gubiec, R. Kutner:
Reinterpretation of Sieczka - Hołyst Financial MarketModel , Acta Phys. Pol. A 123 (3), pp. 513-517 (2013).[4] D. Helbing,
Social Self-Organization, Understanding Complex Systems , Springer-Verlag Berlin Heidelberg, pp. 25-70 (2012).[5] M. Cristelli, L. Pietronero, A. Zaccaria:
Critical Overview of Agent-Based Models forEconomics , Proc. School of Physics "E. Fermi", course CLXXVI (2010).[6] I. M. Chakravarti, R. G. Laha, J. Roy:
Handbook of Methods of Applied Statistics , Vol.I, John Wiley and Sons, pp. 392-394 (1967).[7] Kolmogorov-Smirnov test algorithms in the Root CERN library, http://root.cern.ch/root/html/TMath.html .[8] Market data downloaded from