We study the contrarian and trend-following trading behavior of market timers in China's stock market. Using a network model to describe interpersonal relationships, we deploy the Ising model to capture trading strategies for both contrarians and followers. With empirical data of China's stock market, we find that contrarians account for 12-14% of trading volume. We further compare the performance of contrarians and followers and demonstrate the inefficiency of China's stock market where timing arbitrage exists. We highlight the fact that while the actual return sequence is driven by followers, the contrarians seize a lot of profitable arbitrage opportunities.

1. Introduction

In many emerging markets, the majority of the investors are individuals instead of institutional investors. Individual investors lack investment experience and awareness of risks, and their emotional behavior is an important cause for the violent shock of the stock market. As a result, these markets are immature and often overreacted. We consider agent-based modeling to analyze the ineffective stock market where the price data has inherent laws. A lot of theories and examples of agent-based dynamical system models have been recognized to be useful in financial markets [13].

To study the strategies of investors characterized by different emotions and attitudes, many works adopt concepts from network-based dynamics [46] and the Ising model [710]. These models assume that the long-term yield of a stock is mainly determined by its economic fundamentals, whereas short-term fluctuations of its price are mostly influenced by investors’ sentiments or opinions. This further allows describing the dynamics of price and trading volume through microscopic mechanisms in financial markets [1116]. For example, the log-returns of stock prices have been found to be related to magnetization of spin models. Some work interprets the magnetization to study the mechanisms that create bubbles and crashes in terms of financial markets [17, 18]. Sornette (2014) [12] explained that the Ising-type models are special ABM implementations with which they formulated an “Emerging Intelligence Market Hypothesis”. Wen and Jun (2012) [19, 20] analyzed the interaction between investors and random fluctuations of stock prices based on the Ising model and found that the rate of returns simulated by the model is consistent with the actual situation. Similar work has been done by Bonggyun et al. (2015) [21], as they employed nonlinear Ising model to generate financial return sequence analogous to those of the real sequence. In the literature, many of these works focus on the interaction mechanism and characteristics of simulated stock sequences. In comparison, few studies have quantitatively explored the composition of the real market, particularly how the behavior of different investors drives the market price.

In this paper, we study the contrarian and trend-following behavior of investors in China's stock market, which has been discussed by several works [2224]. Some scholars have revealed that the real stock market has a time-series momentum effect in the short run and a contrarian effect in the long run [23]. Our study define trend-following behavior as following others’ opinions and short-term trends instead of simple momentum. Using empirical stock price data, we formulate trading strategies and construct a network-based Ising-Stock model. In this model, the trading behavior of players contributes to the pricing mechanism. With extensive simulations, we find that contrarian timers account for 12-14% of trading volume. Comparing the performance of contrarians and followers, we further demonstrate the inefficiency of China’s stock markets where timing arbitrage widely exists. Interestingly, we find that the return rate sequence is driven by followers, but the contrarian timers seize a lot of profitable arbitrage opportunities and further promote the stock price to return to its intrinsic value.

2. Methods

Our model characterizes the investment strategy of two types of investors. The first type is the contrarian timer. These investors try to judge a trend with the greatest statistical probability based on historical data and seize contrarian opportunities by analyzing the herd actions of investors around them. The second type is the passive follower, who generally follows others’ behavior and the price trend. In our model, both types of investors aim to make profits, and the only difference between them lies in their investing strategies, other than which, these two types of investors are identical with the same initial capital allocation and the same network connection mechanism.

2.1. Network-Based Ising-Stock Model

We consider players in the stock market, with contrarians and followers, whose interpersonal relationship is described by a scale-free and small-world network [25, 26], where each node represents a player. For each player , we denote his neighborhood which contains all other players that directly connect to him as .

At each time, each player places a buy () or sell () order. For simplicity, we assume that each player can only buy or sell one unit of the asset at one time. We denote the average state of the trading behavior as . Then reflects high demand because more investors have chosen to buy the asset instead of selling it, which further leads to an increase in the price. On the other hand, indicates that supply exceeds demand in the system, pushing down the price and leading to negative yield. In general, we use to describe the rate of return [15]. Next, we describe the strategy of contrarian timers and passive followers separately.

A contrarian believes that stock prices are determined by the intrinsic value of economic fundamentals and influenced by short-term emotional trades. His basic idea is that prices will return to the intrinsic value, so statistical predictions on short-term trends can be made in light of whether the market is overreacting. He has a tendency to act based on reverse thinking, taking the action differently from the majority. Therefore, his decision can be formulated aswhere and denote the thresholds that the contrarian decides to sell or buy. In our model, these two thresholds are determined by the predicted return rate related to the sequence “”, all of which is data before time . To account for the fact that more recent information should have a higher impact on contrarians’ expectations than past information, each data point is weighted by a normal distribution function of time. As such is defined aswhere refers to the closest time period to time t. Here, we adjust for to make (nearly number of trading days in one month). We further assume that the contrarians care not only about the long-term dynamic trend but also about the price level in the short term. They take the maximum and minimum return in the latest week (or five trading days) into account to set a threshold over which they can achieve as great yield as possible. The psychological threshold set by these investors should be different for buying and selling, which we formulate as below:where we use the long-term trend to smooth the short-term fluctuation of price, and determines the logarithmic gain of the actual closing price. Only when or , will an active timer sell or buy one unit of an asset, respectively. Figure 1(b) shows an example of the action threshold of contrarians based on an actual yield rate sequence.

For a follower, he mostly focuses on second-hand information, which is others’ opinions or judgments, along with the price trend. Thus, he makes decisions mainly based on the connected investors’ behavior, temporary yield, and public expectations. Therefore, the probability that the follower chooses to buy or sell iswhereandwhere denotes the sets of nodes that directly connect with and is a measure of noise and governs the strength of selection. is the impact of investor on investor , defined aswhich is proportional to the ratio of the degree of node to the total degree of the network. The higher the degree of node , the greater the effect it has on node . Additionally, captures the relative intensity factor of , and a higher indicates that followers rely more on the rate of return at the previous time.

We can draw an analogy between the parameters in the classic Ising model and our model. Concretely, constitutes the external information of the system, corresponding to the external magnetic field of the Ising model. The temperature in the Ising model is replaced by the proportion of contrarians to describe the internal energy of the market, where a higher brings more free energy for players to trade, which will increase the randomness of investor behavior and drive to zero faster. Consider an extreme case in which and . Thus, when , collapses to the state -1, whereas collapses to the state +1  when . In this case, the average state never reaches zero, so the market is never balanced. The market will generate more internal energy when it has more contrarians, getting rid of blind investment more easily and achieving a balanced business.

We define the above model as the Ising-Stock model and summarize the analogy between the Ising-Stock model and the classic Ising model in Table 1.

2.2. Stock Data Simulation

Having formulated our model, now we describe how we simulate the stock price and compare it to the empirical value. In China’s stock market, the daily limit of the return rate is 10%, which means that the price of a stock can only go up (down) by 10% even though everyone wants to buy (sell) it, so the return should stay in the range . Assuming that players are in a continuous auction with a particular number of transactions per second, the turnover and deal price will affect the transaction at the next second. The closing price is the result of the day’s overall trading behavior, contributing to reciprocal causation together with the rate of return.

We denote the average cash flow at each time held by the contrarians, followers, and all players as , , and , respectively. These indicators can be calculated asWe select a sequence of the daily closing price of a stock index to calculate , and we substitute it into (6) to simulate the yield rate sequence by the Ising-Stock model. In order to compare the simulated sequence with the actual data sequence to determine whether the simulated and actual behavior of investors are aligned, we define the objective function as the correlation coefficient over the deviation between the sequence and with length of :

Next, we tune the parameters to maximize , so that the investor structure can finally be determined. To compare the popularity of contrarian timing operations in different periods, the proportion of contrarians, , may partly help. However, even contrarians may sometimes make herd decisions due to limited information, whereas followers may make contrarian choices to gain yield by following some contrarians. Therefore, another indicator should be set to quantify the contrarian degree (CD, for short), as below.The contrarian degree of contrarian timers () is defined as the proportion of contrarian timers who make the decision that is made by most contrarian timers. The contrarian degree of followers () refers to the probability of a follower making a decision that is different from that of most followers, which is why we take the minimum value of probabilities of two different states, as . The average contrarian degree of all investors () is a weighted average of the and the . A higher contrarian degree means that reversal operations are more popular and trends are easier to be traded away; otherwise, investors are more inclined to follow the price trend or others’ behavior. We will use these indicators to compare the performance of these two types of investors.

3. Results

3.1. Data Description

As an empirical basis, we use a data set that covers 13 years of daily quotes of the CSI300 Index, from of January 2004 to the of June 2017. This period contains 3,277 daily returns, of which the main statistical properties are given in Table 3. Based on this data set, we estimate the contrarian degree of China’s stock market on a half-year basis.

3.2. Model Calibration

First, we construct a network of 1000 players, using an extended version of the Watts-Strogatz model as described in the appendix. This network keeps many stylized facts of empirical social networks, such as the high clustering coefficient and low average path length (we have also tested other network structures of different parameters, which do not change our main results). Second, the variable is determined as 1000. Assuming no significant difference in the impact of the surrounding investors’ behavior and that of stock returns on followers, it is necessary to adjust so that the first and second portions of the right side of (6) are of the same order of magnitude. Since the average log yield of the stock index is on the level, we take . The remaining variables are the energy adjustment factor, , and the amount of contrarians, ; these two parameters will be calibrated by comparing the simulated sequence and the real sequence. For clarity, we summarize the parameters used in our model in Table 2.

To identify the optimal and that maximize the objective function , Figure 2 displays the changing trend of in and R. We can see that achieves the highest value with =0.002 and =132. With this set of variables, we can reproduce the pattern and the main statistical properties of the stock data sequence. The variables are fitted to the recent market by a rolling window with the length of one year and the step of six months. The simulated sequence well approximates the real one, as shown in Figure 3. In terms of statistical indicators (Table 3), the simulated data has similar properties to the real one, and the relative error of each indicator is within 15%. Particularly, under extreme market conditions (see 5% and 95% quantile), the simulation results well reproduce the performance of the real market.

In the same way, we obtain the proportion of contrarian timers from January 2004 to June 2017 and the average contrarian degree of the market every six months (Figure 4(a)). (To be more precise, the proportion of contrarians in simulation should be understood as the proportion of stock shares traded by contrarians in the real market. According to our model, each player can only change one unit of asset in a transaction, so we have supposed a homogenous distribution of trading volume, which is not true in reality. Thus, cannot directly represent the proportion of contrarians in reality.) The proportion of contrarian timers (the grey curve in Figure 4(b)) does not change substantially, generally fluctuating between 12% and 14%, and has no obvious relationship with changes of quotes, as shown in Figure 4(a). The composition ratios of investors are stable over years. However, changes in the contrarian degree are significant. There are two periods in the given time range when the dumping of stocks is most serious and investors are extremely scared, one in 2007-2008 and the other in 2014-2015. As illustrated in Figure 4(b), both periods display significant volatility in the stock price. In 2007-2008, the global financial crisis occurred after the economic bubble burst, and in 2014-2015, an extreme bull market followed by a crash brought huge volatility. Investors tend to avoid contrarian operations in periods with great volatility, and a favorable turn could occur only when the contrarian degree reaches its rally. Investors in financial markets are rescued or reformed only in desperate circumstances. Between these two periods, the contrarian degree gradually increases from 0.382 to 0.407, and the volatility of the stock market decreases. After the second period, the contrarian degree of China’s stock market greatly improves and reaches its highest point over the period examined. Correspondingly, the stock price rises steadily relative to previous periods since 2016.

We further compare the contrarian degree of the neighboring bull and bear markets in the given period (Table 4). It shows that the contrarian degree of the bull market is often higher than that of the following bear market, which indicates that investors in the bear market are generally more emotional than those in the bull one. In the bearish market, most investors, affected by the unilateral downtrend and panic, will not consider the opportunity of reversal, but only rush to sell assets; in the bull market, investors are little bit more likely to consider the possibility of trend reversal, making the stock price more moderate than that in the bear market. For most investors who are risk-aversion, the grief of losses overwhelms the joy of profits, pushing them to sell more and contribute to greater volatility in the bear market.

As a brief summary, we reproduce the real stock sequence with the model and conclude that contrarian timers nearly account for 12-14% of the trading volume. The contrarian degree of the market changes a lot in history. Investors are more likely to take contrarian operations in a moderately fluctuated market than a unilateral-trend market. And the contrarian strategy is less welcomed in the bear market than the bull market.

3.3. Comparing Contrarians and Followers

Due to different decision-making methods, contrarians and followers have different performances. The changing trend of the return rate has two driving forces, one caused by contrarians and the other resulting from followers. Thus, we separate these two forces to observe the trading manifestation of the two groups of investors based on CSI300 Index data (Figure 5). The common behavior of contrarians is more unequivocal than that of followers, as their curve fluctuates more sharply. Contrarians make decisions more consistently than followers do under this investor construction. The sequence for the contrarians is negatively correlated with the average return rate sequence (the correlation coefficient is -0.592), whereas the sequence for followers is positively related to the average sequence (the correlation coefficient is 0.9687). Thus, the actual return rate sequence is essentially driven by followers, and the trading direction of the contrarians is often inversely related to the price changes. Since contrarians can seize the short-term reversal opportunity, whereas most followers cannot, contrarians gain substantially and followers lose money in our simulated China’s stock market in 2016 (e.g., Figure 6(a)), and the cash gap between the two groups increases as time passes. Moreover, the total amount of cash held by all investors is negative, which means that more cash flows into the stock market, so China’s stock market in 2016 shows a relatively optimistic trend.

Turning to the contrarian degree (Figure 6(b)), the is always higher than the and follows an inverse trend from that of the and . The is at its peak when the reaches its minimum. When the market is in violent oscillation, the polarization of contrarian degree between different investors is quite serious. In other words, the and are closer when the market is gentler. Contrarians are more sensitive to signals of an overheated market than followers, so opportunities for timing arbitrage will become clearer, and contrarians are more willing to take reversal operations when more followers blindly chase the trend. On the other hand, followers are less impetuous when there is no intense trend, and their ambiguous behavior confuses contrarians, in which case, the decreases while the increases, and these two groups become more similar.

We last compare the cash flows of contrarians and followers under different years and different proportions of contrarians (Figure 7). The four panels all display a polarization of the cash flow at first and then a convergence of the three curves. With an increase in number of contrarians, the cash flow situations of the two groups can converge, which indicates that a homogenous market, in which contrarians cannot be well distinguished from followers, will occur when (an empirical result). If there were a lot of followers, cash would either dump substantially into the stock market (Figures 7(a), 7(b), and 7(d)) or face a large evacuation (Figure 7(c)), whereas the inverse behavior by contrarians could alleviate the situation. As exceeds 25%, the overall market cash flow is maintained at a relatively stable position near zero. Furthermore, the trading behavior of contrarians in a high-CD market is usually the reverse of that in a low-CD market.

As a summary, the behavior of followers dominates the trend of China’s stock market prices. But a lot of profitable opportunities are in the hands of contrarians. Contrarians, who usually hold opposite cash flows compared to followers, help to drive distorted prices back to normal levels, especially in extreme markets.

4. Conclusion

In this paper, we have considered the Ising model with contrarians and followers. With the model, we have successfully reproduced the pattern of the stock sequence, based on which, the proportion of trading volume caused by contrarians in the real market has been determined.

Using data on China’s stock market, we have found that contrarians only contribute to 12-14% of trading volume in the observation period. However, the overall contrarian degree changes significantly over time. Investors are more intended to take contrarian operations in moderately turbulent markets which possess the ability of mean reversion, but less likely to consider contrarian opportunities in extreme unilateral-trend markets. Particularly, we have found that investors in the bear market are generally more emotional than in the bull one. The contrarians are conducive to alleviating the overreaction of the market and promoting the mean reversion and price discovery of the market.

Additionally, we have compared the performance of contrarians and followers and found that the greater the volatility of the market, the greater the differentiation of their contrarian degree. This is further reflected in the trend of the cash flow they hold. While the actual return rate sequence is mainly driven by followers, the contrarians hold a lot of profitable opportunities.


A. Network Construction

To build a small-world and scale-free network, we refer to Watts-Strogatz (WS) and Barabasi-Albert (BA) models [25, 26] since they are widely used in social networks. We combine algorithms of both models to construct our network. Consider nodes in a network, each of which is connected to nodes adjacent to the left and right with K nodes on each side, so that there are edges in total. Each node has the probability of reselecting other nodes to which it links, and, in total, edges change their endpoints. The probability that any node will be selected is , where is the degree of the node and is the set of the other nodes that are not included in these nodes, which is defined as and . In other words, this probability is not equal across nodes. The higher degree of the node, the more likely it is that it will be selected by other nodes. Such networks have high clustering coefficient and short average path length.

In our simulations, we set . Additionally, we have also tested other network configurations as shown in Figure 8, which do not change our main results.

B. The Critical Point

Since the Ising model itself has useful critical properties, we can also determine the critical point in our Ising-Stock model. We simulate the tendency of how changes with the number of contrarians. As Figure 9 shows, we observe a phase transition, in which the area left of is the follower-dominated phase (Phase I) and the contrarian-dominated phase (Phase II) is the area to the right. When there are few contrarians in the market, investors tend to act in concert with each other, resulting in significant differences in the sale and purchase volumes and, thus, a polarized rate of return, which is shown in the Phase I. If the number of the contrarians is larger than , then the internal energy could be high enough so that followers would prefer to make decisions more randomly rather than blindly following others, so the rate of return is closer to zero. If all of the investors are contrarians and the yield expectation is neutral, their overall action will not have a clear direction since everyone will tend to behave differently from most other investors. Therefore, a balanced situation occurs, in which nearly half of investors choose to buy the asset and the other half choose to sell it, and the average return rate of several rounds is almost zero. The “balance” here is a statistical concept, since the system of 200 players in our simulation does not represent the entire trading market, and the volumes of sales and purchases in a certain transaction are not necessarily equal, so =0 means that the average volumes of many continuous transactions are equal for both sides.

To find the exact critical number of the contrarian timers, denoted as “”, we use t-test to examine if the average value of the last 50 data points is significantly different from 0, and the test statistic iswhere is the mean value of the last 50 samples of under the given size of contrarian timers. With 95% confidence, if for 50 sample data points, then is significantly different from 0, and the value of t-test is 1. Otherwise, t-test is recorded as 0. We traverse from one contrarian player, for short, until satisfiesand, at that point, no additional values for R can satisfy this condition, so the critical point is determined as .

The critical point possesses the universality regardless of the size of the network (see Appendix C), which supports the further simulation of our model.

C. The Universality of the Critical Point

We further demonstrate the universality of the critical point in the dynamic trading system regardless of its size. The critical number of contrarian timers changes with several parameters. Here, we focus on the relationship between , , and with other fixed parameters as , , , and , where is the energy amplification factor, is the market expectation, is the relative intensity factor of daily returns, and and are parameters in the network model.

Figure 10 gives the simulation, and Table 5 is the linear fitting result. It is proven that is proportional to both and , with the scale factor being constant as .

We have found that is a constant under the given parameters, which is similar to the property of the critical temperature in the Ising model. According to the theory of mean field approximation to Ising model, there are and in the 2D square-lattice Ising model (Onsager, 1944), which means that is a specific constant independent of other variable factors, indicating that the critical point is universal [27]. In our Ising-Stock model, we treat and analogously with and , respectively. In a system with established parameters, is constant regardless of the amount of total players, revealing that the universality also exists in the critical proportion of contrarian players in the market. This proof is necessary since we need to certify that a simulated market composed of 1000 players should well reflect the characteristics of the entire CSI300 market.

D. China’s Stock Market

China’s stock market is an emerging market where individual investors are the main players. According to Shanghai Stock Exchange statistics, the institution investors only took up around 13% of the annual stock trading volume and 18% of the stock shares in average during the period 2007 to 2016 (Figure 11). Over 80% of stock transactions were initiated by retail investors.

Data Availability

The data used in our research is daily quote of CSI300 Index from 2004 to 2017. This data is publicly available from financial data websites like Yahoo Finance (https://finance.yahoo.com/quote/000300.SS/history? p=000300.SS).


Yue Chen is the first author. All the other authors are listed alphabetically.

Conflicts of Interest

The authors declare that they have no conflicts of interest.


This work is partly supported by the National Natural Science Foundation of China No. 71573051 and No. 71873039. We also thank the seminars of financial complex network in Fudan University (2014-2017).