1 Introduction

The modern and contemporary economic history provides several of evidences that are in apparent contradiction with the hypotheses of neoclassical economics [1]. As examples, we mention some of the speculative bubbles and market crushes that cannot be explained with the neoclassical theory. In 1637, the first big speculative bubble of the history erupted, the Tulip bubble, making the price of a bulb comparable with that of houses, fields and livestocks [2], while, around 1720, in the UK the overwhelming euphoria of the investors fostered the South Sea Bubble which caused substantial losses even to Isaac Newton [3]. More recently, the worldwide crises which followed the Wall Street’s crush of 1929 represents a stunning example of unpredicted and sudden market crush. The analysis of these and of more recent historical events (e.g., the 2008 financial crisis) seriously questioned the model of the homo oeconomicus and convinced the economists of the necessity of additional and interdisciplinary tools to make quantitative the novel concepts coming from behavioral economics [4, 5]. This stimulated the contributions of other disciplines, which include mathematics, physics and different branches of engineering [6,7,8,9,10,11,12,13,14].

In particular, recent interdisciplinary works attempted to connect the development of atomized behavioral models of the individual agent with that of the interaction among them [15,16,17,18,19]. Moreover, empirical evidence shows that agent behavior is influenced by the time-varying cobweb of relationships they develop [20]. A pressing open problem is to shed light on the drivers determining the evolution of the network. In the literature on social networks, a key element that shapes the topology is the perceived difference among the network agents, which depends on the way they rank themselves [21]. This is true, for instance, in the network of scientific credits [22]. Similarly, in financial markets the way agents rank their trading ability plays a key role in determining the evolution of their social relationships, as well in shaping their individual behavior [18, 23]. However, agent perception of his trading ability is often driven by psychological effects that lie outside rationality. One of the best-known effects is overconfidence [24], which is the attitude of an agent to strongly believe in his mistaken valuations. These often leads to performing overoptimistic judgments of life prospects which ultimately affect financial decisions. Overconfidence is associated with a body of related effects, which includes overplacement, that is, overestimation of one’s rank in a population. Clearly, this directly impacts on the assessment of his own trading abilities compared to those of his competing peers [25, 26] and reflects on his trading patterns: overconfident agents tend to be stubborn rather than open-minded [27].

In this paper, we extend a recently proposed evolving artificial financial market [17, 18] to model and test the effect of overconfidence. The original model elucidated the subtle interplay between agents’ behavior and the evolving dynamics of the topology describing their mutual influence. Exploiting our setting, we make one step forward compared to the existing literature and evaluate not only the direct impact of overconfidence on individual decision, but also the way this shapes the network topology.

2 Reference market model

Following [17, 18], we model the financial market as an evolving network of dynamical systems populated by a set \(\mathcal {V}=\{1,\ldots ,n\}\) of financial agents. At each trading session, an agent can decide whether investing a fraction \(\delta \) of his capital in one of the alternative financial portfolios from the finite set \(\mathcal {L}=\lbrace 1,...,m \rbrace \) or not. The mth asset is a virtual asset, corresponding to no investment, which, differently from the other (proper) investments, has unlimited availability. Every agent will chose among one of the available portfolios depending on his risk attitude \(r_{i}(k)\). In turn, the risk attitude dynamics are described by

$$\begin{aligned} {r_i}(k+1) = \left\{ {\begin{array}{*{30}{l}} \begin{aligned} {(1 - w){r_i}(0) + \frac{w}{{{\nu _i}(k)}}\sum \limits _{h = 1}^n {{a_{hi}}} (k){r_h}(k ),}&{} \quad \\ \text {if}\ \nu _i(k)>0&{} \end{aligned}\\ {}\\ {{r_i}(0)\qquad \qquad \qquad \qquad \ \ \ \text {otherwise}} \end{array}} \right. \end{aligned}$$
(1)

for \(i=1,\ldots ,n\), where \(0< w< 1\) is the interaction weight, \(r_{i}(0)\) is the innate risk attitude of agent i, \(a_{hi}(k)\) is 1 if agent i is influenced by agent h at time k, while it is zero otherwise, and \(\nu _i(k)=\sum _h a_{hi}(k)\). In general, \(a_{hi}(k)\) can be viewed as the hi-th element of a time-varying adjacency matrix A(k) describing the network of mutual influences among the agents, and \(\nu _i(k)\) the cardinality of the set of influencers (the neighbors) of agent i at time k.

At trading session k, the current risk attitude \(r_i(k)\) shapes the utility function that agent i seeks to maximize (see [17, 18] for further details), thus determining the selection of the portfolio \(\ell _i(k):= \ell _i(r_i(k))\) in which he invests a fraction \(\delta \) of his capital. According to this trading mechanism, the wealth dynamics will be then given by

$$\begin{aligned} \begin{aligned} x_{i}(k^-+1)&= x_{i}(k)+ \beta _i(k) \delta x_{i}(k)(a_{\ell _i(k)}-1)\\&\quad -(1-\beta _i(k))\delta x_{i}(k)(1-b_{\ell _i(k)}),\\ x_i(k+1)&=\tau (x_i(k^-+1)), \end{aligned} \end{aligned}$$
(2)

where \(a_{\ell _i(k)}\) and \(b_{\ell _i(k)}\) are the win and loss rates associated with the selected portfolio \(\ell _i(k)\), \(\beta _i(k)\) is a realization of a uniform Bernoulli random variable describing the output of the trade, and \(\tau \) is a function describing the taxation scheme regulating the market.

Fig. 1
figure 1

Potential driving the edge evolution with \(b=16\). The red dotted arrow corresponds to an inactive edge, while the blue solid arrow to an active one

3 Modeling overconfidence

As explained above, an agent’s trading strategy is entirely determined by his risk attitude. Therefore, in this model, the level of confidence of an agent will be identified by his resistance to learn from the risk attitude (i.e., trading strategy) of his neighbors. Equation (1) shows that an agent’s risk attitude depends on his innate attitude and on the influence that the other agents may have on him, described by the matrix A(k). Overconfidence will be modeled by selecting an appropriate law for updating A(k), which will take into account that

  1. 1.

    The interaction among the agents is selective, see [28], and therefore, agent i can be influenced by agent h only if \((h,i)\in \mathcal E_{a}\subset \mathcal {V}\times \mathcal {V}\), with \(\mathcal {E}_{a}\) being the set of admissible edges;

  2. 2.

    The update will depend on the current wealth of the agents, which is a measure that can objectively rank the agents’ trading ability;

  3. 3.

    The update cannot be instantaneous, but has to be dynamical;

  4. 4.

    The existence of an edge pointing to an agent, say i, depends not on the objective ranking of i within his neighbors, but on i’s perceived ranking.

To fulfill these four requirements, we exploit the edge snapping mechanism [18, 29, 30] and associate with each admissible edge \((i,j)\in \mathcal E_{a}\) (for all the others, \(a_{ij}(k)=0\) for all k) a state variable \(\sigma _{ij}\) that can be viewed as a mass moving in a double-well potential V, described by

$$\begin{aligned} \ddot{\sigma }_{ij}(t)+ \mu \dot{\sigma }_{ij}(t)+ \frac{\mathrm {d} V(\sigma _{ij}(t))}{\mathrm {d} \sigma _{ij}(t)}= u_i^j(t), \end{aligned}$$
(3)

where \(\mu \) is a damping parameter, \(V(\sigma _{ij}):= b(\sigma _{ij}-0.5)^2(\sigma _{ij}+0.5)^2\) is depicted in Fig. 1, and

(4)

where \(\gamma (t)=(-1)^{a_{ij}(\lfloor t \rfloor )}\) and \(c_j\) is the self-confidence of j, that is, a parameter quantifying the level of confidence of agent j in his trading abilities. Accordingly, each element of A(k) will be updated as follows:

$$\begin{aligned} a_{ij}(k)= \left\{ {\begin{array}{*{20}{l}} {1}&{} \quad {\text {if} \, (i,j)\in \mathcal {E}_{a}\, \text {and}\, \sigma _{ij}(k)>0,}\\ {0}&{} \quad \text {otherwise.} \end{array}} \right. \end{aligned}$$
(5)

To clarify how this mechanism works, for the sake of clarity, we refer to the case of an agent j not being influenced by agent i at time k (i.e., \(a_{ij}(k)=0\), \(\sigma _{ij}(k)<0\)), and having to decide whether he wants to account for agent i’s risk attitude at time \(k+1\), thus activating the edge (ij) (the case of a deactivation is specular). In this case, Eq. (4) becomes

$$\begin{aligned} u_{i}^j(t)= \max \left( 0,\dfrac{x_i(k)}{c_j}-x_j(k)\right) , \quad t\in [k,k+1[. \end{aligned}$$
(6)

Indeed, in our mechanical analogy, when the mass is closer to the first well (\(\sigma _{ij}(k)<0\)), then j is not influenced by i. To make j change his mind at the next trading session, a necessary condition is that \(u_{ij}(t)>0\), that is, he believes that i has better trading abilities than his own. This happens when \(x_i(k)/c_j>x_j(k)\). Notice that a neutrally confident agent (\(c_j=1\)) just compares his wealth with that of i, thus objectively evaluating their relative past trading abilities. Differently, an overconfident agent (i.e., \(c_j\gg 1\)) will consider being influenced by i only if agent i’s trading strategies proved to be way more successful than that of agent j (i.e., \(x_i(k)\gg x_j(k)\)). The opposite happens for underconfident agents. However, we emphasize that those are only necessary conditions for activating the edge: as the update is not instantaneous, but dynamical according to Eq. (3), the perceived difference in trading abilities has to be intense enough and persist for a sufficient time span.

4 Numerical analysis

4.1 Setup

We have considered an artificial market populated by n \(=\) 1000 agents that can choose to invest in one of three alternative portfolios. As in [17], the agents are grouped in three classes (of equal size) depending on their innate risk attitudes that are uniformly distributed in the interval [0.5, 1]. Namely, they are classified as audacious if \(r_{i0} \in [0.83,1]\), ordinary if \(r_{i0} \in [0.67,0.83)\), and prudent otherwise. The choice of the risk attitudes for the three classes is such that the prudent agents will only consider investing in the less risky portfolio, the ordinary will consider also the averagely risky portfolio, while the audacious agents will also invest in the riskiest one. Moreover, the market is regulated by a Tobin-like taxation scheme, which defines the function \(\tau \) in (2), see [17] for further details. This scheme was shown to favor prudent agents, as it reduces the wealth of the winning agents and redistributes the tax revenues to the other agents, and keeps unchanged the average wealth [17].

Within this main frame, we aimed at testing the effect of overconfidence on the overall market dynamics, with a special focus on the properties of the emerging network. In what follows, we call an agent overconfident when his self-confidence is greater than a certain threshold \(\bar{c}\). In formal terms

$$\begin{aligned} \mathcal {O}=\left\{ i: c_i>\bar{c}\right\} \end{aligned}$$

where \(\mathcal {O}\) is the set of overconfident agents. In our simulations, we set \(\bar{c}=2.5\). To test the effect of overconfidence, we selected two reference scenarios:

  1. (a)

    All the agents are neutrally confident, that is, \(c_i=1\) for all i. In this case, the agents are perfectly rational, and they rank their trading ability by only considering the output of their past investments, that is, their wealth.

  2. (b)

    The agents mildly deviate from rationality, as \(c_i\) are randomly selected from an inverse uniform distribution with median 1, where the overconfident agents represent a minority in the market.

These reference scenarios are compared with cases in which the overconfident are prevalent, as often occurs in real markets [31]. In particular, we consider

  1. c)

    An extremely overconfident market, in which all the agents are overconfident, as we selected the coefficients \(c_i\), \(i=1,\ldots ,n\), from an inverse uniform distribution with values in \([2.5,\infty )\).

  2. d)

    A prevalently overconfident market, in which, for each class of agents (audacious, ordinary, and prudent), half of the agents are selected as in scenario b) and half as in c).

In our analysis, we have run 100 simulations for each of the four scenarios, where all the agents start with the same initial wealth. Before the interaction is triggered, the agents trade without mutual influence for 1000 sessions to diversify their wealth \(x_{j}\), \(j=1,\ldots ,n\). Then, we generate the edge set \(\mathcal {E}_0\) of an Erdös and Rényi (ER) graph [32] with average degree \(d_{\mathrm {ave}}=52\). At time \(k=1001\) the snapping dynamics (3) are activated for all the pair of nodes \((i,j)\in \mathcal {E}_0\), and we let the market evolve for further 14, 000 sessions, so that a steady-state wealth distribution is achieved and that the network parameters analyzed in the following section settle.

4.2 Results

In what follows, we first investigate how overconfidence shapes the network of influence among the agents and then analyze the subsequent effect on the risk attitude and wealth of the agents.

4.2.1 How does overconfidence shape the network?

The considered scenarios differ for both the percentage of overconfident, and for the variability of the self-confidence, which could be quantified by the sample standard deviation. In what follows, we aim at elucidating how these reflect on the network properties, with a specific focus on

  • The network density, quantified by its average degree \(d_{\mathrm {ave}}\).

  • The network asymmetry that determines the directionality of the relations in the influence network, and that, following [33], we quantify through the absolute binary network asymmetry as

    $$\begin{aligned} s_b=\frac{1}{2}\frac{N+1}{N-1}\left( \frac{\left\| A-A^T \right\| _F}{\left\| A \right\| _F}\right) ^2, \end{aligned}$$

    where \(\left\| \cdot \right\| _F\) is the Frobenius norm. Notice that \(s_b\) spans from 0, that is the case of an undirected network, to 1, which corresponds to the case where there are no mutual links, i.e., the activation of edge (ij) implies the absence of (ji).

  • The network clustering, that is quantified by the average clustering coefficient C. We remind that the clustering coefficient of a node, say i, is computed as the ratio between the number of directed triangles in the graph and the total number of possible triangles that i could form;

  • Correlation between degree distribution and wealth, quantified through the computation of the correlation \(\rho (x,d_{\mathrm {o}})\) between the wealth of an agent and his out-degree.

Table 1 \(d_{\mathrm {ave}}\) is the average degree of the network; \(s_b\) is the absolute binary network asymmetry; C and \(C_r\) are the clustering coefficient of the network and of the corresponding ER graph with equivalent degree, respectively; \(\rho (x,d_{\mathrm {o}})\) is the correlation between the wealth of an agent and his out-degree, \(C_o\), \(C_m\), \(C_i\), and \(C_o\) are the number of cycle, middleman, in, and out pattern over the total number of possible triangles, respectively; \(\left| \mathcal {O}\right| /n\) and \(\left| \mathcal {U}\right| /n\) are the fraction of overconfidence and underconfident agents, respectively
Fig. 2
figure 2

Example of the four possible patterns in triangles from the perspective of node i [34]: cycle (i), middleman (ii), in (iii), and out (iv)

The effects of the different distribution of self-confidence are summarized in Table 1 and discussed below. The first immediate consequence of overconfidence is an increased sparsity of the network. Indeed, the abnormal level of self-confidence makes the agent reluctant to be influenced by their neighbors. Consistently, we observed a dramatic reduction in the average degree \(d_{\mathrm {ave}}\) as the fraction of overconfident agents increases. Indeed, when all the agents are overconfident (scenario (c)), given the pair of edges \((i,j),(j,i)\in \mathcal {E}_a\) with agent i richer than j, it clearly happens that i will decide not to be influenced by j, but also (more irrationally), agent j will often let \(a_{ij}=0\). This behavior produces a sparse network, populated by stubborn investors, but the network remains perfectly asymmetric, with \(s_b\) being equal to 1 as in the scenario (a). Consistently, we observe that the presence of bidirectional links is caused by the presence of a set of agent \(\mathcal {U}\) with an opposite behavior, that is, the underconfident, that in our simulations we define as

$$\begin{aligned} \mathcal {U}=\left\{ i: c_i<0.65\right\} . \end{aligned}$$

Underconfident agents overestimate the trading abilities of their neighbors, thus considering being influenced also by less successful investors: this leads to an increased probability of the presence of mutual links and therefore to the reduction in \(s_b\) as the fraction of underconfident increases.

As for the clustering coefficient C, we observed that, when the agents behave homogeneously, it is always of the same magnitude as the expected one in an ER random graph with the same size and expected degree. This happens in scenarios (a) and (c), where the agents are all rational or all overconfident, respectively. On the contrary, the increased heterogeneity of the agent behaviors in scenarios (b) and (d) increases the likelihood of encountering triangles of agents, see Table 1. However, the differences becomes even more relevant if we decompose the overall clustering coefficient in the four possible patterns that can be formed in directed networks, see Fig. 2. The absence of underconfident agents in scenarios (a) and (c) makes almost impossible the formation of cycles, which instead appear in (b) and are significantly higher in (d), which is the scenario characterized by the highest fraction \(\left| \mathcal {U}\right| /n\) of underconfident. Moreover, we notice that in a market dominated by overconfidence as in scenario (c), the possibility of having (at least) two outgoing edges is limited only to the richest agents that may influence those who are significantly poorer overcoming their overconfidence: consequently, this strongly reduces the fraction of out patterns \(C_o\), which are instead favored in scenarios (b) and (d), where the underconfidence of a non-negligible minority of agents increases the chances of having out patterns.

Finally, we observe the correlation between out-degree and wealth. Intuition would suggest this correlation to be higher in a rational market, where the richer are more likely to have a higher outgoing degree. Surprisingly, we observe that the \(\rho \) increases as long as the fraction of overconfident agents increases. The explanation is that in a market populated by overconfident agents, agent i may have outgoing edges only if his wealth is much higher than that of his neighbors, thus increasing the correlation between out-degree and wealth.

4.2.2 How does overconfidence impact on agent success?

The different distribution of self-confidence in the four considered scenarios shapes the network topology which, in turns, affects the way agents’ trade through Eq. (1). From [17, 18], we know that in a rational market the Tobin-like tax regulating the market favors the prudent agents that consider investing only in the less risky asset. Therefore, prudent agents have in average more outgoing links, and therefore, the average risk attitude \(\bar{r}\) settles around 0.67, see the blue line in Fig. 3, which is significantly lower than the average innate attitude of the agents, that is 0.75. An interesting effect is observed as the fraction of overconfident agents pervades the market: the average risk attitude further reduces, see Fig. 3 when all the agents are overconfident (red line) we observe the lowest settling value for \(\bar{r}(k)\). This is explained by the fact that overconfident agents are only influenced by the agents who are significantly richer than them: this means that an overconfident agent i is very likely to only imitate the trading patterns of the agents with the best strategy, and not of agents with wrong strategy, but that are temporary richer than i due to a better luck.

Now, we focus on scenario (d) to understand whether overconfidence hinders agent’s wealth. To this aim, we evaluated the average wealth for each class of agents (prudent, ordinary, and audacious) and checked whether being overconfident was an advantage or not in each class, see Fig. 4. In agreement with the findings of behavioral finance [10, 25, 26, 31], we find that an excess of confidence is detrimental when agents’ own valuations are mistaken: in this case, being open-minded can make up for wrong evaluations. On the other hand, skilled traders benefit from self-confidence, as they stand on their own correct evaluations.

Fig. 3
figure 3

Evolution of the average risk attitude \(\bar{r}(k)\) in scenario (a) (blue line), (b) (green line), (c) (red line), and (d) (magenta line)

Fig. 4
figure 4

Scenario (d). Evolution of the average risk attitude. Blue, green, and orange lines correspond to prudent, ordinary, and audacious agents, respectively, while solid and dotted lines refer to overconfident and non-overconfident agents, respectively

5 Conclusions

Overconfidence is a well-known psychological effect that biases decision making in trading. In this paper, we investigated its impact on an artificial financial market recently proposed in [17, 18], which is characterized by the coevolution of the agents’ state, in terms of risk attitude and wealth, with the network of mutual influence among them. In particular, we analyzed the way the distribution of self-confidence shapes the network topology through extensive numerical simulations. In particular, we observed that

  • Overconfidence fosters network sparsity: agents tend to become stubborn rather than open-minded, thus reducing the connections with their neighbors;

  • Networks pervaded by overconfident agents are strongly asymmetric, as underconfident (and rich) agents are crucial for the formation of mutual influence among pairs of agents;

  • A more heterogeneous distribution favors clustering. The presence of both underconfident and overconfident agents promotes the emergence of triangle motifs and, more specifically, allows for the presence of cycles;

  • A highly overconfident market is characterized by a stronger correlation between out-degree and wealth: indeed, only the richest agents are capable of influencing stubborn overconfident agents.

Also, we observed that the average risk attitude reduces as the fraction of overconfidence increases: indeed, overconfidence is accompanied by a more selective coupling which implies that most of the influence links depart from edges having the best (prudent) trading strategy. However, we numerically illustrated that overconfidence is indeed detrimental when it has the effect of sticking the agent on his own mistaken valuation.