Agent-Based Model with Asymmetric Trading and Herding for Complex Financial Systems

Background For complex financial systems, the negative and positive return-volatility correlations, i.e., the so-called leverage and anti-leverage effects, are particularly important for the understanding of the price dynamics. However, the microscopic origination of the leverage and anti-leverage effects is still not understood, and how to produce these effects in agent-based modeling remains open. On the other hand, in constructing microscopic models, it is a promising conception to determine model parameters from empirical data rather than from statistical fitting of the results. Methods To study the microscopic origination of the return-volatility correlation in financial systems, we take into account the individual and collective behaviors of investors in real markets, and construct an agent-based model. The agents are linked with each other and trade in groups, and particularly, two novel microscopic mechanisms, i.e., investors’ asymmetric trading and herding in bull and bear markets, are introduced. Further, we propose effective methods to determine the key parameters in our model from historical market data. Results With the model parameters determined for six representative stock-market indices in the world, respectively, we obtain the corresponding leverage or anti-leverage effect from the simulation, and the effect is in agreement with the empirical one on amplitude and duration. At the same time, our model produces other features of the real markets, such as the fat-tail distribution of returns and the long-term correlation of volatilities. Conclusions We reveal that for the leverage and anti-leverage effects, both the investors’ asymmetric trading and herding are essential generation mechanisms. Among the six markets, however, the investors’ trading is approximately symmetric for the five markets which exhibit the leverage effect, thus contributing very little. These two microscopic mechanisms and the methods for the determination of the key parameters can be applied to other complex systems with similar asymmetries.


Introduction
In recent years, the understanding of complex systems has been undergoing rapid development. Financial markets are important examples of complex systems with many-body interactions. The possibility of accessing large amounts of historical financial data has spurred the interest of scientists in various fields, including physics. Plenty of results have been obtained with physical concepts, methods and models [1][2][3][4][5][6][7][8][9][10][11][12][13].
There are several stylized facts in financial markets. Besides the fat tail in the probability distribution of price returns, it is wellknown that the volatilities are long-range correlated in time, which is the so-called volatility clustering [14]. However, our knowledge on the dynamics of the price itself is still limited. Since the autocorrelation of returns is extremely weak [2,3], nonzero higherorder time correlations become important, especially the lowestorder one among them. In financial markets, this lowest-order nonzero correlation turns out to be the return-volatility correlation, on which we lay emphasis in this paper. In 1976, a negative return-volatility correlation is first discovered by Black [15]. This is the so-called leverage effect, which implies that past negative returns increase future volatilities. The leverage effect is actually observed in various financial systems, such as stock markets, futures markets, bank interest rates and foreign exchange rates [6,[15][16][17][18][19][20][21]. We have studied about thirty stock-market indices, and all of them exhibit the leverage effect. To the best of our knowledge, the leverage effect exists in almost all stock markets in the world. In Chinese stock markets, however, a positive returnvolatility correlation is detected, which is called the anti-leverage effect [6,19]. This effect is also observed in other economic systems, such as bank interest rates of early years and spot markets of non-ferrous metals.
The leverage and anti-leverage effects are crucial for the understanding of the price dynamics [6,15,19,20], and important for risk management and optimal portfolio choice [22,23]. However, the origination of the return-volatility correlation is still disputed, even at the macroscopic level [19,20,[24][25][26][27][28][29]. According to Black, the leverage effect arises because a price drop increases the risk of a company to go bankrupt and leads the stock to fluctuate more. So far, various macroscopic models have been proposed to understand the return-volatility correlation [4,19,[30][31][32][33]. The retarded volatility model is an enlightening one, which can produce both the leverage and anti-leverage effects [4]. However, it is a model with only one degree of freedom, and both the initial time series of returns and the function of the feedback return-volatility interaction, are actually input. Hence, the model is phenomenological in essence, and the generation mechanism of the leverage and anti-leverage effects is macroscopic. In very recent years, many researches have been devoted to the returnvolatility correlation, but how to produce the return-volatility correlation with a microscopic model remains open.
Agent-based modeling is a powerful simulation technique, which is widely applied in various fields [34][35][36][37][38][39][40][41]. More recently, an agent-based model is proposed for reproducing the cumulative distribution of empirical returns and trades in stock markets [41]. It is a outstanding model with key parameters determined from empirical findings rather than from being set artificially. In this paper, we construct an agent-based model with asymmetric trading and herding to explore the microscopic origination of the leverage and anti-leverage effects. In the past decades, although the asymmetric trading and herding behaviors may have been touched macroscopically, they have not been taken into account in the microscopic modeling yet. Especially, we propose effective methods to determine the key parameters in our model from historical market data.

Methods
To study the microscopic origination of the return-volatility correlation in stock markets, we take into account the individual and collective behaviors of investors, and construct a microscopic model with multi-agent interactions. Further, we determine the key parameters in our model from historical market data rather than from statistical fitting of the results.
Our model is basically built on agents' daily trading, i.e., buying, selling and holding stocks. Empirical studies indicate that investors make decisions according to the previous stock performance of different time windows [42], which suggests that their horizons of investment vary. This investment horizon is introduced to our model for a better description of agents' market behavior. Most crucially, two important behaviors of investors are taken into account for understanding the return-volatility correlation.

Two Important Behaviors of Investors
(a) Investors' asymmetric trading in bull and bear markets.
There are various definitions of bull and bear markets [43,44]. The usual definition is that in stock markets, bull and bear markets correspond to the periods of generally increasing and decreasing stock prices respectively [43]. In this paper we adopt this definition, and simply define a market to be bullish on one day if the price return is positive, and bearish if the price return is negative. The asymmetric trading in bull and bear markets is an individual behavior, which is induced by investors' different trading desire when the price drops and rises. To be more specific, an investor's willingness to trade is affected by the previous price returns, leading the trading probability to be distinct in bull and bear markets. (b) Investors' asymmetric herding in bull and bear markets.
Herding, as one of the collective behaviors, is that investors cluster in groups when making decisions, and these groups can be large in financial markets [45][46][47][48][49][50][51]. Actually, the herding behavior in bull markets is not the same as that in bear ones [47,52,53]. For instance, previous study has shown that in the recent US market, the herding behavior in bear markets appears much more significant than that in bull ones [47]. Generally, investors may cluster more intensively in either bull or bear markets, leading the herding to be asymmetric.

Microscopic Model with Multi-agent Interactions
The stock price on day t is denoted as Y (t), and the logarithmic price return is R(t)~ln½Y (t)=Y (t{1). In stock markets, the information for investors is highly incomplete, therefore an agent's decision of buy, sell or hold is assumed to be random. Since intraday trading is not persistent in empirical trading data [54], we consider that only one trading decision is made by each agent in a single day. In our model, there are N agents, and each operates one share every day. On day t, each agent i makes a trading decision S i (t), and the probabilities of buy, sell and hold decisions are denoted as P buy (t), P sell (t) and P hold (t), respectively. The price return R(t) in our model is defined by the difference of the demand and supply of the stock, i.e., the difference between the number of buy agents and sell ones, The volatility is defined as the absolute return jR(t)j. The investment horizon is introduced since agents' decision makings are based on the previous stock performance of different time horizons. It has been found that the relative portion c i of agents with i days investment horizon follows a power-law decay, c i !i {g with g~1:12 [18]. The maximum investment horizon is denoted as M, thus i max~M . With the condition of Agents' trading decisions are made according to the previous price returns. For an agent having investment horizon of i days, P i{1 j~0 R(t{j) represents a simplified investment basis for decision making on day tz1. We introduce a weighted average return R 0 (t) to describe the integrated investment basis of all agents. Taking into account that c i is the weight of P i{1 j~0 R(t{j), R 0 (t) is defined as where , such that jR 0 (t)j max~N~j R(t)j max to ensure that the fluctuation scale of R 0 (t) remains consistent with the one of R(t) (see Appendix S1). If M~1, R 0 (t) is just identical to R(t). Actually, M varies from market to market, and from time period to time period for a market. According to Ref. [42], the investment horizons of investors range from a few days to several months. We estimate the maximum investment horizon M to be 150 in our model. For M between 50 and 500, the simulated results remain qualitatively robust.
(i) Asymmetric trading. In Ref. [41], investors' probabilities of buy and sell are assumed to be equal, i.e., P buy~Psell~p , and p is a constant. In our model, we adopt the value of p estimated in Ref. [41], p~0:0154. We assume P buy (t)~P sell (t) as well, but now P buy (t) and P sell (t) evolve with time since the agents' trading is asymmetric in bull and bear markets. As the trading probability P trade (t)~P buy (t)zP sell (t), we set its average over time SP trade (t)T~2p. From the investors' behavior (a) described in Subsec. 1 in Sect. Methods, we define the market performance of the previous M days to be bullish if R 0 (t)w0, and bearish if R 0 (t)v0. The investors' asymmetric trading in bull and bear markets gives rise to the distinction between P trade (tz1)j R 0 (t)w0 and P trade (tz1)j R 0 (t)v0 . Thus, P trade (tz1) should take the form Here a and b are constants, and SP trade (t)T~2p requires azb~2, i.e., a and b are not independent.
(ii) Asymmetric herding. The herding behavior implies that investors can be divided into groups. Here a herding degree D(t) is introduced to quantify the clustering degree of the herding behavior, where n A (t) is the average number of agents in each group on day t. Herding should be related to previous volatilities [46,55], and we set n A (tz1)~jR 0 (t)j. Hence the herding degree on day tz1 is This herding degree is symmetric for R 0 (t)w0 and R 0 (t)v0.
According to the investors' behavior (b) described in Subsec. 1 in Sect. Methods, however, investors' herding behaviors in bull and bear markets are asymmetric, i.e., herding is stronger in either bull markets or bear ones. More specifically, D(tz1) is not symmetric for R 0 (t)w0 and R 0 (t)v0, and should be redefined to be Here DR is the degree of asymmetry, and as DR grows, herding becomes more asymmetric. According to Eq. (5),  tz1) is the average number of agents in a same group. Thus we randomly divide N agents into 1=D(tz1) groups on day tz1. Everyday, the agents in a group make a same trading decision (buy, sell or hold) with the same probability (P buy , P sell or P hold ).

Determination of a and DR
This is the key step in the construction of our model. We emphasize that a and DR are determined from the historical market data rather than from statistical fitting of the simulated results. Six representative stock-market indices are studied with our model, including the S&P 500, Shanghai, Nikkei 225, where S Á Á Á T represents the average over time t, and s~ffi ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi SR 2 (t)T{SR(t)T 2 q is the standard deviation of R(t). The stock market is assumed to be bullish if r(t)w0, and bearish if r(t)v0. To determine a, we first define an average trading volume V z for the bull markets, and V { for the bear ones, Here n r(t)w0 and n r(t)v0 represent the number of positive and negative returns respectively, and V (t) is the trading volume on day t. As displayed in Table 1, the ratio V z =V { is 1.03 for the S&P 500 Index and 1.21 for the Shanghai Index. In our model, since the average trading volumes for bull markets (R 0 (t)w0) and bear markets (R 0 (t)v0) are N : P trade (tz1)j R 0 (t)w0 and N : P trade (tz1)j R 0 (t)v0 , the ratio of these two average trading volumes is Together with the condition azb~2, we determine a~1:01 from V z =V { for the S&P 500 Index and a~1:09 for the Shanghai Index. Table 1 also shows the values of V z =V { and a for the Nikkei 225, FTSE 100, Hangseng and DAX indices. Several data series of different time periods are sampled from the historical market data, and the error is given for a in this table. Student's t-test is performed to analyze the statistical significance for a deviating from 1:0, and a p-value less than 0.05 is considered statistically significant. The analysis shows that only the value a~1:09 of the Shanghai Index is significantly deviating from 1.0, with the p{value~8:4|10 {4 . In our simulation, for simplicity, we approximate a to be 1.0 for the S&P 500, Nikkei 225, FTSE 100, Hangseng and DAX indices, and 1.1 for the Shanghai Index. Now we turn to DR. In real markets, herding is related to volatilities [46,55]. Thus we introduce the average jr(t)j with the weight V(t) to describe the herding degree in a specific period. Thus the herding degrees of bull markets (r(t)w0) and bear markets (r(t)v0) are defined as d bull (r(t))~P t,r(t)w0 ½V (t) : r(t)= P t,r(t)w0 V(t) d bear (r(t))~P t,r(t)v0 ½V (t) : jr(t)j= P t,r(t)v0 V (t) From empirical findings, the herding degrees of bull and bear stock markets are not equal, i.e., d bull =d bear . In order to equalize d bull and d bear , we introduce a shifting to r(t), denoted by Dr, such that d bull (r 0 (t))~d bear (r 0 (t)) with r 0 (t)~r(t)zDr. From this definition of Dr, we derive (see Appendix S2) Thus we obtain Dr~0:067 for the S&P 500 Index and Dr~{0:043 for the Shanghai Index. In our model, we similarly compute the shifting to the time series R(t), which equalize the herding degree D(tz1)~jR 0 (t){DRj=N in bull markets (R 0 (t)w0) and bear markets (R 0 (t)v0). Actually, one may prove that the shifting to R(t) is equivalent to the shifting to R 0 (t) (see Appendix S3). If R 0 (t) is replaced by R 00 (t)~R 0 (t)zDR, D(tz1) turns into D(tz1)~jR 00 (t){DRj=N~jR 0 (t)j=N, which is symmetric for bull and bear markets. Therefore, DR is the shifting to R 0 (t), and it is just the shifting to R(t).
The time series of returns in different real markets and in our model fluctuate at different levels. For comparison, we normalize the returns with Eq. (8). Similarly, DR, the shifting to returns, should also be normalized to Dr. However, in simulating the stock markets with our model, the parameter we need is DR. Therefore, we should first derive the relation of DR and Dr. With the where S Á Á Á T represents the average over time t, and s is the standard deviation of R(t). To determine the relation of DR and Dr, DR is set to be 24, 23, 22, 21, 0, 1, 2, 3, 4, respectively, and a is set to be 1.0 to produce time series R(t). With R(t) simulated 100 times for each DR, we compute Dr and average the results. As displayed in Fig. 1, the relation of DR and Dr is linear, and DR~38:2Dr. For a between 0.9 and 1.1, the results remain robust. Thus, we determine DR~3 for the simulation of the S&P 500 Index and DR~{2 for the simulation of the Shanghai Index. Table 1 shows the values of Dr and DR, as well as the error of Dr, for the Nikkei 225, FTSE 100, Hangseng and DAX indices. Due to the fluctuation of the empirical data, the error of Dr is about 10 percent. Since the sign of Dr determines that the simulation yields the leverage or anti-leverage effect, we perform Student's t-test to analyze the statistical significance of Dr, and the corresponding p-value is listed in Table 1. A p-value less than 0.05 is considered statistically significant.
To further validate the methods for the determination of the key parameters and the simulations for the leverage and anti-leverage effects, eight more indices are studied (see Appendix S4). The simulation of each index correctly produces the leverage or antileverage effect.

Simulation
The number of agents in our simulations is 10000, i.e., N~10000. With a and DR determined for each index, our model produces the time series of returns R(t) in the following procedure. Initially, the returns of the first 150 time steps are set to be 0. On day tz1, we calculate R 0 (t) according to Eq. (3), then P trade (tz1) and D(tz1) according to Eq. (4) and Eq. (7), respectively. Next, we randomly divide all agents into 1=D(tz1) groups. The agents in a group make a same trading decision (buy, sell or hold) with the same probability (P buy , P sell or P hold ). After all agents have made their decisions, we calculate the return R(tz1) with Eq. (1) and Eq. (2). Repeating this procedure, we obtain the return time series R(t) . 20000 data points of R(t) are

Results
To describe how past returns affect future volatilities, the return-volatility correlation function L(t) is defined, with Z~Sjr(t 0 )j 2 T 2 and L 0~S r(t 0 )TSjr(t 0 )j 2 T [8]. Here S Á Á Á T represents the average over time t 0 . As displayed in Fig. 2, L(t) calculated with the empirical data of the S&P 500 Index shows negative values up to at least 15 days, and this is the well-known leverage effect [4,6,15]. On the other hand, L(t) for the Shanghai Index remains positive for about 10 days. That is the so-called anti-leverage effect [6,19]. Fitting L(t) to an exponential form L(t)~c : exp({t=t), we obtains t~19 and 8 days for the leverage and anti-leverage effects, respectively. Compared with the short correlating time of the returns, the order of minutes [2,3], both the leverage and anti-leverage effects are prominent. As the lowest-order nonzero correlations of returns, the leverage and anti-leverage effects are theoretically crucial for the understanding of the price dynamics [6,15,19,20]. In practical application, these effects are important for risk management and optimal portfolio choice [22,23]. After the time series R(t) produced in our model is normalized to r(t), we compute the return-volatility correlation function, and the result is in agreement with that calculated from empirical data on amplitude and duration for both the S&P 500 and Shanghai indices, as shown in Fig. 2. This is the first time that the leverage and anti-leverage effects are produced with a microscopic model.
For the Nikkei, FTSE 100, Hangseng and DAX indices, the volume data of early years are not available to us. However, L(t) is computed from only price data. In order to reduce the fluctuation of L(t), we collect the price data of a longer period, which are from 1984 to 2012 with 7092 data points for the Nikkei 225 Index, from 1984 to 2012 with 7227 data points for the FTSE 100 Index, from 1988 to 2012 with 6181 data points for the Hangseng Index and from 1990 to 2012 with 5514 data points for the DAX Index. As displayed in Fig. 3, L(t) for the simulations is in agreement with that for the corresponding indices. Table 2 shows the values of c and j of the exponential fit L(t)~c : exp(jt) for the six indices and the corresponding simulations. Since c is obviously non-zero, the p-value of Student's t-test is only listed for j.
Our model also produces other features of the real markets, such as the long-term correlation of volatilities and the fat-tail distribution of the returns. Here we take the S&P 500 and Shanghai indices as examples. The auto-correlation function of volatilities is defined as where A 0~S jr(t 0 )j 2 T{Sjr(t 0 )jT 2 [19], and S Á Á Á T represents the average over time t 0 . As shown in Fig. 4, A(t) for the simulations is consistent with that for the empirical data. The cumulative distributions P(jr(t)jwx) of absolute returns are shown in Fig. 5, where the fat tail in the distribution of empirical returns can be observed in that of the simulated returns as well. By the definitions, both a and Dr are not dependent on the number of agents (denoted by N) in the model. However, the slope of the linear relation between DR and Dr increases with N. Therefore, the magnitude of DR becomes larger as N grows. For the simulation results, the amplitude of L(t) increases with N, but gradually converges for larger N (see Appendix S5). For A(t) and P(jr(t)jwx), the cases are similar.

Discussion
In our model, the crucial generation mechanisms of the returnvolatility correlation are the agents' asymmetric trading and herding behaviors in bull and bear markets. Now we discuss how these two mechanisms contribute to the leverage and anti-leverage effects, and which one is more significant. According to Eq. (4) and azb~2, P trade is symmetric about R 0 (t)~0 if a~1:0, and asymmetric if a=1:0. On the other hand, D(tz1) in Eq. (7) is asymmetric about R 0 (t)~0 if DR=0. In our model, the S&P 500 and Shanghai indices are simulated with (a,DR)~(1:0,3) and (a,DR)~ (1:1,{2), respectively. Therefore, P trade is symmetric in the simulation of the S&P 500 Index, but asymmetric in the simulation of the Shanghai Index. D(tz1) is asymmetric in the simulation of both the S&P 500 and Shanghai indices. With other parts of the model remain unchanged, we consider the following controls: (a) P trade is replaced by a symmetric one in the simulation of the Shanghai Index; (b) D(tz1) is replaced by a symmetric one in the simulation of both the S&P 500 and Shanghai indices; (c) both P trade and D(tz1) are replaced by the symmetric ones in the simulation of the Shanghai Index.
The simulations are performed 100 times for average. We conclude that for the leverage and anti-leverage effects, both the investors' asymmetric trading and herding are essential generation mechanisms. As displayed in Fig. 6, the anti-leverage effect is weakened significantly and the leverage effect disappears after we replace the asymmetric D(tz1) with the symmetric one. On the other hand, the anti-leverage effect recedes after the asymmetric P trade is replaced by the symmetric one. It is worth mentioning that for the five stock markets exhibiting the leverage effect, the S&P 500, Nikkei 225, FTSE 100, Hangseng and DAX, P trade is approximately symmetric, thus contributing very little to the leverage effect. The investors' asymmetric trading in the Shanghai market may result from the fact that the Shanghai market is an emerging market. Investors are somewhat speculative, and rush for trading as the stock price increases [6].

Conclusion
Based on investors' individual and collective behaviors, we construct an agent-based model to investigate how the returnvolatility correlation arises in stock markets. In our model, agents are linked with each other and trade in groups. In particular, two novel mechanisms, investors' asymmetric trading and herding behaviors in bull and bear markets, are introduced. There are four parameters in our model, i.e., p, M, a and DR. We adopt p estimated in Ref. [41], and estimate the only tunable parameter M to be 150. a and DR, the key parameters, are induced by the asymmetries in trading and herding, respectively. Specifically, we determine a from the ratio of the average trading volume when stock price is rising and that when price is dropping, and DR from investors' different herding degrees in bull and bear markets.
We collect the daily price and volume data of six representative stock-market indices in the world, including the S&P 500, Shanghai, Nikkei 225, FTSE 100, Hangseng and DAX indices. With a and DR determined for these indices respectively, we obtain the corresponding leverage or anti-leverage effect from the Figure 6. The return-volatility correlation functions for the simulated results of the S&P 500 and Shanghai indices, and for those of the controls. The S&P 500 and Shanghai indices exhibit the leverage and anti-leverage effects, respectively. For the leverage effect, we consider two cases: D is asymmetric; D is symmetric. The latter is the control. For the anti-leverage effect, we consider the following cases: both P trade and D are asymmetric; only D is asymmetric; only P trade is asymmetric; both P trade and D are symmetric. The last three cases are controls. For each case, the simulation is performed for 100 times, and the average L(t) is displayed. doi:10.1371/journal.pone.0079531.g006 simulation, and the effect is in agreement with the empirical one on amplitude and duration. Other features, such as the long-range auto-correlation of volatilities and the fat-tail distribution of returns, are produced at the same time. Further, it is quantitatively demonstrated in our model that both the investors' asymmetric trading and herding are essential generation mechanisms for the leverage and anti-leverage effects at the microscopic level. However, the investors' trading is approximately symmetric for the five stock markets exhibiting the leverage effect, thus contributing very little to the effect. These two microscopic mechanisms and the methods for the determination of a and DR can also be applied to other complex economic systems with similar asymmetries in individual and collective behaviors, e.g., to futures markets, bank interest rates, foreign exchange rates and spot markets of non-ferrous metals.

Supporting Information
Appendix S1 Derivation of k. (PDF)