Next Article in Journal
A Game Theoretic Model of Choosing a Valuable Good via a Short List Heuristic
Next Article in Special Issue
On the Use of Probabilistic Worst-Case Execution Time Estimation for Parallel Applications in High Performance Systems
Previous Article in Journal
A New Approach in the Study of Oscillation Criteria of Even-Order Neutral Differential Equations
Previous Article in Special Issue
Truth-Teller–Liar Puzzles with Self-Reference
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Detecting the Proportion of Traders in the Stock Market: An Agent-Based Approach

1
John von Neumann Institute, Vietnam National University Ho Chi Minh City, Ho Chi Minh City 70000, Vietnam
2
CHArt Laboratory EA 4004, EPHE, PSL Research University, 75014 Paris, France
3
CEO at QT-Data Inc., Saskatoon, SK S7K 2P7, Canada
4
Financial Engineering Department, ECE Paris Graduate School of Engineering, Paris 75015, France
*
Author to whom correspondence should be addressed.
Mathematics 2020, 8(2), 198; https://doi.org/10.3390/math8020198
Submission received: 31 December 2019 / Revised: 27 January 2020 / Accepted: 29 January 2020 / Published: 5 February 2020
(This article belongs to the Special Issue Supercomputing and Mathematics)

Abstract

:
In this research, an agent-based model (ABM) of the stock market is constructed to detect the proportion of different types of traders. We model a simple stock market which has three different types of traders: noise traders, fundamental traders, and technical traders, trading a single asset. Bayesian optimization is used to tune the hyperparameters of the strategies of traders as well as of the stock market. The experimental results on Bayesian calibration with the Kolmogorov–Smirnov (KS) test demonstrated that the proposed separate calibrations reduced simulation error, with plausible estimated parameters. With empirical data of the Dow Jones Industrial Average (DJIA) index, we found that fundamental traders account for 9%–11% of all traders in the stock market. The statistical analysis of simulated data can produce the important stylized facts in real stock markets, such as the leptokurtosis, the heavy tail of the returns, and volatility clustering.

1. Introduction

The study of a complex system has always been of great interest because of thier rich properties and behavior, for example, the solar system [1] or biological systems [2]. By analyzing such natural systems, people discovered fundamental laws that help them to build other systems, such as computer networks [3] or power-grid systems [4]. A financial market can also be considered as a complex system. For tens of years, researchers have been faced with the problem of the analysis and modeling of financial markets [5,6,7]. One of the most important questions is “How can we develop an artificial stock trading system and describe investors’ behaviors in a way that is similar to reality?”. Previous models are based only on a single fully rational representative agent and fail to reproduce all the properties of real markets [8,9]. To overcome these problems, a new behavioral approach emerged, referred to as agent-based modeling, characterized by markets populated with bounded rational, heterogeneous agents [10].
An agent-based model (ABM) in the financial market is a class of quantitative models to simulate the decisions and interactions of different traders in order to understand their behaviors and their impact on the market [11]. In recent years, ABM in financial markets is still a prominent topic of interest for researchers [6,12]. The behavior of the agents is described in a variety of ways; their interaction and the impact of exogenous factors in the market are also introduced [13]. Thereby, studies help managers to understand the behavioral characteristics of investors and explain the phenomena occurring in the stock market [13,14].
One of the problems of agent-based modeling is how to tune hyperparameters for the traders’ strategies and the market. Many models use large parameter sets and run simulations for long periods of time [15,16]. However, even for small models, exploring the stylized facts through all parameter combinations is not possible or is prohibitively costly [12]. For example, in [15], the authors generated 400,000 initial points to calibrate their model. To solve the above problems, this model introduces an approach with Bayesian optimization and an error measurement function to tune the hyperparameters of the environment.
In this work, we combine the main properties of the pioneer works. An agent-based model is introduced to highlight the stylized facts of the stock market. This research offers a novel perspective on how to detect the proportion of each trader in the stock market. The results can be used in selecting effective trading strategies for traders. The model consists of three types of traders: noise traders, technical traders, and fundamental traders, with various behaviors to increase diversity. A noise trader makes decisions based on price changes. They have different emotions and news reactions which play important roles in making decisions. Technical traders are diversified by trading indicators; they make different decisions based on target return and time. Fundamental traders are introduced to balance the market; they are diversified by their confidence level, which measures the convergence of the stock price to its fundamental value. The interaction is a function that combines the sentiment change when getting information from the market and the influence of other investors’ decisions.
The highlight of our model is that Bayesian optimization is introduced to tune the hyperparameters of trading strategies and the environment. The results show that Bayesian optimization can propose an optimal set of parameters and reduce simulation error. This provides stylized facts to compare with the real market, providing a bench-marking method for calibrating parameters of agent-based stock market. We used different methods of comparing the two distributions—Kullback–Leibler (KL) divergence and the Kolmogorov–Smirnov (KS) test—to measure the simulation error. In our model, the KS test showed better results by successfully explaining some important stylized facts in real stock markets, such as the leptokurtosis, the heavy tail of the returns, and the volatility clustering. With extensive simulations, we found that the fundamental traders accounted for 9%–11% of all traders in the stock market. These results are consistent with the real-market research [17].
The remainder of this paper is organized as follows. The literature on ABM of stock markets is introduced in Section 2. Section 3 outlines the construction of the model. Section 4 presents the description of the data and the calibration of model. Statistical analysis of the model’s results and the stylized facts are given in Section 5. Finally, Section 6 concludes and proposes some extensions of our work.

2. Background

In the financial market, there are many types of agents (investors, banks, central banks, etc.). These agents can interact directly through trading, exchanging derivatives. They can also interact indirectly, because any decision or behavior of an agent affects others [18]. Moreover, the agents have different sensitivities to exogenous factors in the market and thus different news can influence and impact them [19]. Therefore, financial market modeling needs to understand the characteristics of agents such as behavior and interaction between investors and the impact of exogenous factors such as public news on the market [13,20]. The studies in this paper will focus on clarifying these properties.
The first approach addresses the types of agents and how they impact the dynamics of the market. Pioneering works have proposed a number of interesting agent-based financial market models. The concept of zero-intelligence traders or noise traders who decide randomly whether to buy or sell was introduced in a double auction market [21]. The studies of market participants using technical and fundamental analysis to assess financial markets creates a strong empirical foundation for building financial market models [22]. Technical traders are considered to be a factor of instability because their trading often adds a positive response to the dynamics of the market [23]. In contrast, fundamental analysis based on its definition provides a stabilizing impact on market dynamics [24].
The second approach that should be considered is the diversity of agents. To make every fundamental agent and technical agent unique, they are assigned with different memory lengths or reaction intensities to price and fundamental changes [13]. Exogenous factors such as news, social media, and insider information [25] also have different impacts on each agent. In addition, the sentiments of agents such as risk aversion play an important role in the decision-making process [14,26].
The third approach is the interaction between agents. Besides the interactions that directly affect market prices, investors’ decisions also have an indirect effect on each other. In [27,28], the authors introduced the propagation in the decision of investors with a fixed probability. In another study [13], the interactions and diversity among fundamental traders and technical traders were introduced. The average utility associated with each type was calculated and agents could rely on profit to come up with an effective investment strategy.
Each of these approaches has been extended in various interesting directions. From that, the stylized facts of financial markets are highlighted, such as heavy tails in stock return distribution and volatility clustering [10,28]. Another proposed stylized fact is the positive autocorrelation in volatility and trading volume [13,29].
One important issue is how to tune hyperparameters for traders’ strategies and the market. Grid search is a method to list all combinations of hyperparameters, then perform a model test with this list [30]. Random search only randomly selects a finite number of hyperparameters from the list to conduct a model test [31]. Theoretically, grid search can find the global value, but as the number of parameters increases, this becomes increasingly impossible due to the time and cost of implementation. Random search does not run as many cases as grid search, so it is significantly faster [31]. However, depending on its randomness, each run will receive a different optimal value because it does not guarantee the optimum value to be global or local only. Bayesian optimization is an adaptive approach to parameter optimization, trading off between exploring new areas of the parameter space and exploiting historical information to find the parameters that maximize the function quickly [30]. Thus, Bayesian optimization is introduced to tune hyperparameters for the trading strategies of technical traders and the environment of our model.

3. The Model

This section outlines the construction of a new agent-based model. This model adds the understanding of the reason for the stylized facts and the estimated proportion of traders in the stock market.

3.1. Environment

The agent-based model in this paper focuses on analyzing the behavior of traders and the log return properties which are reflected in the simulation process. The model considers a fixed amount of agents, denoted as N, trading a single asset. The current time is denoted with t and the corresponding price is S ( t ) . At each time step t, trader i can choose between three actions: buy/sell one unit of the stock or hold, s i ( t ) { + 1 , 1 , 0 } , respectively. For liquidity purposes, the model assumes that every trader always has enough wealth and shares—in other words, they are always able to buy or sell. The market price and market return are then calculated. The market price S ( t ) is updated according to
S ( t ) = S ( t 1 ) [ 1 + r ( t ) ] ,
and return r ( t ) is determined according to
r ( t ) = g D ( t ) N ,
where the excess demand D ( t ) = i = 1 N s i ( t ) , the price impact function g ( z ) = a r c t a n ( z / λ ) , and λ measures the market depth or liquidity.
Due to the tendency to form discrete clusters of traders [32], we define different types of traders in this model based on their predefined trading rules. There are three different types of traders operating in the market. Noise traders are people who make decisions at random according to their news reactions and their propensity to sentiment contagion. Technical traders analyze charts and make decisions based on current patterns and trends analysis, and fundamental traders trade based on the fundamental profit-generating potential of the stock.

3.2. Noise Agent

Noise agents are traders who trade on the basis of misunderstanding information and news regarding future prices. They make decisions and trade based on inaccurate analysis of the market [33]. In this model, noise agents rely only on the current market situation to make trading decisions: buy, sell, or hold [13]. As the key variable, the sentiment of the noise agents implies their reaction to the news they get [20]. Good sentiment means that agents see the news as good news and hope future prices will increase (bullish) and bad sentiment means that the agents consider the news to be bad and hope prices in the future will decrease (bearish).
The decision of noise agents is determined by the following process. At each time step t:
  • Agents receive public information as a signal I ( t ) .
  • Each agent i compares the signal to his threshold θ i ( t ) to make a decision.
  • After calculating the market return, he updates his threshold with a probability p i .
The inflow of news arrives to the market as a signal I ( t ) with I ( t ) N ( 0 , σ I 2 ) . Each agent will decide whether the news is significant or not, in which case he will make a decision according to the sign of I ( t ) . To describe the heterogeneity, we introduce the sentiment of each agent to the news as a decision threshold θ i ( t ) with the initial trading threshold set between 1 and 2 times the standard deviation of the news, θ i ( 0 ) = σ I [ 1 + U ( 0 , 1 ) ] .
Let N n o i s e denote the number of noise agents. The trading rule of each noise agent i , i N n o i s e , is represented by
s i n o i s e ( t ) = 𝟙 I ( t ) > θ i ( t ) 𝟙 I ( t ) < θ i ( t ) .
Market-related sentiments are formed differently for each agent and each responds differently to the information. To avoid the artificial ordering of agents as in sequential choice models, we follow [20] to generate an asynchronous strategy to update the agents’ threshold. At each time step, each agent i will update his threshold θ i ( t ) with probability 0 p i 1 . The threshold is set equal to the absolute return at time t, | r ( t ) | = | l n S ( t ) S ( t 1 ) | . Introducing independent and identically distributed random variables u i ( t ) , i N n o i s e , uniformly distributed on [0, 1], the updating scheme is represented as
θ i ( t ) = | r ( t ) | , if u i ( t ) < p i ; θ i ( t 1 ) , otherwise .
In the next addition to the model, technical agents and fundamental agents are introduced.

3.3. Technical Agent

Unlike the noise agents, technical agents are traders who use the past prices to infer private information. They make decisions by calculating the technical indicators from historical prices [34]. The characteristic of technical analysis is to make decisions after identifying the trends at an early stage and reverse the decision when the trend reversal occurs [35]. In this model, the agents are assumed to use a technique in the real world called a moving average-oscillator (MAO) to predict future price moves [36]. The technique first involves taking two moving averages of the price, a short-term moving average A and a long-term moving average B, of different lengths l A < l B . The moving average crossover is calculated as the difference M ( t ) between these two moving averages. M ( t ) > 0 indicates that the price is trending upwards and the agents will make a buy. M ( t ) < 0 indicates that price is trending down and the agents will sell the stock.
In order to account for individual heterogeneity, each agent can use different lengths of historical data, so one moving average strategy may indicate an uptrend while another moving average strategy indicates a downtrend. However, in our model, the difference in window lengths, l A and l B , has no effect on agents’ trading decision. When the historical stock price data has a strong uptrend or downtrend, all investors will make the same decision. Thus, we assume that all technical agents can use Bayesian optimization to estimate the optimal length for short and long windows.
We formulate an optimization problem with three main ingredients:
  • Domain space: The range of each hyperparameter is selected. Following the studies in [37], our approach starts the domain from a wide range and then focuses on specific areas around the optimal parameters calculated from the previous run. Thus, each agent is assigned a random short window and long window derived from a random uniform distribution in [5, 40] and [50, 100], respectively.
  • Objective function: We define a score function that indicates how well a set of long-short periods performs. Cumulative returns and Sharpe ratio are usually used to indicate the performance of a technical strategy [38]. In our model, the Sharpe ratio is used as the evaluation metric of choice. We put a minus sign before the objective function since Hyperopt by default is defining a function to minimize.
  • Surrogate function and selection function: The surrogate function is used to propose sets of values that increase performance in minimizing the score of the objective function. Then, they are selected by applying a criterion. In this model, we follow [30] to use the tree Parzen estimator as the surrogate function. The expected improvement criterion is used as the selection function.
The optimal lengths for short and long windows with the largest Sharpe ratio are 35 and 51, respectively. The buy/sell signals are shown in Figure 1.
To describe the heterogeneity, we introduce ψ i ( t ) as the average profit a technical agent i gained in the previous n i trading day, ψ i ( t ) = j = 1 n i 1 n i r ( t j ) , which is considered as a threshold to make a decision. Each agent i will update her threshold ψ i ( t ) with probability 0 p i 1 at each time step t. The updating scheme is represented as in the description of noise agents.
Technical agents are also affected by the public information like the noise agents. The news reactions Q i ( t ) are represented by
Q i ( t ) = 𝟙 I ( t ) > θ i ( t ) 𝟙 I ( t ) < θ i ( t ) .
Define the sign function, s i g n ( x ) , as
s i g n ( x ) = 1 , if x > 0 ; 1 , if x < 0 ; 0 , if x = 0 .
Let N t a denote the total number of technical agents. The trading rule of the technical agent i , i N t a , is represented by
s i ( t ) = sign ψ i ( t ) M ( t ) + Q i ( t ) .
The amplification of trends and unlimited buying power of technical agents can cause problems because the price can grow to infinity or drop to extremely small values very quickly. Thus, fundamental agents are necessary to keep the market reasonably stable.

3.4. Fundamental Agent

Fundamental agents are traders who measure the intrinsic value by analyzing the accounting, finance, and economics of the stock [39]. They make decisions with the belief that the stock price will return to its fundamental value in the long-run. The fundamental value of the stock f t is public to all agents and is assumed to follow a random walk process
f ( t ) = f ( t 1 ) + η ,
where the fundamental shocks η N ( 0 , σ η 2 ) .
At each time step t, fundamental agents make a decision based on the difference between S ( t ) and f ( t ) . Therefore, if the price is below (above) its fundamental value, the agents will make a buy (sell) order. This strategy shortens the difference between price and its fundamental value. They help to stabilize the market and cause the opposite effect on prices for technical agents. In order to account for individual heterogeneity, they are given heterogeneous beliefs about the fundamental price for more interesting dynamics [40].
Let N f a denote the total number of fundamental agents. The trading rule of the fundamental agent i , i N f a , is represented by
s i f a ( t ) = s i g n κ ( f ( t ) S ( t ) ) + ϵ i ,
where κ is a positive coefficient that describes the speed of adjustment. The idiosyncratic term ϵ i embodies a random term that accounts for each individual’s own interpretation. We take it as being normally distributed around zero and with a standard deviation controlled by the user, ϵ i N ( 0 , σ ϵ 2 ) .
Finally, all agents are put together in the artificial financial market. This includes N n o i s e noise agents, N t a technical agents, and N f a fundamental agents. The total number of traders is N,
N = N n o i s e + N t a + N f a .

4. Bayesian Calibration

4.1. Data Description

As an empirical basis, we used a data set that covers 6 years of daily quotes of the DJIA Index, from of January 2013 to January 2019. This period contains 1508 daily returns, of which the main statistical properties are given in Table 1. The analysis focused on stylized facts of the distribution of stock returns and the volatility clustering in the market. Based on this data set, we estimated the proportion of each type of trader in our artificial stock market.

4.2. Model Calibration

We constructed an artificial stock market of N traders. Each type of trader haD a minimum number of 10 and a maximum of 100. The trading period was considered as days, thus the results can be compared with properties of daily returns. We chose λ [ 5 , 20 ] which means the minimum value of daily returns was 5% and the maximum value of daily returns was 20%. We denote 1 / p i as the latency of an agent i when making his decision θ i ( t ) . p was chosen within [ 0.001 , 0.1 ] to be interpreted as days. For example, q = 0.1 means the average updating period of agents was 100 days. The number of days each technical agent collected to calculate profit was chosen within [ 5 , 22 ] , which describes the interest in the returns of traders in the range from 1 week to 1 month. The short and long windows for the technical strategy of all technical traders are given in Section 2, l A = 35 , l B = 51 . The amplitude σ I of the noise of the news arrival process can be chosen in the range [ 0.001 , 0.01 ] to reproduce a realistic range of values for the volatility. The standard deviation of the noise process in fundamental value, σ η , was calculated from the standard deviation of the real price ( σ η p = 3255.43 ), which is in [ 0.5 σ η p , 1.5 σ η p ] . The value of the standard deviation in idiosyncratic term was chosen in the range [ 0.001 , 1 ] . The results discussed in the next section are generic within these parameters’ ranges.
For clarity, we summarize the parameters and calibration ranges used in our model in Table 2. We formulated an optimization problem using the “hyperopt” package of Python with the three main ingredients:
  • Domain space: Each trader was assigned initial values derived from random uniform distributions within the range of Table 2, respectively.
  • Objective function: KL divergence and KS test were used as the evaluation metrics of choice. For this run, the algorithm found the best value of hyperparameters (the one which minimized the loss) in just under 100 trials.
  • Surrogate function and selection function: Tree Parzen estimator was used as the surrogate function. Then, the expected improvement criterion was used as the selection function.
Both KL divergence and KS test found the optimal set of parameters with small simulation error as shown in Table 3. The proportion of each type of trader with KL and KS tests were: N n o i s e : 12.2%, N t a : 78.3%, N f a : 9.6% and N n o i s e : 13.6%, N t a : 75.6%, N f a : 10.6%, respectively. Note that we did not compare values of KL and KS due to differences in measurement definitions. In this work, we picked out the better objective function by investigating their stability over many simulations. KL divergence represents the instability in many simulations; the minimum value ranged from 0.08 to 4.5. In contrast, the KS test showed stability with small fluctuations in the range of 0.03 to 0.06. The stylized facts which we found to be present in the simulated returns are discussed below.
Moreover, we considered many different sets, which contained fixed numbers of different types of traders in ABM. The results in Table 4 show that the KS test had the lowest value when there were three types of traders in the market. Thus, the KS test is an effective objective function to measure simulation errors in the Bayesian calibration of our model.

5. Simulation Results

In this section, we consider a stock market with three types of trader: noise, technical, and fundamental traders, with the KS test as the objective function for calibration. In the first stage, only the noise traders joined the market since the technical traders and fundamental traders need to collect the historical data. In the second stage, after a few days (here we chose the number of days equal to the optimal long window), technical traders and fundamental traders joined the market. The calibrated parameter set is shown in Table 3. Figure 2 shows the daily movement of actual return and simulated return.

5.1. Distribution of Returns

The statistical analysis of the actual returns and simulated returns is given in Table 5 and Table 6. The simulated returns had similar properties to the real ones. In financial data, the heavy tail of the distribution of returns is displayed by a positive kurtosis [41]. We found that the Shapiro–Francia test on actual returns and simulated returns rejected the normality at a significance level of 0.1% with p-values of 2.2 × 10 22 and 1.5 × 10 12 , respectively. The quantile–quantile (Q–Q) plots in Figure 3 are also show the same results. In Figure 4a, the distribution of actual and simulated returns do not display the heavy tail clearly on linear axes. Thus, we change the vertical axis to use logarithmic scaling in Figure 4b to zoom in on the tails. The returns produced by the model were found to be consistently leptokurtically distributed with a heavy tail.

5.2. Absence of Autocorrelations in Returns

Figure 2 shows the plots of stock returns for both actual data and simulated data. We studied the stationarity of the stock returns by using an augmented Dickey–Fuller (ADF) unit root test. The results are shown in Table 7. The p-values of the ADF test statistic for the real returns and the simulated returns are 2.31 × 10 30 and 3.44 × 10 30 , respectively. Since both values are smaller than 0.01, we rejected the null hypothesis that they are non-stationary. In addition, the autocorrelation function (ACF) plots in Figure 5 show the same results, and so we can conclude that there was no correlation between the returns and its lags.

5.3. Volatility Clustering

The next stylized fact we studied was volatility clustering, which describes the the tendency of large changes in prices to cluster together. The volatility clustering can be seen in Figure 6, where the ACFs of the absolute value of returns decay slowly. Notice that for both cases, the autocorrelations of absolute returns remained significantly positive over many time lags. This is clear evidence of volatility clustering.

6. Discussion and Concluding Remarks

In this work we proposed a novel approach to calibrate hyperparameters in an agent-based model with different types of traders. The Bayesian calibration with Kolmogorov–Smirnov test proposed an optimal set of parameters. The model was able to highlight some of the important stylized facts of stock returns, such as the leptokurtosis, the heavy tail of the returns, and volatility clustering.
Our Bayesian approach is different from the recent studies on the calibration of ABMs applied to financial market [12,15,16]. The calibration considers large parameter sets which can become quite a complex and costly operation. In particular, in [15], the authors generated 400,000 initial points to calibrate their model. In [12], the amount of data was reduced due to the high computational complexity of the Island model. Our approach is based on Bayesian rules and looks at previous experience to scale down the search space. Thus, the calibration requires less time and iterations to get the optimal hyperparameters. Moreover, the calibrated results showed that fundamental traders accounted for 9%–11% of all traders in the United States stock market. The proportion of traders in the stock market provides an additional indicator so that traders can come up with effective strategies.
Although Bayesian approaches provide several advantages, the complexity of the objective function could be a problem since it still has its own costs. In our model, the Sharpe ratio used as the objective function is very simple to calculate. However, if we want to consider a complex model with more types of investors and interactions between them, the dimension of domain space will increase. Optimal models require different settings between datasets, and with a high-dimensional space, the correlation between hyperparameters is difficult to study.
This work is only the first step toward fully assessing the properties of agent-based models in the United States stock market. In future research, the model in this research can be applied to other exchange such as the New York Stock Exchange or emerging markets in Asia. The different characteristics of the market and investors provide many interesting results for managers and investors. Moreover, deep learning is a good methodology for dealing with high-dimensional problems. Reinforcement learning can be considered to address Bayesian optimization issues [42], in which our Bayesian approach can be used as a benchmark method for the comparison.

Author Contributions

Conceptualization, M.T.; formal analysis, M.T.; investigation, M.T.; methodology, M.T.; supervision, D.P.-H. and M.B.; validation, T.D. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Vietnam National University Ho Chi Minh City under grant number C2018-42-03.

Acknowledgments

We thank Man Ngo (John von Neumann Institute) for useful discussions.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Gazit, E.; Yair, Y.; Chen, D. Emerging conceptual understanding of complex astronomical phenomena by using a virtual solar system. J. Sci. Educ. Technol. 2005, 14, 459–470. [Google Scholar] [CrossRef]
  2. Jeong, H.; Tombor, B.; Albert, R.; Oltvai, Z.N.; Barabási, A.L. The large-scale organization of metabolic networks. Nature 2000, 407, 651. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  3. Faloutsos, M.; Faloutsos, P.; Faloutsos, C. On power-law relationships of the internet topology. ACM SIGCOMM Comput. Commun. Rev. 1999, 29, 251–262. [Google Scholar] [CrossRef]
  4. Pagani, G.A.; Aiello, M. The power grid as a complex network: a survey. Phys. A Stat. Mech. Appl. 2013, 392, 2688–2700. [Google Scholar] [CrossRef] [Green Version]
  5. Farmer, J.D.; Gallegati, M.; Hommes, C.; Kirman, A.; Ormerod, P.; Cincotti, S.; Sanchez, A.; Helbing, D. A complex systems approach to constructing better models for managing financial markets and the economy. Eur. Phys. J. Spec. Top. 2012, 214, 295–324. [Google Scholar] [CrossRef] [Green Version]
  6. Anderson, P.W. The Economy as an Evolving Complex System; CRC Press: Boca Raton, FL, USA, 2018. [Google Scholar]
  7. Arthur, W.B. The Economy as an Evolving Complex System II; CRC Press: Boca Raton, FL, USA, 2018. [Google Scholar]
  8. Kirman, A.P. Whom or what does the representative individual represent? J. Econ. Perspect. 1992, 6, 117–136. [Google Scholar] [CrossRef] [Green Version]
  9. Campbell, J.Y.; Cochrane, J.H. By force of habit: A consumption-based explanation of aggregate stock market behavior. J. Polit. Econ. 1999, 107, 205–251. [Google Scholar] [CrossRef]
  10. Hommes, C.H. Heterogeneous agent models in economics and finance. Handb. Comput. Econ. 2006, 2, 1109–1186. [Google Scholar] [CrossRef] [Green Version]
  11. Cristelli, M.; Pietronero, L.; Zaccaria, A. Critical overview of agent-based models for economics. arXiv 2011, arXiv:1101.1847. [Google Scholar]
  12. Lamperti, F.; Roventini, A.; Sani, A. Agent-based model calibration using machine learning surrogates. J. Econ. Dyn. Control 2018, 90, 366–389. [Google Scholar] [CrossRef] [Green Version]
  13. Hessary, Y.K.; Hadzikadic, M. Role of behavioral heterogeneity in aggregate financial market behavior: An agent-based approach. Procedia Comput. Sci. 2017, 108, 978–987. [Google Scholar] [CrossRef]
  14. Fenton-O’Creevy, M.; Soane, E.; Nicholson, N.; Willman, P. Thinking, feeling and deciding: The influence of emotions on the decision making and performance of traders. J. Organ. Behav. 2011, 32, 1044–1061. [Google Scholar] [CrossRef]
  15. Recchioni, M.C.; Tedeschi, G.; Gallegati, M. A calibration procedure for analyzing stock price dynamics in an agent-based framework. J. Econ. Dyn. Control 2015, 60, 1–25. [Google Scholar] [CrossRef] [Green Version]
  16. Akram, W.; Niazi, M.A.; Iantovics, L.B.; Vassilakos, A.V. Towards Agent-Based Model Specification of Smart Grid: A Cognitive Agent-Based Computing Approach. Interdiscip. Descr. Complex Syst.: INDECS 2019, 17, 546–585. [Google Scholar] [CrossRef]
  17. Cheng, E. Just 10% of Trading is Regular Stock Picking, JPMorgan Estimates. Available online: https://www.cnbc.com/2017/06/13/death-of-the-human-investor-just-10-percent-of-trading-is-regular-stock-picking-jpmorgan-estimates.html (accessed on 2 February 2019).
  18. Garifullin, M.; Borshchev, A.; Popkov, T. Using AnyLogic and agent-based approach to model consumer market. In Proceedings of the 6th EUROSIM Congress on Modelling and Simulation, Ljubljana, Slovenia, 9–13 September 2007; pp. 1–5. [Google Scholar]
  19. Challet, D.; Marsili, M.; Zhang, Y.C. Minority Games: Interacting Agents in Financial Markets; Oxford University Press: New York, NY, USA, 2005; pp. 27–62. [Google Scholar]
  20. Cont, R. Volatility clustering in financial markets: Empirical facts and agent-based models. In Long Memory in Economics; Springer: Berlin/Heidelberg, Germany, 2007; pp. 289–309. [Google Scholar]
  21. Gode, D.K.; Sunder, S. Human and artificially intelligent traders in computer double auctions. In Computational Organization Theory; L. Erlbaum Associates Inc.: Hillsdale, NJ, USA, 1994; pp. 241–262. [Google Scholar]
  22. Frankel, J.A.; Froot, K.A. Understanding the US dollar in the eighties: the expectations of chartists and fundamentalists. Econ. Record 1986, 62, 24–38. [Google Scholar]
  23. Murphy, J.J. Technical Analysis of the Financial Markets: A Comprehensive Guide to Trading Methods and Applications; New York Institute of Finance: Paramus, NJ, USA, 1999; pp. 1–22. [Google Scholar]
  24. Graham, B.; Dodd, D.L.F.; Cottle, S. Security Analysis; McGraw-Hill: New York, NY, USA, 1934. [Google Scholar]
  25. Plott, C.R.; Sunder, S. Efficiency of experimental security markets with insider information: An application of rational-expectations models. J. Polit. Econ. 1982, 90, 663–698. [Google Scholar] [CrossRef]
  26. Lucey, B.M.; Dowling, M. The role of feelings in investor decision-making. J. Econ. Surveys 2005, 19, 211–237. [Google Scholar] [CrossRef]
  27. Kirman, A. Epidemics of opinion and speculative bubbles in financial markets. Money Financ. Mark. 1991, 17, 354–368. [Google Scholar]
  28. Westerhoff, F. A simple agent-based financial market model: direct interactions and comparisons of trading profits. In Nonlinear Dynamics in Economics, Finance and Social Sciences; Springer: Berlin/Heidelberg, Germany, 2010; pp. 313–332. [Google Scholar]
  29. Tauchen, G.E.; Pitts, M. The price variability-volume relationship on speculative markets. Econom. J. Econom. Soc. 1983, 51, 485–505. [Google Scholar] [CrossRef] [Green Version]
  30. Snoek, J.; Larochelle, H.; Adams, R.P. Practical bayesian optimization of machine learning algorithms. In Advances in Neural Information Processing Systems 25, Proceedings of the 26th Annual Conference on Neural Information Processing Systems, Lake Tahoe, NV, USA, 3–6 December 2012; Curran Associates, Inc.: Red Hook, NY, USA, 2012; pp. 2951–2959. [Google Scholar]
  31. Bergstra, J.; Bengio, Y. Random search for hyper-parameter optimization. J. Mach. Learn. Res. 2012, 13, 281–305. [Google Scholar]
  32. Tumminello, M.; Lillo, F.; Piilo, J.; Mantegna, R.N. Identification of clusters of investors from their real trading activity in a financial market. New J. Phys. 2012, 14, 013041. [Google Scholar] [CrossRef]
  33. Teall, J.L. Financial Trading and Investing; Academic Press: Cambridge, MA, USA, 2018. [Google Scholar]
  34. Brown, D.P.; Jennings, R.H. On technical analysis. Rev. Financ. Stud. 1989, 2, 527–551. [Google Scholar] [CrossRef]
  35. Pring, M.J. Technical Analysis Explained, 4th ed.; McGraw-Hill: NewYork, NY, USA, 2002. [Google Scholar]
  36. Brock, W.; Lakonishok, J.; LeBaron, B. Simple technical trading rules and the stochastic properties of stock returns. J. Finance 1992, 47, 1731–1764. [Google Scholar] [CrossRef]
  37. Schwager, J.D. A Complete Guide to the Futures Markets: Fundamental Analysis, Technical Analysis, Trading, Spreads, and Options; John Wiley & Sons: New York, NY, USA, 1984. [Google Scholar]
  38. Martin, A.D. Technical trading rules in the spot foreign exchange markets of developing countries. J. Multinatl. Financ. Manag. 2001, 11, 59–68. [Google Scholar] [CrossRef]
  39. Walraven, J.C. Fundamental analysis of aggregate interlock. J. Struct. Division 1981, 107, 2245–2270. [Google Scholar]
  40. Ferreira, F.F.; de Oliveira, V.M.; Crepaldi, A.F.; Campos, P.R. Agent-based model with heterogeneous fundamental prices. Physica A: Stat. Mech. Its Appl. 2005, 357, 534–542. [Google Scholar] [CrossRef]
  41. Lux, T.; Alfarano, S. Financial power laws: Empirical evidence, models, and mechanisms. Chaos Solitons Fractals 2016, 88, 3–18. [Google Scholar] [CrossRef]
  42. Brochu, E.; Cora, V.M.; De Freitas, N. A tutorial on Bayesian optimization of expensive cost functions, with application to active user modeling and hierarchical reinforcement learning. arXiv 2010, arXiv:1012.2599. [Google Scholar]
Figure 1. Moving average oscillator with buy/sell signals.
Figure 1. Moving average oscillator with buy/sell signals.
Mathematics 08 00198 g001
Figure 2. Simulation of returns.
Figure 2. Simulation of returns.
Mathematics 08 00198 g002
Figure 3. Quantile–quantile plot of returns.
Figure 3. Quantile–quantile plot of returns.
Mathematics 08 00198 g003
Figure 4. Distribution of actual and simulated returns.
Figure 4. Distribution of actual and simulated returns.
Mathematics 08 00198 g004
Figure 5. Autocorrelations of actual and simulated returns.
Figure 5. Autocorrelations of actual and simulated returns.
Mathematics 08 00198 g005
Figure 6. Autocorrelation of absolute returns.
Figure 6. Autocorrelation of absolute returns.
Mathematics 08 00198 g006
Table 1. Statistical properties of the actual returns.
Table 1. Statistical properties of the actual returns.
Number of ObservationsMeanStandard DeviationKurtosisSkewnessMinMax
15080.03%8.09%4.31−0.64−5.07%3.81%
Table 2. Description of parameters.
Table 2. Description of parameters.
ParametersDescriptionValue
N n o i s e Number of noise agents [ 10 , 100 ]
N t a Number of technical agents [ 10 , 100 ]
N f a Number of fundamental agents [ 10 , 100 ]
λ Market depth [ 5 , 20 ]
pFraction of agents updating their news reaction [ 0.001 , 0.1 ]
nNumber of days each technical agent collected to calculate profit [ 5 , 22 ]
κ Adjustment speed [ 0.001 , 1 ]
σ I Standard deviation of the noise representing the news arrival process [ 0.001 , 0.01 ]
σ η Standard deviation of the noise process in fundamental value [ 1627.72 , 4883.15 ]
σ ϵ Standard deviation of idiosyncratic term [ 0.01 , 1 ]
Table 3. Optimized parameters. KL: Kullback–Leibler divergence; KS: Kolmogorov–Smirnov.
Table 3. Optimized parameters. KL: Kullback–Leibler divergence; KS: Kolmogorov–Smirnov.
MethodOptimal Parameters
Value N noise N ta N fa λ pn κ σ I σ η σ ϵ
KL0.08 149011200.0611610.00127000.004
KS0.03 1810014150.1910.00120000.003
Table 4. Comparing the KS test results of different fixed numbers of types of traders.
Table 4. Comparing the KS test results of different fixed numbers of types of traders.
KS TestTrader Set
N noise N ta N fa
0.1010000
0.2201000
0.131001000
0.250100100
0.06100100100
Table 5. Comparing statistical properties of the actual returns and simulated returns.
Table 5. Comparing statistical properties of the actual returns and simulated returns.
DataMeanStandard DeviationKurtosisSkewness
Real returns0.03%8.09%4.31−0.64
Simulation0.02%8.09%2.32−0.08
Table 6. Comparing statistical properties of the actual returns and simulated returns (cont.).
Table 6. Comparing statistical properties of the actual returns and simulated returns (cont.).
DataMinQuantilesMax
25%50%75%
Real returns−5.07%−2.99%0.06%4.14%3.81%
Simulation−3.35%−4.30%0.03%4.92%4.57%
Table 7. ADF unit root test for real returns and simulated returns.
Table 7. ADF unit root test for real returns and simulated returns.
DataADFp-ValueCritical Values
Statistic1%5%10%
Real Returns−18.282.31 × 10 30 −3.44−2.86−2.57
Simulation−17.733.44 × 10 30 −3.44−2.86−2.57

Share and Cite

MDPI and ACS Style

Tran, M.; Duong, T.; Pham-Hi, D.; Bui, M. Detecting the Proportion of Traders in the Stock Market: An Agent-Based Approach. Mathematics 2020, 8, 198. https://doi.org/10.3390/math8020198

AMA Style

Tran M, Duong T, Pham-Hi D, Bui M. Detecting the Proportion of Traders in the Stock Market: An Agent-Based Approach. Mathematics. 2020; 8(2):198. https://doi.org/10.3390/math8020198

Chicago/Turabian Style

Tran, Minh, Thanh Duong, Duc Pham-Hi, and Marc Bui. 2020. "Detecting the Proportion of Traders in the Stock Market: An Agent-Based Approach" Mathematics 8, no. 2: 198. https://doi.org/10.3390/math8020198

APA Style

Tran, M., Duong, T., Pham-Hi, D., & Bui, M. (2020). Detecting the Proportion of Traders in the Stock Market: An Agent-Based Approach. Mathematics, 8(2), 198. https://doi.org/10.3390/math8020198

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop