Abstract
The use of agent-based models (ABMs) has increased in the last years to simulate social systems and, in particular, financial markets. ABMs of financial markets are usually validated by checking the ability of the model to reproduce a set of empirical stylised facts. However, other common-sense evidence is available which is often not taken into account, ending with models which are valid but not sensible. In this paper we present an ABM of a stock market which incorporates this type of common-sense evidence and implements realistic trading strategies based on practitioners literature. We next validate the model using a comprehensive approach consisting of four steps: assessment of face validity, sensitivity analysis, calibration and validation of model outputs.
Similar content being viewed by others
Notes
Code is available at https://libraries.io/github/gitwitcho/var-agent-model. Our code is implemented in Java and uses the scheduler from Repast simphony (https://repast.github.io/repast_simphony.html).
As the fundamentalist and technical agents use quite different indicators for their positions—one based on the difference between price and fundamental value, and the other one based on the difference of slope between moving averages—the model runs the risk of having one group of traders moving far major volumes and biasing the market dynamics. To give fundamentalist and technical agents the a priori opportunity to impact prices in a balanced way, we have added this normalisation factor. To calculate it, we have repeatedly run the model and calculated the ratio of average maximum fundamentalist and technical positions obtained after each run. The normalisation factor has been selected as the value for which the ratio of maximum fundamentalist/technical positions lies around 1, as this indicates that fundamentalist and technical positions take similar values and so both groups of traders have a priori a similar impact in price formation.
The average price in Fig. 21a seems to oscillate, but this is only due to the averaging. In the price series obtained from individual runs, there are jumps in the price process that look like oscillations in the average price series.
When the decay of the autocorrelation function of a process follows a power law with exponent β < 1, the process is said to have long-term memory (Bouchaud et al. 2009), implying that events that occurred long ago still have an impact on the current values (Thompson 2011). The Hurst exponent can be used to find out if a process has long-term memory, and is calculated as \(H = 1 - \frac{\beta }{2}\) (Rickles 2011). A process with long-term memory is characterised by having a Hurst exponent \(H \in \left( {0.5,\,1} \right)\) (empirical studies have found values \(H \in \left( {0.7,\,0.9} \right)\) for equity markets (Oh et al. 2006; Yang et al. 2013)). The exponent of a process with short-term memory (such as the series of returns) is \(H = 0.5,\) and its autocorrelation function decays faster (Bouchaud et al. 2009).
The Hurst exponent reported here has been calculated with the ‘hurstSpec’ function of the ‘fractal’ package of R. There are several functions available in R to calculate the Hurst exponent, and ‘hurstSpec’ has been reported to be the most accurate one (Stroe-Kunold et al. 2009).
References
Alfarano S, Lux T, Wagner F (2005) Estimation of agent-based models: the case of an asymmetric herding model. Comput Econ 26:19–49
Arthur W, Holland J, LeBaron B, Palmer R, Tayler P (1996) Asset pricing under endogenous expectations in an artificial stock market. SFI working paper
Balci O (1995) Principles and techniques of simulation validation, verification, and testing. In: Proceedings of the 1995 winter simulation conference, pp 147–154
Barreteau O, Bousquet F, Étienne M, Souchère V, d’Aquino P (2014) Companion modelling: a method of adaptive and participatory research. In: Étienne M (ed) Companion modelling. Éditions Quae, Versailles, pp 13–40
Bianchi C, Cirillo P, Gallegati M, Vagliasindi P (2007) Validating and calibrating agent-based models: a case study. Comput Econ 30:245–264
Bonenkamp U (2010) Combining technical and fundamental trading strategies. Gabler, Heidelberg
Bouchaud P, Farmer J, Lillo F (2009) How markets slowly digest changes in supply and demand. In: Hens T, Schenk-Hoppé K (eds) Handbook of financial markets: dynamics and evolution. North Holland/Elsevier, Amsterdam, pp 57–160
Carley K (1996) Validating computational models. Working paper: social and decision sciences, Carnegie Mellon University, Pittsburgh
Chakraborti A, Toke I, Patriarca M, Abergel F (2011) Econophysics review: I. empirical facts. Quant Financ 11(7):991–1012
Clegg R (2006) A practical guide to measuring the Hurst parameter. In: 21st UK performance engineering workshop, school of computing science technical report series, CSTR-916, Newcastle, pp 43–55
Cont R (2001) Empirical properties of asset returns: stylized facts and statistical issues. Quant Financ 1:223–236
Covrig V, Ng L (2004) Volume autocorrelation, information, and investor trading. J Bank Financ 28:2155–2174
Cristelli M (2014) Complexity in financial markets. Springer, New York
Ding Z, Granger C, Engle R (1993) A long memory property of stock market returns and a new model. J Empir Financ 1:83–106
Dosi G, Fagiolo G, Roventini A (2006) An evolutionary model of endogenous business cycles. Comput Econ 27:3–34
Dudukovic S (2013) Capturing stylized facts of stock market volatility and higher order cumulant function. In: Cambridge business & economics conference (CBEC), Cambridge
Edmonds B, Moss S (2005) From KISS to KIDS—an ‘anti-simplistic’ modelling approach. In: Davidsson P, Logan B, Takadama K (eds) Multi-agent and multi-agent-based simulation, vol 34. Springer, Heidelberg, pp 130–144
Fabretti A (2013) On the problem of calibrating an agent based model for financial markets. J Econ Interact Coord 8:277–293
Fagiolo G, Windrum P, Moneta A (2006) Empirical validation of agent-based models: a critical survey. LEM working paper2006/14, Pisa
Fagiolo G, Moneta A, Windrum P (2007) A critical guide to empirical validation of agent-based models in economics: methodologies, procedures, and open problems. Comput Econ 30:195–226
Farmer J, Joshi S (2002) The price dynamics of common trading strategies. J Econ Behav Organ 49:149–171
Feng L, Li B, Podobnik B, Preis T, Stanley E (2012) Linking agent-based models and stochastic models of financial markets. Proc Natl Acad Sci USA 109(22):8388–8393
Frenken K (2005) History, state and prospects of evolutionary models of technical change: a review with special emphasis on complexity theory. Utrecht University
Giardina I, Bouchaud J (2003) Volatility clustering in agent based market model. In: Gallegati M, Kirman A, Marsili M (eds) The complex dynamics of economic interaction. Springer, Berlin, pp 171–196
Gilbert N (2004) Open problems in using agent-based models in industrial and labor dynamics. In: Leombruni R, Richiardi M (eds) Industry and labor dynamics: the agent-based computational approach. World Scientific, Singapore, pp 401–405
Gilli M, Winker P (2003) A global optimization heuristic for estimating agent based models. Comput Stat Data Anal 42:299–312
Hales D, Rouchier J, Edmonds B (2003) Model-to-model analysis. J Artif Soc Soc Simul 6(4):5
Hommes C (2006) Heterogeneous agent models in economics and finance. In: Tesfatsion K, Judd K (eds) Handbook of computational economics, vol 2. North Holland/Elsevier, Amsterdam, pp 1109–1186
Janssen M, Ostrom E (2006) Empirically based, agent-based models. Ecol Soc 11(2):37
Johnson N, Jefferies P, Ming Hui P (2003) Financial market complexity. Oxford University Press, New York
Kahneman D, Tversky A (1979) Prospect theory: an analysis of decisions under risk. Econometrica 47:313–327
Kestner L (2003) Quantitative trading strategies. McGraw-Hill, New York
Klügl F (2008) A validation methodology for agent-based simulations. In: SAC’08, Fortaleza
LeBaron B (2006) Agent-based computational finance. In: Tesfatsion L, Judd K (eds) Handbook of computational economics, vol 2. North Holland/Elsevier, Amsterdam, pp 1188–1233
LeBaron B, Yamamoto R (2007) Long-memory in an order-driven market. Physica A 383:85–89
LeBaron B, Arthur W, Palmer R (1999) Time series properties of an artificial stock market. J Econ Dynam Control 23:1487–1516
LiCalzi M, Pellizzari P (2006) Breeds of risk-adjusted fundamentalist strategies in an order-driven market. Physica A 359:619–633
Lux T, Marchesi M (1999) Scaling and criticality in a stochastic multi-agent model of a financial market. Nature 397:498–500
Lux T, Marchesi M (2000) Volatility clustering in financial markets: a microsimulation of interacting agents. Int J Theor Appl Financ 3(4):675–702
Madhavan A (2000) Market microstructure: a survey. Marshall School of Business, Los Angeles
Malerba F, Nelson R, Orsenigo L, Winter S (1999) ‘History-friendly’ models of industry evolution: the computer industry. Ind Corp Change 8(1):3–40
Malkiel B (1973) A random walk down Wall Street. Norton, New York
Martínez-Jaramillo S, Tsang E (2009) Evolutionary computation and artificial financial markets. In: Brabazon A, O’Neill M (eds) Natural computing in computational finance, vol 2. Springer, Berlin, pp 137–179
Menkhoff L (2010) The use of technical analysis by fund managers: international evidence. J Bank Finance 34:2573–2586
Milton A (2016) Day trading with Donchian channels. From the balance: https://www.thebalance.com/day-trading-with-donchian-channels-1031186. Retrieved 20 Feb 2017
Moss S (2008) Alternative approaches to the empirical validation of agent-based models. J Artif Soc Soc Simul 11(1):5
Moss S, Edmonds B (2005) Sociology and simulation: statistical and qualitative cross-validation. Am J Sociol 110(4):1095–1131
Murphy J (1999) Technical analysis of the financial markets. New York Institute of Finance, Paramus
Ngo T, See L (2012) Calibration and validation of agent-based models of land cover change. In: Heppenstall A, Crooks A, See L, Batty M (eds) Agent-based models of geographical systems. Springer, Dordrecht, pp 181–197
North M, Macal C (2007) Managing business complexity—discovering strategic solutions with agent-based modeling and simulation. Oxford University Press, New York
Oh G, Kim S, Eom C (2006) Long-term memory and volatility clustering in daily and high-frequency price changes. http://www.long-memory.com/returns/OhUmKim2006.pdf. Arxiv preprint physics/0601174
O’Neill B (2011) Fundamentals of the stock market. McGraw-Hill, New York
Pascual J, Pajares J, López-Paredes A (2006) Explaining the statistical features of the Spanish stock market from the bottom-up. In: Bruun C (ed) Advances in artificial economics: the economy as a complex dynamic system. Springer, Berlin, pp 283–294
Raberto M, Cincotti S, Focardi S, Marchesi M (2003) Traders’ long-run wealth in an artificial financial market. Comput Econ 22:255–272
Rickles D (2011) Econophysics and the complexity of financial markets. In: Hooker C (ed) Philosophy of complex systems. North Holland/Elsevier, Oxford, pp 531–566
Rossi E, Santucci de Magistris P (2013) Long memory and tail dependence in trading volume and volatility. J Empir Financ 22:94–112
Sargent R (1998) Verification and validation of simulation models. In: Proceedings of the 1998 Winter Simulation Conference, pp. 121–130
Shimokawa T, Suzuki K, Misawa T (2007) An agent-based approach to financial stylized facts. Physica A 379:207–225
Sinclair E (2013) Volatility trading, 2nd edn. Wiley, Hoboken
Slanina F (2014) Essentials of econophysics modelling. Oxford University Press, Oxford
Stroe-Kunold E, Stadnytska T, Werner J, Braun S (2009) Estimating long-range dependence in time series: an evaluation of estimators implemented in R. Behav Res Methods 41(3):909–923
Taylor S (2005) Asset price dynamics, volatility, and prediction. Princeton University Press, Princeton
ten Broeke G, van Voorn G, Ligtenberg A (2016) Which sensitivity analysis method should i use for my agent-based model? J Artif Soc Soc Simul 19(1):5
Thompson S (2011) The stylised facts of stock price movements. N Z Rev Econ Financ 1:50–77
Tsay R (2005) Analysis of financial time series, 2nd edn. Wiley, Hoboken
Wei J, Huang J, Hui P (2013) An agent-based model of stock markets incorporating momentum investors. Physica A 392:2728–2735
Werker C, Brenner T (2004) Empirical calibration of simulation models. Max Planck Institute, Papers of economics and evolution #0410
Westerhoff F (2010) A simple agent-based financial market model: direct interactions and comparisons of trading profits. In: Bischi G, Chiarella C, Gardini L (eds) Nonlinear dynamics in economics, finance and the social sciences. Springer, Berlin, pp 313–332
Windrum P, Fagiolo G, Moneta A (2007) Empirical validation of agent-based models: alternatives and prospects. J Artif Soc Soc Simul 10(2):8
Yang C, Wang R, Hu S (2013) Modeling and analysis of an agent-based model for Chinese stock market. Phys Lett A 377:2041–2046
Zeigler B (1985) Theory of modelling and simulation. Krieger, Malabar
Acknowledgements
We would like to thank the anonymous reviewers for their insightful and constructive comments.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Llacay, B., Peffer, G. Using realistic trading strategies in an agent-based stock market model. Comput Math Organ Theory 24, 308–350 (2018). https://doi.org/10.1007/s10588-017-9258-0
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10588-017-9258-0