Heterogeneous information-based artificial stock market

In this paper, an information-based artificial stock market is considered. The market is populated by heterogeneous agents that are seen as nodes of a sparsely connected graph. Agents trade a risky asset in exchange for cash. Besides the amount of cash and assets owned, each agent is characterized by a sentiment. Moreover, agents share their sentiments by means of interactions that are identified by the graph. Interactions are unidirectional and are supplied with heterogeneous weights. The agent's trading decision is based on sentiment and, consequently, the stock price process depends on the propagation of information among the interacting agents, on budget constraints and on market feedback. A central market maker (clearing house mechanism) determines the price process at the intersection of the demand and supply curves. Both closed- and open-market conditions are considered. The results point out the validity of the proposed model of information exchange among agents and are helpful for understanding the role of information in real markets. Under closed market conditions, the interaction among agents' sentiments yields a price process that reproduces the main stylized facts of real markets, e.g. the fat tails of the returns distributions and the clustering of volatility. Within open-market conditions, i.e. with an external cash inflow that results in asset price inflation, also the unitary root stylized fact is reproduced by the artificial stock market. Finally, the effects of model parameters on the properties of the artificial stock market are also addressed.


Introduction
The increasing interest in complex systems characterized by a large number of simple interacting units has led to cooperation between the fields of economics, physics, mathematics and engineering. The large availability of financial data has allowed for an improvement in knowledge of the price process, and many so-called stylized facts have been discovered, e.g., the fat tails of the returns distribution, the absence of autocorrelation of returns, the autocorrelation of volatility, the distribution of trading volumes and of intervals of trading [1]- [5].
Since the early 1990s, artificial financial markets based on interacting agents have been developed. It is worth noting that besides some early Monte Carlo simulations (e.g. [6,7]), microscopic simulations of financial markets initially aimed more at providing mechanisms for bubbles and crashes than at looking at statistical features of the generated time series. In fact, awareness of a set of statistical properties (the so-called stylized facts) only gradually appeared over the 1990s with the more precise description of the formerly relatively vague characteristics. The first artificial market has been built at the Santa Fe Institute [8]- [10]. It is characterized by heterogeneous agents with limited rationality. While early attempts at microscopic simulations of financial markets seemed to be unable to account for the ubiquitous scaling laws of returns (and were, in fact, not devised to explain them), the recent models seem to be able to explain some of the statistical properties of financial data, but in most cases the attention is focused only on one stylized fact. Generally speaking, the objective of artificial markets is to reproduce the statistical features of the price process with minimal hypotheses about the intelligence of agents [11]. Several artificial markets populated with simple agents have been developed and have been able to reproduce some stylized facts, e.g. fat tails of returns and volatility autocorrelation [12]- [17]. For a detailed review of microscopic (agentbased) models of financial markets, see [18,19].
Stochastic models, as an alternative to artificial markets, have also been proposed, e.g. diffusive models, ARCH-GARCH models, stochastic volatility models, models based on fractional processes and models based on subordinate processes [20]- [26]. In particular, studies of stock markets vulnerability by the collective behavior of a large group of agents have been proposed. This led us to consider collective behavior that could reflect herding phenomena 3 [20,27,28]. More recently, the role of heterogeneity, agents' interactions and trade frictions in stylized facts of stock market returns has also been considered [29].
In this paper, an information-based artificial stock market is proposed. The importance of our model is that for the first time we can reproduce the main univariate stylized facts of financial markets in a single framework using a simple agent trading mechanism driven by an information network. Heterogeneous agents trade a risky asset in exchange for cash depending on the interactions among agents. Indeed, a directed random graph propagates information through the agents, and trading decision is based on the agent's sentiment whose time evolution depends on the interaction among agents and on market feedback. It is worth pointing out a peculiarity of the model, i.e. all the properties are directly originated by the interacting graph that is the driving force of the model. Interactions are unidirectional, i.e. the ith agent influences the kth agent, but not necessarily vice versa. Moreover, a central market maker determines the price process at the intersection of the demand and supply curves. Both closed and open market conditions are considered.

The market microstructure
We build an agent-based artificial stock market. Three basic elements characterize the market, i.e. trading agents, a clearing mechanism and information graph. These features will be addressed in the following.

Trading agents
Let N be the number of traders. Each agent is characterized by some properties. We denote with S i (h) the sentiment, with C i (h) being the amount of cash and A i (h) the amount of assets owned by the ith trader at time h. We denote by p(h) the price of the stock at time h. At each simulation step, each trader issues an order with probability equal to 0.05, as discussed in previous papers [13,16,17]. Trade is either a buy or a sell order depending on sentiment S i (h) ∈ [−1, +1].
The limit price accompanies the sell order, where N (1, σ i ) is a random draw from a Gaussian distribution with average 1 and standard deviation σ i . The value of σ i is proportional to the historical volatility σ (T i ) of the asset price [16,17]. A time window T i is assigned to the ith trader at the beginning of the simulation through a random draw from a uniform distribution of integers in the range from 10 to 100. It is worth noting that, as for sell orders S i (h) ∈ [−1, 0), on average p s i (h + 1) < p(h).
Then, the quantity of stock to buy is calculated as The limit price associated with the buy order is where N (1, σ i ) is a random draw from a Gaussian distribution with average 1 and standard deviation σ i as in the case of sell orders (see section 2.1.1). It is worth noting that, as for buy

Clearing mechanism
The price process is determined by a central mechanism at the intersection of the demand and supply curves. We compute the two curves at the time step h + 1 as follows. Suppose that, at time h + 1, traders have issued U h+1 buy orders and V h+1 sell orders. Let the pair (a (4) and (5)) indicate, respectively, the quantity of stock to buy and the associated limit price at time h + 1. The pair (a s i , p s i ) with i = 1, . . . , V h+1 (see equations (1) and (2)) indicates the quantity of stock to sell and the associated limit price at time h + 1. It is worth noting that the total number of orders issued at time h + 1, i.e. U h+1 + V h+1 , is a fraction of the number of traders N . Indeed, as discussed in section 2.1, at time h + 1, only a random subset of the traders is active and issues orders.
Let us define the total amount of stocks that would be bought (demand curve) and sold (supply curve) at price p as The demand curve is a decreasing function of p, i.e. the bigger p, the fewer the buy orders that can be satisfied (see figure 1). If p is lower than the minimum value of p b i with i = 1, . . . , U h+1 , then d p (h + 1) is the sum of all stocks to buy. Conversely, the supply curve is an increasing step function of p. Its proprieties are symmetric to those of d p (h + 1) (see figure 1). The clearing price is the price p * at which the demand and supply curves cross, i.e. d p * (h + 1) = s p * (h + 1). We define the new market price at time step h + 1 as p(h + 1) = p * . Buy and sell orders with limit prices compatible with p * are executed. Following transactions, traders' cash and portfolio are updated. Orders that do not match the clearing price are discarded (see figure 1).

Figure 1.
The increasing function is the supply curve, the decreasing function is the demand curve. The intersection, d p * (h + 1) = s p * (h + 1), represent the new clearing price p * .

Information graph
The N traders of the market are organized according to a directed random graph, where the agents are the nodes and the branches represent the interactions among agents. The graph is responsible for the changes in the agent's sentiment. The graph is directed, that is, interactions are assumed unidirectional (i.e. the kth agent influences the ith agent but not necessarily vice versa) and characterized by a strength g ki , assumed to be a positive real number. Due to the presence of a directed graph, both an output node degree k out i , related to the output branches of a given node, and an input node degree k in i , related to the input branches, should be defined. Let us denote with I i the set of agents that influence the behavior of the ith trader. At each time step h, information is propagated through the market, and the sentiment of the ith agent is updated by whereŜ represents the influence of interacting agents, and log-return takes into account a market feedback. It is worth noting that the nonlinear function F(. . .) in equation (8), i.e.
is used to limit sentiment in the range [−1, +1]. Finally, a constraint on graph interaction is considered The agent's historical time windows range 10, 100 max(α i ) Strength of information propagation 5 ξ Self-neighboring sentiment balance coefficient 0.6 i.e. self-interaction is a counterpart of graph interactions. This assumption tries to model a specific behavior of agents. In fact, equation (12) points out that agents that are strongly influenced by their previous sentiment (e.g. big traders, bank, mutual funds, etc) are poorly influenced by the neighboring agents' sentiment (e.g. small single investors) and ξ represents the self-neighboring sentiment balance coefficient.

Market initialization
At the beginning of the simulation (i.e. h = 0), the price p(0) is set at e10.00. The number of agents is 1128. In order to determine the emergence of stable long-term aggregate behavior of the agents in the proposed heterogeneous information-based artificial stock market, two different initialization procedures, i.e. scale-free and uniform, have been considered. In the case of scale-free initialization, traders are ranked according to a Zipf law, i.e. the importance of each agent is approximately inversely proportional to its rank. All the parameters of the agents are calculated according to such a ranking. In particular, the ith trader is endowed with an amount of cash C i (0) and an amount of stocks A i (0) inversely proportional to his rank. The overall amounts of cash and stock are i C i (0) = 470 000 e and i A i (0) = 46 519, respectively. Moreover, the ith agent is randomly connected to a set of other agents whose number and strength g ik are inversely proportional to the rank of the ith agent, i.e. richer agents influence a larger number of agents with a higher strength. Consequently, the output degree distribution P out (k out ) over the nodes is set to a power law and the input degree distribution P in (k in ) results in a power law too. Moreover, the absolute strength of market feedback |δ i | is proportional to his rank, i.e. richer agents take into lesser account the market behavior. Finally, self-strength α i is positive and randomly assigned with distribution inversely proportional to the rank of the ith agent, i.e. richer agents aim to conserve their opinion, whereas the signs of strengths β i and δ i are either positive or negative with probability 0.5. Table 1 summarizes the values of the parameters adopted for the scale-free initialization. It is worth remarking that such parameters have been heuristically calibrated so as to ensure proper behavior of the artificial stock market.
In the case of uniform initialization, traders have uniform characteristics. In particular, each trader is endowed with the same amount of cash C i (0) = 10 000 e and amount of stocks A i (0) = 1000. Moreover, the ith agent is randomly connected to a set of other agents whose number is drawn from a uniform distribution. Consequently, the output degree distribution P out (k out ) over the nodes is set to a uniform law, whereas the input degree distribution P in (k in ) results in a Poisson distribution. Furthermore, the self-strength α i is positive and randomly  assigned with uniform distribution, the absolute strength of market feedback is |δ i | = χ · |β i |, where χ is a market feedback versus news factor, whereas the graph interaction strength g ik is set either to 1, if the ith agent influences the kth agent, or to 0, otherwise. Finally, the signs of strengths β i and δ i are either positive or negative with probability 0.5. Table 2 summarizes the values of the parameters adopted for the uniform initialization.

Result and discussion
Two different market conditions have been considered: the absence of external inflow of cash and the presence of an external geometric inflow of cash. In both conditions, simulations of 10 000 time steps have been performed in the case of both scale-free and uniform initialization.      Figure 2 shows the price process and the returns in closed market conditions. As clearly stated, large returns and cluster volatility are pointed out that suggest the presence of two stylized facts, i.e. fat tails and heteroscedasticity. These properties are further confirmed by figure 3 that point out the distribution of returns and correlation. Leptokurtosis is demonstrated by an asymptotic power-law decay P > (|r |) ∼ = |r | −(1+µ) , with µ = −2.93, see figure 3(a). The presence of a correlation in absolute returns together with its absence in raw returns confirms the heteroscedasticity stylized fact. Note that the memory in the absolute returns can be controlled by parameter δ i of the model, the strength of market feedback. In particular, decreasing the value of max(|δ i |) leads to a larger memory effect in absolute returns (see figure 3(b)). Furthermore, we have also considered the stability of the above discussed properties with respect to time intervals and return horizons. Tables 3 and 4 summarize the results of the Kwiatkowski-Phillips-Schmidt-Shin test (KPSS) (H 0 : stationarity), the Jarque-Bera (J-B) test (H 0 : Gaussianity) and the Engle test (H 0 : absence of ARCH effect) for returns calculated over different periods (i.e. from daily to trimestral returns) and for different time intervals (backward selected from the last simulated trading day), respectively. As clearly stated, with a 95% significance level, the returns time series do not reject the hypothesis of stationarity and  reject the hypothesis of Gaussianity in the absence of ARCH effects pointing out the stability of the above discussed proprieties. Moreover, figure 4 shows the wealth distribution of the agents in three different moments, i.e. at the beginning, after 5000 time steps and at the end. It is worth noting that the Zipf distribution appears quite stable. Finally, the artificial market exhibits a cross correlation between the absolute value of returns and the absolute changes in trading volume, whereas they appear almost uncorrelated in terms of raw data (see figure 5). Both price returns r and  changes in trading volume r v have been calculated as log-returns (see equation (10)) and these results are in close agreement with recently demonstrated stylized facts [30]. Besides the condition of the closed market, simulations in the case of an external geometric inflow of cash have been considered. In particular, an equivalent inflow of 3% per year has been assigned to each agent every 20 step (i.e. about 1 financial month) proportionally to his current cash. This directly results in an inflation mechanism. Figure 6 shows the price process and the returns in open market conditions. As clearly stated, time evolution suggests the presence of three stylized facts, i.e. with respect to closed market conditions it includes also the possibility of an I(1) price process. This property has been verified through the ADF test with a 10% critical value. Furthermore, figure 7 points out leptokurtosis (i.e. an asymptotic power law with µ = −3.57) and heteroscedasticity in the distribution of returns. Moreover, we have also studied the stability of the properties in open market conditions with respect to time intervals and return horizons. Tables 5 and 6 summarize the results for the KPSS, J-B and Engle tests at 95% of significance level and lead to the same conclusion discussed for the closed market condition.
Furthermore, figure 8 shows the wealth distribution of the agents in three different moments, i.e. at the beginning, after 5000 time steps and at the end. It is worth noting that, stated the inflation in the marker, the Zipf distribution appears quite stable also in the case of the inflation market.
Computational experiments pointed out price processes that reproduce the stylized facts as described for the case of scale-free initialization, i.e. fat tails, heteroscedasticity and large price fluctuations in the presence of small order flows. Furthermore, the presence of an external geometric inflow of cash allows the possibility of an I(1) price process. Corresponding figures are not included for the sake of compactness. Conversely, the distribution of wealth is particularly interesting. Figure 9(a) and (b) show the wealth distribution of the agents in three different moments, i.e. at the beginning, after 5000 time steps and at the end of the simulation, for the case of closed and open-market conditions, respectively. Irrespective of the market conditions, starting from an externally ab initio fixed uniform distribution, the distribution of wealth converges to a scale-free law. Consequently, this allows one to conclude that a scale-free (e.g. Zipf) distribution appears quite stable and attractive.

Conclusions
In this paper, an information-based artificial stock market has been presented where heterogeneous agents trade a risky asset in exchange for cash. Besides the amount of cash and the amount of assets owned by each agent, they are characterized by a sentiment. The agents, seen as the nodes of a sparsely connected graph, share their sentiment with other interacting agents. The trading decisions are based on the value of the sentiment, whereas the price of the asset at each trading day is fixed by a clearing house mechanism. The interaction between the agent sentiments, during the simulation, yields a price process that reproduces many stylized facts of real markets, such as unitary root of the price process in open market conditions, clustering of volatility, and fat tails of returns distributions. The results pointed out the validity of the proposed model of information exchange among agents, which is able to reproduce the main univariate stylized facts of financial markets in a single framework. Moreover, the presence of a directed random graph was helpful in understanding the role of information in real markets and the effects on wealth distribution of agents characterized by stable and attractive scale-free properties.