## Abstract

We consider a standard heterogeneous agent model (HAM) that is widely used to analyze price developments in financial markets. The model is linear in log-prices and, in its basic setting, populated by fundamentalists and chartists. As the number of fundamentalists increases and exceeds a specific threshold, oscillations occur whose amplitude might even grow exponentially over time. From an economic perspective to adequately interpret such instability results it is indispensable to ensure that the characteristics and specific building blocks of the HAM are not at odds with the underlying structure of financial markets, in particular the specific trading rules. We expect that in markets with (almost) only fundamentalist traders prices might in the most extreme case oscillate, but never explode. In addition, if limit orders are available, prices should converge monotonically. Finally, if price bubbles occur in financial markets with fundamentalist traders, they should only result from the interactions between fundamentalists and the other traders, e.g., chartists, but not from fundamentalists’ decisions alone. From a mathematical perspective we show that the instability result common to the standard approach can be related to a “hidden” explicit discretization of a stiff ordinary differential equation contained in the model. Replacing this explicit discretization by an implicit one improves the model as it removes this artifact, bringing the model’s prediction in line with standard theory. The refined model still allows for price overshoots, bubbles, and crashes. However, in the implicit model these instabilities are caused by chartists and not by an unintended artifact.

## 1 Introduction

In the last three decades, heterogeneous agent models (HAMs) have proven to be a very productive approach to analyze financial markets. Models of heterogeneous agents augmented by simple heuristic trading strategies are particularly suited to capture important financial market features such as technical trading, herding, overshooting prices, and bubbles. They are also well apt to replicate important stylized facts such as fat tales in return distributions, volatility clustering, and long-term memory. LeBaron (2006), Lux (2008), Chiarella et al. (2009), Dieci and He (2018), Iori and Porter (2018), Napoletano et al. (2018), and Zhang (2018), among others, survey this burgeoning field of research.

Financial HAMs typically share several basic features that have already been present in the seminal papers by Day and Huang (1990) and Huang and Day (1993) (see also Beja & Goldman, 1980). Chief among them are (1) markets that are cleared by a market maker. In detail, the market maker clears the market in the current period and sets the next period’s asset price with respect to the current excess demand. As this excess or net demand is given by the difference between the aggregated demand and supply of all traders, the HAM approach treats supply and demand symmetrically. (2) Fundamentalists bet on a reduction in the current mispricing of assets, i.e., they buy when assets are undervalued and sell when they are overvalued relative to their fundamental value. (3) There may be other types of (heterogeneous) agents, for example, those who trade on simple heuristic strategies that attempt to extract buying and selling signals from past price movements, e.g., momentum trading by chartists who buy when prices rise and sell when they fall.

Applying these three elements to a market with fundamentalists and (e.g., trend following) chartists, asset price movements can in general be described by an explicit difference equation of the type

with the asset’s log-price *p*, fundamentalists’ weight in the market \(w_F\), chartists’ weight \(w_C\), and log-fundamental-value *f*. The term “\(p(t)+w_F(f-p(t))\)” describes the behavior of fundamentalist traders and is—to our knowledge—present in all HAMs featuring fundamentalist traders. As we discuss subsequently, this part of the equation is especially important from a modeling perspective for the dynamics and stability of price movements.

In analyzing HAMs with their focus on aggregate market behavior it is indispensable to make sure that the characteristics and specific building blocks of these models are not at odds with the underlying structure of financial markets, in particular the specific trading rules. More specifically, we firstly expect that in markets with (almost) only fundamentalist traders prices might in the most extreme case oscillate, however, price paths should never explode. Secondly, if price bubbles do occur in financial markets with fundamentalist traders they should only result from the interactions between fundamentalists and the other traders, e.g., chartists, but not from fundamentalists’ decisions alone. Finally, in markets in which (almost) only fundamentalists trade and limit orders are available, prices should converge monotonically to their fundamentals. In such markets, buy order limits are equal or below fundamental values and sell order limits are at or above the fundamental values. As orders are executed successively, prices do not fluctuate but converge to their fundamental values. Taken together economic intuition would imply non-exploding, possibly oscillating price movements in markets that are dominated by fundamentalists. If in addition limit orders are available, prices should converge monotonically to their fundamental values, i.e., oscillating price movements can be ruled out.

Against this background, a closer inspection of the pricing Eq. (1) reveals potentially important problems as quite counterintuitive price developments might occur in such markets. For example, in a market with many fundamentalists and only a few chartists, prices might oscillate, even with an exploding amplitude (see Fig. 1 and for the limiting case of a market with fundamentalists only Fig. 2e). Technically, such an instability can occur if fundamentalists react very strongly to mispricing while at the same time, the market maker adjusts prices aggressively to the resulting excess demand. Please note that fundamentalists in this situation still buy at prices below and sell at prices above the fundamental value, as prices overshoot only in the subsequent period.

Obviously, such exploding price movements should be ruled out as they are at odds with financial markets that are dominated by fundamentalists (let alone in the case of fundamentalists only, see Fig. 2e). In addition, if we want to account for limit orders as a ubiquitous feature of today’s financial markets we should also exclude model specifications that allow for oscillating prices in markets with (almost) only fundamentalist traders. From an economic perspective such instabilities are likely to be artifacts.

In a more general setting, we obviously do not want to rule out per se oscillating and destabilizing price developments in financial markets. It can and should be possible that decisions by fundamentalists contribute to market instabilities, even if their intention is to drive prices back to their fundamentals (De Long et al., 1990a, b; Westerhoff & Reitz, 2003; Naimzada & Ricchiuti, 2008; Szafarz, 2012; Baumann et al., 2020). However, this should only be viable if caused by the complex interactions between fundamentalists and other types of traders. In contrast, prices should converge to their fundamental value in a market in which (almost) only fundamentalists trade. Taken together we follow the modeling paradigm that in case there are no other traders in the market, fundamentalists’ actions should not yield unstable dynamics. If, however, there are also other types of traders in the market, such destabilizing effects can result from dynamical effects caused by the complexity of their interactions.

The discrepancy between the economic intuition of price convergence under limit orders and (almost) only fundamentalists in the market on the one side and the simulation results in Figs. 1 and 2e on the other side are akin to effects that occur when a stiff differential equation is discretized using an explicit numerical scheme. Such effects appear, for instance, in reaction kinetics, see the work of Shampine and Gear (1979) and the references therein. Just as for HAMs, the models used in reaction kinetics describe the aggregate behavior of species—in this case in a chemical reaction—rather than the underlying molecular mechanisms. As in our simulations, spurious oscillations and instability artifacts can occur when the underlying differential equation becomes stiff due to a specific parameter selection. This similarity is not a coincidence: as we discuss in greater detail subsequently, the term describing the price influence of the fundamentalists in the HAM is precisely in the form of an explicit Euler discretization. Since in chemical reaction kinetics (as well as in many other branches of science and engineering) using implicit discretizations is a well-known remedy to avoid these artifacts in case the underlying equation is stiff, it seems straightforward to explore the same technique for HAMs.

When observing and interpreting overshooting prices and market instabilities in conventional HAMs, it is therefore not clear to which extent they are due to dynamic interactions of traders, which give rise to unstable dynamics, and to which extent they are mere artifacts due to the specific form of modeling. Such a situation is obviously very unsatisfactory, not the least, as it might not only lead to a misinterpretation of simulation results but also misguided policy recommendations. Accordingly, we propose in the following to use implicit discretizations as a means to purge HAM simulation analysis from spurious oscillations and instability artifacts. Thereby we hope to strengthen the role of this important class of models as a very productive tool in the study of financial markets. We note that the explicit model may have its merits if particular trading mechanisms are to be modeled. However, for today’s markets in which limit orders are widely available and used, the implicit model we propose appears much more appropriate, as we will explain in more detail in Sect. 3, below.

Generally, there is a whole variety of pricing models, e.g., equilibrium models, the cobweb model (discussed next), and agent-based models, all of which have their own advantages and disadvantages, and which should be selected primarily according to the research goal. If, for example, someone is interested in equilibrium prices only, an HAM may be inappropriate. In contrast, HAMs have a comparative advantage if price dynamics are in disequilibria such as when bubbles and crashes or inefficient markets are to be analyzed.

It is worth noting that there seems to be an interesting parallel between our HAM [Eq. (1)] and the well-known cobweb model.^{Footnote 1} In the case of fundamentalists only (i.e., \(w_C=0\)), excess demand in the market is given by \(D=const\cdot (f-p(t))\) for some positive constant. When the asset is considered to be undervalued, excess demand by all traders except the market maker is positive, i.e., \(D>0\), and if it is considered to be overvalued, net demand is negative, i.e., \(D<0\). Based on this net demand the market maker not only sets the price for the next period \(p(t+1)=p(t)+w_F(f-p(t))\) but also has to clear the market in this period. The market maker supplies *D* in the first case of undervaluation, and demands *D* in the second case of overvaluation. Thus, one might guess that due to the specific supply and demand curves of the traders (i.e. the fundamentalists) and the market maker, different, i.e. stable and unstable market dynamics are possible—a situation seemingly similar to the case in the cobweb model. Yet, in cobweb models price developments in goods markets are driven by suppliers and demanders that react with a lag to each others’ actions and the subsequent price movements so that prices might explode in an oscillating fashion depending on the price elasticities of supply and demand. However, the HAM described above (and in more detail in Sect. 2) differs fundamentally from the cobweb approach. In this HAM, there is no time delay (resp. lag) as the market maker clears the market immediately. This implies that in the subsequent period all market participants can take supply and demand decisions which are in addition based on the same price, set by the market maker. In contrast, as discussed above, in the cobweb approach in each period only one side of the market can take a decision and then a new price results. In the subsequent period the other market side takes its decision based on this new price. Further, in contrast to goods markets, on financial markets limit orders are available that rule out oscillating prices in the “fundamentalists only” case.

We note that the question whether the model should exhibit a lag between the agents’ decisions depends on the specific market under consideration. As it is generally the case, there are no true or false models per se. Rather, models are adequate or inadequate for specific applications. For instance, when analyzing goods markets where demanders and, in particular, suppliers can only react with some delay to price developments, a cobweb-type market model may be adequate. However, as mentioned above, in this paper we want to model financial markets and their price behavior (esp. for markets with limit orders), in which an abundance of fundamentalists does not destabilize the prizes. For this reason, a market maker model is the model of choice. For future work, a detailed investigation of similarities and differences of our HAM and cobweb models is likely to be fruitful.

This research of financial markets builds on the basic model of Day and Huang (1990), particularly, in principle, on Eqs. (2), (5), (6), and (7) of Day and Huang (1990), which can be subsumed under Eq. (1) of the work at hand, see also Huang and Day (1993), Beja and Goldman (1980), Tramontana et al. (2013). Three main fields of research have emerged over time, namely the analysis of the (in)stability of market equilibria, the interactions between different heterogeneous traders, and the calibration of market models using real-world data to replicate stylized facts.

Day and Huang (1990) as well as Huang and Day (1993) use their market model of excess demand and price adjustment to study the (in)stability of equilibria. A number of authors, e.g. Dieci and Westerhoff (2010), Tramontana et al. (2009), Tramontana et al. (2010), and Schmitt and Westerhoff (2014) have generalized this approach to account for the spillover effects on other asset markets. The interaction of heterogeneous agents is at the center of Brock and Hommes (1998) and Hommes and Wagener (2009) who analyze how different traders, e.g., trend chasers, contrarians, or fundamentalists, mutually influence each other when the model allows for evolutionary dynamics. They study the effects on the asset price dynamics and conclude that particularly when the intensity for switching the strategy is high, chaotic price movements may appear (Brock & Hommes, 1998) and that trend following can have destabilizing effects possibly leading to price bubbles (Hommes & Wagener, 2009). In a more general setting Beja and Goldman (1980) analyze how the behavior of brokers and designated specialists affects the speed of price adjustments to changing conditions and find, e.g., that the existence of limit orders gives rise to price discrepancies affecting stock price dynamics.

More recently, researchers have analyzed to what degree HAMs are able to replicate important stylized facts of financial markets. Schmitt and Westerhoff (2021) consider a market with a market maker and several trader types whereby the calibration of the model is conducted via trial-and-error. Franke and Westerhoff (2016) use a herding model related to Lux (1995) to represent the switching between fundamentalist and chartist trading strategies and estimate the model parameters by a method of simulated moments. Platt (2020) provides an extensive comparison of different model calibration techniques.

As all of these important contributions to the analysis of (financial) markets make use of explicit price equations, especially when modeling fundamentalists’ strategies, they might be subject to so-called instability artifacts. The findings should therefore be checked for such spurious instabilities. The subsequent economic analyses can then focus on the substantive cases of instabilities due to the interactions of agents and possible overreactions in their behavior. Interestingly, Kukacka and Kristoufek (2020) make an analogous observation by building on a different approach, namely the analysis of the multifractal properties of agent-based models.

We contribute to the literature by addressing the issue of the explicit discretization, which is omnipresent in the HAM literature and has so far not been analyzed adequately. Based on both simulations and calculations we show how counterintuitive asset price behavior can occur, such as explosive price developments even in financial markets that are solely populated by fundamentalists. We relate some market instabilities to the observation that the price equation in a standard HAM can be interpreted as the explicit discretization of a stiff ordinary differential equation. We propose an implicit discretization as a way to better control for the underlying assumptions used in financial HAMs. This approach allows to account for a stabilizing role of fundamentalists and effects of limit orders, a central feature of today’s financial markets. Under such a modeling approach we can be sure that the observed market instabilities are indeed driven by complex economic interactions—and in particular that they are not mere artifacts that can arise in the approach used so far in the literature on HAMs. At the same time, we can make sure that the parameter space of the HAM is not unduly constrained and, thus, biased economic results and policy recommendations be avoided. In a complementary simulation, we generalize our analysis and compare the effects of the explicit and implicit discretization in a more complex financial market setup.

The remainder of the paper is organized as follows. Section 2 describes a standard HAM and provides evidence for instabilities in a financial market in which (almost) only fundamentalists trade. This ostensibly destabilizing role of fundamentalists is related to the explicit discretization of a stiff ordinary differential equation subsequently. Section 3 proposes the implict discretization as a remedy for the oscillatory instabilities and gives an economic interpretation to this seemingly technical procedure. Inspired by the cited literature, the simulation studies in Sects. 4 and 5 augment the standard model to include the evolutionary development of the different trader types and compare the consequences of the two ways of discretization in a more general framework. Section 6 concludes.

## 2 Standard Market Model and Instability Artifacts

A well-established approach to analyze important features of financial markets like bubbles and crashes is to build on market maker models with heterogeneous agents, typically fundamentalists *F* and chartists *C*. In such a framework asset prices depend on the aggregated excess demand of fundamentalists and chartists. Fundamentalists buy when assets are undervalued and sell when they are overvalued, while trend following chartists buy when prices rise and sell when they fall. More specifically and following the basic HAM approach going back to Day and Huang (1990) and Huang and Day (1993) (see also Beja & Goldman, 1980), the log-price *p*(*t*) of an asset is assumed to be linear in the excess demand of the agents, i.e.,

where \(D_F\) resp. \(D_C\) is the excess demand of a typical fundamentalist resp. chartist and \(N_F\) resp. \(N_C\) denotes the respective number of traders. With \(M>0\) we denote a scaling parameter, which can be used to adjust, e.g., the trading volume and market power of all traders. The (excess) demand function of the fundamentalists is assumed to be linear in the deviation of the log-price from the log-fundamental *f*(*t*), i.e.,

(with \(F>0\)), see Day and Huang (1990), Westerhoff and Reitz (2005), He and Westerhoff (2005), while the (excess) demand function of the chartists is assumed to be linear in the trend of the log-price, i.e.,

(with \(C\in {\mathbb {R}}\)). As fundamentalists and chartists are the two types of traders who drive most stylized facts in financial markets, they are at the focus of most of the literature. We follow this approach in the analytical part of the paper. In Sect. 4 we subsequently generalize our analysis and introduce additional types of traders in our simulation study. Note that the assumptions on the parameters are natural: Prices and fundamentals are strictly positive and the numbers of traders are non-negative. Since fundamentalists buy when assets are overvalued and sell when assets are undervalued, *F* should not be negative. The value of *C* determines whether the chartists are trend followers \(C>0\) or anti trend followers \(C<0\). The scaling parameter *M* has to be positive for the reason of mathematical soundness of the model. Last, the assumption that the log-price is linear in the accumulated excess demand is related to the geometric Brownian motion, see Baumann (2015). Note that a direct quantitative interpretation (i.e. without model calibration) is rather hard, see, e.g., Day and Huang (1990) and Huang and Day (1993).

While the basic model of Eqs. (2), (3), and (4) is able to replicate a number of stylized facts such as excess volatility, mean reversion, and high trading volume, it also exhibits important deficiencies. Notably, it implies a counterintuitive instability behavior. Since fundamentalists buy when assets are undervalued and sell when they are overvalued, these traders are associated with a market stabilizing behavior. Yet, as we show, the standard model becomes unstable when there are “too many” fundamentalists. One might argue that the individual fundamentalists do not coordinate their actions and therefore, prices might overshoot. However, in the basic model—even with only fundamentalists present—prices may not only overshoot and oscillate but this could happen with an exploding amplitude.

In a general market setting prices might overshoot in a market with (almost) only fundamentalists if they react very strongly to mispricing while at the same time, the market maker adjusts prices aggressively to the resulting excess demand. However, when we account for limit orders such oscillating price behavior is no longer feasible. Limit orders as they are common in today’s financial markets allow to set a maximum/minimum price in advance. As fundamentalists base their trading strategy on the (expected) fundamental value \(\phi (t)=exp(f(t))\), they have no reason to place a general market order. Instead, they set, e.g., a buy limit order with fundamental value \(\phi (t)\) as the maximum price if \(\phi (t)>\rho (t)\), with asset price \(\rho (t)=exp(p(t))\), and a sell limit order with \(\phi (t)\) as the minimum price if \(\phi (t)<\rho (t)\). It follows that with only fundamentalists trading, asset prices should not overshoot. Such overshootings are only caused by chartists or by the interaction of chartists and fundamentalists. As we show subsequently, models such as (2), (3), (4) do not adequately account for such stabilizing effects by fundamentalists.

To concentrate on the key issues, we consider a simple example of the standard model class in this section, noting that our approach easily carries over to more complex models (as we show subsequently in Sect. 4). We assume log-fundamentals and the number of traders, namely fundamentalists and chartists, to be constant and introduce weights of the respective types of traders, i.e., \(w_F=N_FF/M\) and \(w_C=N_CC/M\). This leads to the following recurrence relation or difference equation for log-prices:

This is Eq. (1) mentioned in the introduction. Obviously, \(p^*=f\) is an equilibrium of the model. Figure 2 depicts the vast spectrum of price dynamics that are generated by this so-called explicit model under the parameters \(f=10\), \(p(0)=0\), and varying weights \((w_F,w_C)=(0.2,0)\), (1, 0), (1.8, 0), (2, 0), (2.05, 0), and (1.8, 0.8).

It is evident from Fig. 2e that even when there are no chartists, i.e., \(w_C=0\), \(p^*=f\) is unstable if \(w_F>2\). Note that the difference equation describing the evolution of *p* is simply

when in addition to \(w_C=0\) we set \(f=1\). For this case the solution is

Of course, in real world markets, it cannot be excluded per se that asset prices jump beyond their fundamental value during the short-term adjustment to a shock. However, if only fundamentalists are present, such a price behavior would seem to be counterintuitive, in the short as well as the long run, not the least due to limit orders. Instead, prices should end up in a neighborhood of their fundamental values. We, therefore, conclude that most likely, the model exhibits instability artifacts.

Of course one can argue that the case \(w_C=0\) does not fit to our intention of the paper since we are interested in heterogeneous agent models and fundamentalists only are not heterogeneous. However, this is just an easy-to-understand simplification for illustrating the instability artifact in this model. As we will see next, exactly the same behavior occurs for \(w_C\ne 0\) when \(w_F\) is increased. To show this we complement our simulations with analytical results. It is convenient to rewrite the second-order Eq. (1) as a first-order equation in two dimensions:

The eigenvalues of the transition matrix are

This allows us to calculate the values of \((w_F,w_C)\in {\mathbb {R}}^+\times {\mathbb {R}}\) for which \(p^*=f\) is stable. Figure 3 shows the region where the model is stable (more precisely, the figure shows the maximum of \(|\lambda _{1,2}|\) depending on \(w_C\) and \(w_F\); the model is asymptotically stable when this maximum is smaller than one). With that, it is possible to determine the threshold of the fundamentalists-to-chartists ratio for which the market model becomes unstable. As previously mentioned, we see that the equilibrium becomes unstable when there are too many fundamentalists, both for \(w_C=0\) and for non-zero values of \(w_C\). Of course, the interaction of fundamentalists and chartists has an effect on stability—which can be seen from the fact that in Fig. 3 the boundary between the stable and the unstable range depends on \(w_C\). Nevertheless, we conclude that it is not exclusively this interaction that makes the system unstable, but also the increasing number of fundamentalists. More precisely, the figure shows that for each fixed number \(w_C\) of chartists with \(-1<w_C<1\) there is a threshold for the number of fundamentalists such that the model becomes unstable if the number \(w_F\) of fundamentalists is larger than this threshold. Thus, for any \(-1<w_C<1\) the qualitative behavior concerning stability is just as in the case \(w_C=0\) (note that the boundary in Fig. 3 in the point \((w_F,w_C)=(0,2)\) is sort of smooth). This is the reason why the behavior of the simplified model for \(w_C=0\) gives valuable insight into the behavior of the full model.

Figure 3 also illustrates some of the limitations of the explicit model. Given, e.g., a market with fundamentalist traders only, i.e. \({w_C}=0\), we can directly conclude from Eq. (1) that price movements are exploding for \({w_F}>2\). Accordingly, we would have to restrict the weight of fundamentalist traders to \(w_F \le 2\) to ensure non-explosive prices and to further restrict it to \(w_F\le 1\) to avoid oscillating price movements as is to be expected in the case of limit orders (see Fig. 2 for a visualization of different parameter configurations.) While such restrictions on \(w_F\) would at first sight align the price movements with basic economic intuition it would at the same time place unduly restrictions on the model. In detail, it would not be possible to analyze the interesting case that for values \(2<w_F<4\) stable price developments can be observed if there are “enough” seemingly destabilizing chartists in the market, see Fig. 4a. At this point it is interesting to note that starting from an initial situation with only fundamentalist traders and monotone price movements, i.e. \(0< w_F<1\) and \(w_C=0\), the market entry of chartists and the subsequent interactions with the fundamentalists can change the price adjustment process to one of oscillating asymptotic stability, see Fig. 4b. In contrast to the stability case, where the “seemingly” destabilizing chartists \(w_C>0\) increase the region of stability, the region of monotonic price convergence becomes smaller when \(w_C>0\), see Fig. 5 (and cf. Fig. 4).

So a seemingly straightforward way to restrict parameter \(w_F\) to generate price movements more aligned to economic intuition and modern market structures might not be adequate. By unduly restricting the parameter space, the model might generate biased outcomes. In particular, very interesting results on the stabilizing interactions between fundamentalist and chartist trading strategies might be omitted, and false policy conclusions might be taken.

Our motivation to study this model is to find out how the interaction between fundamentalists and chartists creates instability. However, in a model that contains instability artifacts, when the market becomes unstable it is not clear whether this is due to a too large number of chartists or whether this is due to the model structure itself. As a consequence, results from stability analyses of such models have to be analyzed more closely and, more generally, the adequacy of such a modeling approach has to be scrutinized. This leads us to the question how to adequately model heterogeneous agents and avoid such structural artifacts.

The key to answer this question is the observation that model (1) has the same form as an explicit Euler discretization

of a stiff ordinary differential equation (stiff ODE)

see, e.g., Deuflhard and Bornemann (2012), Chapter 6, or Wanner and Hairer (1996). Such a discretization is known to cause exactly the effects visible in Fig. 2, cf. Deuflhard and Bornemann (2012), Figure 6.3.

When setting \(w_C=0\) in Eq. (1) we obtain

with \(g(t,p(t))=w_F(f-p(t))\). This is exactly the explicit Euler discretization of the ODE

with step size \(h=1\).

## 3 Implicit Discretization

A well-known remedy to account for the oscillatory instability of stiff ODEs is to use an implicit discretization. Such an approach—avoiding oscillations by replacing the explicit discretization by an implicit one—is common in engineering sciences, mathematics, and physics, see, e.g., Deuflhard and Bornemann (2012), Wanner and Hairer (1996). This approach is most easily explained for linear differential equations of the form \(\dot{x} = Ax\) for a matrix \(A\in {\mathbb {R}}^{n\times n}\) with equilibrium \(x^*=0\). If the matrix has a negative real eigenvalue \(\lambda <0\) and large modulus \(|\lambda |\), then the corresponding solution component moves towards \(x^*\) very rapidly, but this fast motion slows down immediately when the solution component is close to \(x^*\). This is a typical example for a stiff equation. An explicit discretization scheme now reproduces this fast motion correctly, but if the chosen time step is larger than the time until \(x^*\) is reached, then the solution keeps on moving and overshoots \(x^*\). In the next time step the same overshooting behavior occurs into the opposite direction, which leads to the typical oscillating behavior that can be seen in Fig. 2c–e. An implicit discretization scheme, in turn, does not reproduce the fast motion the exact solution has at the beginning but rather it reproduces the average motion over the whole time step. This way in each time step the solution runs strictly monotonously towards \(x^*\), rather than overshooting the equilibrium. Instead of using an implicit scheme, one may also use an explicit scheme with a time step that is so small that the computation time ends before the overshooting has occurred. This, however, may require very small time steps, which makes the explicit computation highly inefficient. This is precisely the situation in which the implicit scheme is preferred, because it reproduces the correct behavior independent of the choice of the time step.

In terms of our model, the equilibrium is the fundamental price *f* the fundamentalists consider adequate. If the price of the asset is higher than *f* at the beginning of the time step, in an explicit model the fundamentalists keep selling their shares until the end of the time step is reached, even if the market price is already well below the fundamental price *f* they consider adequate. In an implicit model, they only sell so much shares that the fundamental price *f* is approximately reached at the end of the time step, as we will see in the discussion after Eq. (7), below. In terms of modeling the trading behavior, this corresponds to fundamentalist traders who either withdraw their selling order once the price has fallen too much, or who place limit orders. In both cases, the key difference between the explicit and the implicit model is how the execution of the trading within one time step is modeled. Whether one considers a model that does not reflect those mechanisms as adequate or as a model containing artifacts is in the end a modeling question. In this paper we follow the point of view that, given the ubiquitous availability of limit orders on today’s financial markets, the implicit model better reflects the rationale behind the fundamentalist traders’ strategy and is thus the more appropriate way of reproducing the real market behavior.

There is, however, a fundamental difference between engineering and physics on the one side and HAMs and, more generally, economics on the other side: In physics, for example, the underlying mechanisms are typically modeled via differential equations. The solutions of these equations have to be simulated and, thus, a discretization is necessary. The task is then to choose the right method for this discretization, such that the simulated behavior is close to the real behavior of the underlying differential equation. In our case, the financial market decisions are already modeled in discrete time, i.e., per se, there is no need to discretize and accordingly, there is no such thing as a wrong discretization technique. Still, there are different ways to model market behavior in discrete time and, as shown above, the discrete-time model (1) implies some counterintuitive behavior, which is in stark contrast to real market mechanisms (cf. limit orders). Interpreting the discrete-time model as an explicit Euler discretization provides a systematic way for obtaining a discrete-time model that avoids this behavior, by applying the following steps: (i) find a differential equation such that the initial discrete-time model is an explicit discretization of this differential equation and (ii) calculate the implicit discretization of this continuous-time model.

Regarding (i), when starting with a discrete time model that can be written as \(p(t+h)=p(t)+hg(t,p(t))\) with step size \(h>0\), the corresponding differential equation is \(\dot{p}(t)=g(t,p(t))\), when we assume the initial model to be an explicit discretization of a continuous time model. Regarding (ii), the corresponding implicit disrectization is \(p(t+h)=p(t)+hg(t,p(t+h))\), which has to be solved for \(p(t+h)\). Note that this procedure is only possible when the initial model can be rewritten in the mentioned way, which might not be the case, e.g., when in our model \(w_C\ne 0\) holds.

We emphasize that with this approach we do not mean to imply that the differential equation is the “true” model and the discrete time model is its “approximation.” Yet, we may use this procedure as a convenient way to arrive at an alternative discrete-time model that does not exhibit the instability artifacts we described above. At the same time, we can use the well-known differences of the behavior of explicit and implicit discretization schemes for an economic interpretation of the respective models, which is given subsequently. In the remainder of this section, we show how to apply this procedure and study the properties of the resulting model.

The differential equation for which our original recurrence relation is an explicit discretization is given in Eq. (5). As an implicit version, we use an implicit Euler discretization with step size \(h>0\), leading to

i.e., \(p(t+h)=\frac{p(t)+hw_Ff}{1+hw_F}\). To this equation we add the demand of the chartists from Eq. (1) (adjusted for \(h>0\)). Thus, we have

In case of \(h=1\) this is

We note that there is no reason to use an implicit discretization also for the chartists as we could not observe any artificial instabilities caused by this part of the model. In fact, using an implicit discretization for the chartists would be difficult, since the update rule cannot be interpreted as a discretization of an ordinary differential equation, at all. Due to the dependence of the chartist dynamics on past prices, one would have to resort to so-called delay differential equations for this task. This is a technically quite involved procedure, which is unnecessary because of the lack of stiffness of this part of the model. We note that discretization methods that discretize only parts of an equation implicitly are also used in numerical analysis, see, e.g., the linearly implicit schemes described by Wanner and Hairer (1996). Whether and to what extent the approach presented here, i.e., interpreting a discrete-time model as an explicit discretization of a continuous-time model and using an implicit discretization of this model as a new discrete-time model, is generalizable to other models or model classes, is not easy to answer and certainly a very fruitful question for future work. However, one can see already from the example of the chartists in this model that the approach presented here is not universally applicable, since the corresponding continuous-time model would be a delay differential equation.

Implicit discretization is used in other fields of economics, see, e.g., a recent version of Nordhaus’ Dynamic Integrated model of Climate and Economy, DICE (see, e.g., Nordhaus, 2017) and his 2018 Nobel Prize lecture (see Kellett et al. 2019, Footnote 4). However, Nordhaus (2017) does not elaborate on the choice of this type of discretization. Also in the DICE model, implicit and explicit discretization schemes are mixed. This is, as mentioned above, a common approach.

When reconsidering the explicit pricing rule (2) resp. (1), we can interpret the next period’s log-price in a straightforward way as a function of the current log-price and a share of the excess demand of all traders, where the demand of the fundamentalists depends on the difference between the market price and the fundamental value. That is exactly how the model was constructed in the first place. In contrast, a first look at the implicit pricing rule for \(h=1\), i.e. Eq. (7), does not yield such a straightforward interpretation. However, when rewriting Eq. (7) as

a new intuitive interpretation suggests itself. Note that \(\lim _{w_F\rightarrow 0}\frac{1}{1+w_F}=1\), \(\lim _{w_F\rightarrow \infty }\) \(\frac{1}{1+w_F}=0\), \(\lim _{w_F\rightarrow 0}\frac{w_F}{1+w_F}=0\), and \(\lim _{w_F\rightarrow \infty }\frac{w_F}{1+w_F}=1\). Next period’s log-price is a convex combination of the log-fundamental-value and the current log-price depending on the weight of the fundamentalists plus a share of the excess demand of the chartists or, in general, of all traders except the fundamentalists. Thus, with the explicit pricing rule, the intended actions of the fundamentalists at the beginning of the time step are modeled. In contrast, in the case of the implicit pricing rule, potential adjustments in the trading process before the end of the time step, for instance by means of limit orders, are taken into account. It clearly depends on the particular purpose for which the model is designed, which of these aspects is more important. If, e.g., the interest lies on understanding how the absence of adjustments during one time step affects the market stability, then an explicit model may be suitable for this purpose. If, however, we are interested in an adequate reproduction of the intentions of the different trader types—the reduced form—and not so much of the specific mechanics—the structural form—, the implicit rather than the explicit model is the adequate choice.

In summary, qualitatively the implicit model seems to capture the price behavior in today’s financial markets much better than the explicit model, especially if limit orders are accounted for. The implicit model reflects not only monotone convergence in case there are no chartists, which implies that asset prices do not jump across their fundamental values, but also the fact that the resulting prices are the closer to their fundamental values the larger \(w_F\) is, i.e. the more fundamentalists act on the market. The only aspect that is not captured by the implicit model is that using a sufficiently large limit order, the price may reach the fundamental value in finite time. However, given that markets are subject to noise, uncertainty of the fundamental value, the existence of a smallest monetary unit, and perturbations by other trader types, this phenomenon is likely to occur only in highly idealized markets.

We now turn to an analysis of the stability properties of the implicit model. Figure 6 depicts simulations of the implicit model (6) using the same parameter values as the simulations of the explicit model (1) in Fig. 2. Note that the model is stable in the absence of chartists even for \(w_F>2\), while at the same time, it still allows for overshooting prices and instabilities caused by an abundance of chartists, cf. the graphs of Figs. 6f and 7b, c with \(w_C>0\).

Rewriting Eq. (6) leads to

or, as a first-order equation,

with eigenvalues

Next, we analyze the influence of the step size *h* on the stability of the implicit model. Note that in the implicit model we can introduce \({\tilde{w}}_C=hw_C\) and \({\tilde{w}}_F=hw_F\), which eliminates all \(w_F\), \(w_C\), and *h*. In other words, the stability region scales with *h*, which is a well-known result in numerical analysis, see Deuflhard and Bornemann (2012), Section 6.1.2. In Figs. 7 and 8 the implicit model is simulated for the same weights \((w_F,w_C)=(4,0)\), (10, 1), and (10, 1.5) but with varying step size \(h=1\), 0.25, and 0.1. We can see that a smaller step size stabilizes the model. In Figs. 9, 10, and 11 the respective stability regions for the implicit model are shown.

With that, the question arises whether it is a reasonable behavior of the model that the stability region scales with the step size (more specifically with \(h^{-1}\)) since this implies that the model becomes unconditionally stable for \(h\rightarrow 0\). From an economic point of view, there are two explanations for this feature. On the one hand, the smaller \(h>0\) becomes, the faster the fundamentalists react to price changes, which should increase their stabilizing effect on the market. On the other hand, the smaller \(h>0\) is, the shorter the reference period \([t-h,t]\) becomes that the chartists use to calculate past gains or losses based on *p*(*t*) and \(p(t-h)\). Thus, these gains and losses, and consequently, the price changes caused by the chartists become smaller and smaller for shrinking *h*, hence, reducing their destabilizing effect on the market. In more mathematical terms, the term \(hw_c(p(t)-p(t-h))\) tends to 0 faster than *h*, meaning that its effect after \(N\sim 1/h\) time steps decreases with *h* even though the number of simulation steps *N* up to a given time *T* increases proportionally to 1/*h*.

As a consequence, the time step \(h>0\) should not be chosen depending on the trading frequency. It could be very high in some of today’s financial markets, e.g., in high-frequency trading, so that \(h>0\) would be very small. Instead, it should reflect the time horizon the chartists use for defining their trading strategy. When the trading frequency is of interest, i.e., when the time distance between two trades *h* and the chartists’ time horizon are different, another parameter has to be added to the model. Although a very interesting aspect, it is beyond the scope of this work and, thus, the subject of future work. It is particularly important that the model produces plausible qualitative results also for relatively large time steps \(h>0\)—and this is precisely what an implicit discretization achieves, cf. the discussion of A-stability and related concepts, e.g., in the work of Deuflhard and Bornemann (2012).

Taken together, our analysis draws attention to the following two drivers of price instabilities: first, the instability of the model is caused by the fundamentalists due to the absence of adjustments in the trading process within one time step in the explicit model and, second, the instability of the model is caused by a too large number (resp. weight) of chartists relative to fundamentalists. Clearly, the second effect, which is present in both the explicit and the implicit model, is the one of interest when analyzing bubbles etc. At this point we mention that due to the implicit discretization not only the stability regions change but also the parameter regions where the price converges monotonically, see Figs. 5 and 12.

The fact that for the explicit model the instability artifacts are reduced when the step size \(h>0\) becomes smaller implies that instead of using an implicit discretization one could also use an explicit discretization with a much smaller time step. In the context of the original discrete time model (1), one could interpret this procedure as a distinction between macro and micro time^{Footnote 2} in our model. To this end, we could introduce an arbitrary time step \(h>0\) into the explicit model (1), leading to:

Now, if one would simulate the model (9) on a time scale \(\{0,h,2h,\ldots ,(\nu -1)h,\nu h,\) \((\nu +1)h,\ldots ,2\nu h, \ldots \}\) with \(\nu \in {\mathbb {N}}\) and choose *h*—the micro time—sufficiently small, no instabilities occured. One could then output the prices at the macro times \(\{0,\nu h,2\nu h,\) \( \ldots \}\), which equal \(\{0,1,2,\ldots \}\) when choosing \(h=1/\nu \) [fitting to Eqs. (1), (7)]. However, as it is well known in numerical analysis (see, e.g., Deuhard & Bornemann, 2012, Introduction to Chapter 6), this procedure has two severe disadvantages compared to an implicit discretization. First, the size of the sufficiently small \(h>0\) depends on \(w_F\)—as can be easily seen for the case \(w_C=0\). That is, the procedure using micro and macro time solves the problem only symptomatically, but not fundamentally. For each \(w_F\) a sufficiently small *h* would have to be determined individually, while the implicit model solves the problem with a fixed step size, e.g., \(h=1\), for all \(w_F>0\). Second, using small time steps is potentially very computationally expensive. One may have to choose very small micro time units (if \(w_F\) is large) for the model to be stable, which means that an extremely large number of steps might be necessary. In contrast, the implicit model yields qualitatively the same behavior without having to introduce small micro time steps. The basic problem can be seen when analyzing an ODE \({\dot{x}}=Ax\) with a matrix *A* that has only real eigenvalues. While \(x=0\) is stable when all eigenvalues of *A* are negative (i.e., when they are in an interval that is not bounded below), its explicit Euler discretization is stable when all eigenvalues are in an interval that is bounded below. A small (micro) time step would indeed expand this interval, however, it is still bounded below and, thus, qualitatively different to the original stability interval of the ODE. Here we note that it might be very interesting for future work to study which results from the literature that are based on the ‘explicitly’ modeled HAM still hold under implicit modeling.

The second argument could be mitigated by using other explicit methods than the explicit Euler scheme, e.g., an explicit high-order Runge–Kutta scheme, which yields reliable results with larger time steps than the explicit Euler scheme. However, this would again not solve the problem fundamentally as the time step \(h>0\) would still have to be adjusted to the value of \(w_F\). Moreover, it would be quite difficult to interpret such a method economically, while the implicit model has a clear and intuitive economic interpretation, see Eq. (8). Besides these numerical issues, the micro-time approach also affects the modeling of the chartists, because the time period in which the chartists compute the price difference \(p(t)-p(t-h)\) becomes smaller, which may cause potentially unwanted side effects. While it would be possible to simulate the dynamics of the different traders on different time scales and then couple the resulting simulations, this would again complicate the model and its economic interpretation.

## 4 Evolutionary Rules for the Numbers of the Traders

To examine whether our insights also hold in more complex financial environments, we generalize our model along three dimensions in the next step. We allow for more types of traders, in particular, noise traders and sentimentalists, introduce an evolutionary mechanism that drives the distribution of the different types of traders in the market, and allow the fundamental value to be stochastic. Based on these generalizations, we develop two versions of an agent-based market model that differ only concerning the pricing rule. Model (a) uses the explicit discretization (1) of the differential Eq. (5). In contrast, model (b) makes use of the implicit one (6). With this approach, we should be able to better differentiate the effects of the two discretization techniques.

Firstly, we introduce additional trader types, namely noise traders and sentimentalists. Noise traders (*N*) trade more or less independently of market dynamics. This can be the case because they are the proverbial small traders without enough information about the market or because they are liquidity traders, i.e., traders who have to buy/sell specific amounts of the asset irrespective of the price and the fundamental, e.g., because they need it for hedging, for a mutual funds portfolio, or some external engagement. Sentimentalists (*S*) are a type of trader that switches with a certain probability or ratio to other, usually better performing strategies, i.e., they observe the profits of the other trader types and can switch in every period to their preferred strategies. The demand functions of the basic trader types are:

and

with \(t\in \{0,h,2h,\ldots ,T/h\}\), \(T=dy\) the total number of trading days, *d* the number of trading days per year, *y* the total number of years under analysis, *h* the time step between two trades, \(C\in {\mathbb {R}}\), \(F,N>0\) parameters modeling the aggressiveness of the respective trader group, *f* the log-fundamental-value, *p* the log-price (either modeled explicitly or implicitly), as well as \(\mu _N>-1\) the trend and \(\sigma _N>0\) the volatility of the noise traders’ demand.

Secondly, we introduce evolutionary growth rules for the share of traders as a second generalization, cf. Hommes (2006). More specifically, we apply so-called exponential replicator dynamics. Thus, we fix the share of traders for chartists \(N_C\ge 0\), fundamentalists \(N_F\ge 0\), noise traders \(N_N\ge 0\), and sentimentalists \(N_S\ge 0\) such that \(N_C+N_F+N_N+N_S=1\). The overall share of a specific trading strategy is determined by the sentimentalists as they are the only group of traders that is allowed to switch the strategy. With a given initial distribution for the sentimentalists \(N_{S_C}(0)\ge 0\), \(N_{S_F}(0)\ge 0\), and \(N_{S_N}(0)\ge 0\) (such that \(N_{S_C}(0)+N_{S_F}(0)+N_{S_C}(0)=1\)) we define the numbers of the different sentimentalists’ trading types via

and

where \(\beta >0\) is a parameter controlling the speed of adaption, cf. Brock and Hommes (1997) and

as well as

describe the fitness of the trader groups. Taken together, at time *t* the share of the chartists is \(N_C+N_SN_{S_C}(t)\in [N_C,N_C+N_S]\), the share of the fundamentalists is \(N_F+N_SN_{S_F}(t)\in [N_F,N_F+N_S]\), while the share of the noise traders is \(N_N+N_SN_{S_N}(t)\in [N_N,N_N+N_S]\). The sentimentalists do not have an own trading rule, but they are allowed to switch between the three basic trading rules *F*, *C*, and *N*. When \(N_S=1\), all traders can switch. However, note that \(N_S=1\) does not necessarily mean that there are no chartists, for example.

As a third extension, we allow the fundamental value of the asset to be stochastic. We define the fundamental value \(\phi \) to fulfill the stochastic differential equation \(d\phi (t)=\mu _F\phi (t)dt+\sigma _F\phi (t)dW(t)\), where *W* is a standard Brownian motion (Wiener process), \(\mu _F>-1\) is the trend of the fundamental, and \(\sigma _F>0\) the volatility of the fundamental, i.e., the fundamental value, but not necessarily the price process, follows a geometric Brownian motion. We assume that the fundamental value is a stochastic process that can be observed perfectly by the fundamentalists, who base their demand at time *t* on \(f(t)=\log (\phi (t))\). As an alternative, one could assume that there is a deterministic fundamental value that cannot be observed perfectly by the traders. However, the difference between these alternatives is negligible in our simulations; we do not concentrate on the mechanisms, but on the behavior. Hence, the pricing rules are for the implicit discretization

and for the explicit discretization

For the numerical simulations in this paper, we straightforwardly implemented the model given above in the computing language R. In the remainder of this section, we provide insights for single selected runs, i.e. price developments, while Sect. 5 conducts Monte Carlo simulations for statistical soundness. The R code is available from the authors upon request. The parameters are set as described in the following paragraph.

Figure 13 depicts simulated price dynamics of four typical, qualitatively different cases: a hill-shaped price development, a temporary downward trend, a U-shaped price development, and a temporary upward trend. The simulations are based on the following parameter values, which were found by an extensive trail-and-error calibration. The parameters are chosen in such a way that the simulation is consistent with empirical stylized facts, cf. Hommes (2006). There are \(d=250\) trading days per year and \(y=1\) year making a total of \(T=250\) trading days. The step size is set to \(h=1\), i.e. one trade per day. The initial values are \(f(0)=p_{imp}(0)=p_{exp}(0)=\log (1)=0\). The fundamental’s trend is \(\mu _F=0.1h/d\) and its induced volatility is \(\sigma _F=0.03\). The noise traders’ parameters are \(\mu _N=0.05\) and \(\sigma _N=0.5\). The shares of the traders are fixed to one quarter each, i.e., \(N_F=N_C=N_N=N_S=0.25\) while the sentimentalists are allowed to switch. Their initial shares are approximately one third each, i.e., \(N_{S_F}=N_{S_C}=0.33\) and \(N_{S_N}=0.34\). The scaling parameter for the market power and trading volume is set to \(M=1\) and the sentimentalists’ switching velocity is defined as \(\beta =1\). The aggressiveness of the respective trading rule is \(C=2.1\), \(F=1.7\), and \(N=0.2\).

Additionally to the price dynamics of Simulations 1 to 4 in Fig. 13 (fundamental value: solid, implicit price: dashed, and explicit price: dotted), the shares of the sentimentalists following fundamentalists (dashed), chartists (solid), or noise traders (dotted) are depicted in Fig. 14 for the explicit model (fine) as well as for the implicit model (bold). Further, in Fig. 15, the induced volatility of the fundamental \(\sigma _F\) (fine) and its sliding historical volatility (bold) with window size \(m=20\) are plotted (solid) together with the historical volatilities (with the same window size *m*) of the implicit model (dashed) and the explicit model (dotted). We observe that there are much more peaks in the price paths both for the implicit and the explicit model than in the fundamentals. Sometimes, the peaks in the implicitly modeled price correspond to peaks in the explicit model. However, there are as well peaks in the explicit model where no peaks in the implicit one are visible and vice versa. Additionally we mention that no trader type becomes extinct—a stylized fact market models should fulfill (Hommes, 2006; Kirman, 1993). This means that if there is no financial bubble in either model, the two models tend to follow a similar pattern.

In Simulation 1, in both models, the fundamentalists’ rule is most profitable, and so their share (within the group of sentimentalists) increases. In Simulation 2, this is true for the chartists, and in Simulation 3, the noise traders’ share is increasing. The latter point is remarkable since it has been argued that noise trading should be unprofitable because it is not rational—yet noise traders’ profits, as well as trend followers’ profits (Hommes, 2006), are considered to be an important stylized fact of financial markets, cf. De Long et al. (1987), Green and Heffernan (2019). In Simulation 4, there are not only quantitative but also qualitative differences between the implicit and the explicit model. While fundamentalists gain under explicit discretization, they do not make profits under the implicit model. Note that in this model, the interrelation between the price dynamics and the successful type of trader is not limited to those cases shown, but these are only an illustrative selection. However, all in all, the simulations give reason to assume that, as common sense also suggests, chartists are more likely to win when trends are clear.

In Fig. 15, we observe that in both models, price volatility is not only higher than the fundamental volatility but also clustered—two stylized facts market models should reproduce (Hommes, 2006). There are parameter settings, e.g., \(\sigma _F=0.1\), \(C=N=1\), \(F=10\), and all others as above, such that in all simulation runs price bubbles are generated under the explicit model, while no bubbles appear in the implicit model, cf. Fig. 16, Simulation 5. Sets of parameters that generate bubbles under implicit discretization, but no bubble paths under the explicit model, are very rare—while there are many parameter settings leading to the opposite behavior (cf. Sect. 5). Under explicit discretization, more bubbles occur, preceded by higher volatilities.

Once implicit discretization is allowed for, there is a broader parameter space with bubble-and-crash free model specifications. That means when empirical data are used to estimate model parameters, those in the implicit model are potentially better, as those in the explicit model are biased. Especially when predictions or policy recommendations are to be made, it is preferable to use a larger parameter space, i.e., the implicit model, cf. Schröppel (2018), Shiller (1980).

Taken together, our results from the simple model typically carry over to the more general setting. Explicit discretization typically generates more unstable prices as well as price bubbles and crashes. In contrast, implicit discretization of the same underlying financial market model is associated with steadier price developments and, in particular, far fewer bubbles. In empirical analyses, models based on explicit discretization might lead to biased results as the calibration exercise to find the best fit to the stylized facts is restricted to a smaller parameter space than under implicit discretization. Thus, the choice of discretization—a seemingly technical issue only—is far from innocent but might have far-reaching implications for the analysis and interpretation of heterogeneous agent models.

At this stage, we, firstly, note that in the implicit model there are still bubbles and crashes possible. This is important since HAMs are among others constructed to analyze bubbles and crashes. However, bubbles in the implicit model are really caused by traders’ interactions and not by some modeling artifact. Secondly, the idea to define bubbles as prices diverging from their fundamentals is common in the literature since the times of Day and Huang (1990) and Huang and Day (1993).

## 5 Simulations

At first sight, the implicit and explicit modeling do not seem to differ substantially with respect to price dynamics, traders’ success, and volatilities (see Figs. 13, 14, 15). However, as we have shown in the analytical investigations (Sects. 2, 3) the stability behavior differs significantly. In those cases where there appears no bubble in either model, the models behave similarly. However, the parameters’ range in which the explicit model is stable is much smaller than the range in which the implicit model is stable. This means that if the parameters are adjusted to historical, real market developments, the space over which the implicit model is optimized is larger and therefore could deliver better results. For the range in which both models are stable, the simulation results are similar, so it is possible to switch from the explicit model to the implicit one without restrictions. The differences between the explicit and the implicit model in the cases without any bubbles should therefore be at a minimum. In order to show that the implicit model has a larger stable range not only in theory, we perform an extensive simulation below with 500 runs.

In the simulation we use the setting of Sect. 4 including its pricing rules (explicit and implicit), its evolutionary rules, and, with few exceptions, its parameter specifications. In the simulation, we consider varying parameters \(C=-10,\ -9.9,\) \(-9.8,\ \ldots ,\ 9.9,\ 10\) and \(F=0,\ 0.1,\ 0.2,\ \ldots ,\ 19.9,\ 20\) for the aggressiveness of the chartists resp. fundamentalists. In this way, we can see which parameter constellations lead to stable or unstable dynamics. Additionally, we increase the volatility of the fundamental values to \(\sigma _F=0.1\) and the aggressiveness of the noise traders to \(N=1\) to bring more variety to the simulation runs.

We simulated 500 fundamental value developments and performed the pricing and evolutionary rules for the two models and for all parameter pairs (*C*, *F*) in the mentioned range. In Fig. 17 we see a contour plot of the numbers of bubbles in the explicit model for the varying parameters *C* and *F*. There is a small area for small *F* and *C* around zero where no bubbles occur. Outside this area there are bubbles in all of the 500 runs. In contrast, Fig. 18 shows a contour plot of the numbers of bubbles in the implicit model for the varying parameters *C* and *F*. We define a bubble as a price development that tends to infinity. There are no bubbles for *C* around zero and all parameter values of *F*, which is perfectly in line with our analytical findings. Additionally, in Figs. 19 and 20, we show the contour plots for the numbers of “excessive” bubbles in the corresponding model, i.e. for \(\max \{0,\#\)Bubbles in the explicit model\(\ -\ \#\)Bubbles in the implicit model\(\}\) and \(\max \{0,\#\)Bubbles in the implicit model\(\ -\ \#\)Bubbles in the explicit model\(\}\). Thus, we can easily observe the areas in which one model produces more bubbles than the other one. On the one hand, there is a very small area with *C* approximately between three and four and *F* around four, where the explicit model is more stable, on the other hand, the implicit model is more stable for *C* approximately between minus two and four and all *F* larger than some values between two and six. The fact that the explicit model is not dominated by the implicit one is not very significant. The standard literature on discretization techniques (Deuflhard & Bornemann, 2012; Wanner & Hairer, 1996) just states that in the case \(C=0\) the implicit model is more stable—as is the case in our simulation. It would be rather unusual if for \(C\ne 0\) there were no fluctuations in the results.

## 6 Conclusion

Heterogeneous agent models provide a very interesting approach to analyze financial markets. Building on the interactions of different types of traders, in particular fundamentalists and chartists, HAMs have proven to be a very productive tool to analyze financial dynamics. However, when using these models, particular care should be taken to the specific modeling of the group of fundamentalist traders, a core element in this type of models. Given the specific fundamentalist approach, price movements in a market with (almost) only fundamentalist traders should not be exploding. If in addition limit orders are accounted for, prices should converge monotonically to their fundamental values, i.e., oscillating prices are to be excluded. The standard HAM approach does not guarantee this important feature.

We relate this crucial modeling aspect to a seemingly technical issue, the price equation being of the type of an explicit discretization—which is implied in a typical standard HAM analysis. As a remedy to improve the HAM approach, we propose to instead use the implicit discretization of the price equation as a straightforward, easy to implement procedure, which has a direct economic interpretation, see Eq. (8). Under this procedure, HAMs can be more trusted to be in line with today’s financial markets, i.e., in particular, the presence of limit orders. Not accounting for this seemingly technical issue might have far-reaching implications. Researchers are likely to overestimate the occurrence of financial crashes and asset price bubbles. Also, when calibrating HAMs to replicate relevant empirical stylized facts, models based on implicit discretization incorporate a more extensive parameter space that should mitigate the issue of biased parameter values and improve the empirical fit of the models. Taken together, this should help to enhance HAMs’ value as an instrument to design, analyze, and evaluate financial markets and related policies.

## Availability of Data and Materials

Not applicable.

## Code Availability

The underlying R codes are available on request by email from the authors.

## Notes

We are grateful to an anonymous reviewer for suggesting to discuss cobweb models.

Again, we are grateful to the anonymous reviewer for suggesting this interpretation.

## References

Baumann, M. H. (2015). Effects of linear feedback trading in an interactive market model. In

*American control conference (ACC)*(pp. 3880–3885). http://dx.doi.org/10.1109/ACC.2015.7171935.Baumann, M. H., Baumann, M., & Herz, B. (2020). Are ETFs bad for financial health? In

*18th RSEP conference*(pp. 10–18).Beja, A., & Goldman, M. B. (1980). On the dynamic behavior of prices in disequilibrium.

*The Journal of Finance,**35*(2), 235–248. https://doi.org/10.1111/j.1540-6261.1980.tb02151.xBrock, W. A., & Hommes, C. H. (1997). A rational route to randomness.

*Econometrica,**65*(5), 1059–1095.Brock, W. A., & Hommes, C. H. (1998). Heterogeneous beliefs & routes to chaos in a simple asset pricing model.

*Journal of Economic Dynamics & Control,**22*(8), 1235–1274. https://doi.org/10.1016/S0165-1889(98)00011-6Chiarella, C., Dieci, R., & He, X. Z. (2009). Heterogeneity, market mechanisms, and asset price dynamics. In T. Hens, K. R. Schenk-Hoppé (Eds.),

*Handbook of financial markets: Dynamics and evolution, North-Holland, San Diego, Handbooks in Finance*(pp. 277–344). https://doi.org/10.1016/B978-012374258-2.50009-9.Day, R. H., & Huang, W. (1990). Bulls, bears and market sheep.

*Journal of Economic Behavior and Organization,**14*(3), 299–329. https://doi.org/10.1016/0167-2681(90)90061-HDe Long, J. B., Shleifer, A., Summers, L. H., & Waldmann, R. J. (1987).

*The economic consequences of noise traders*. Working Paper 2395, National Bureau of Economic Research. https://doi.org/10.3386/w2395.De Long, J. B., Shleifer, A., Summers, L. H., & Waldmann, R. J. (1990). Noise trader risk in financial markets.

*Journal of Political Economy,**98*(4), 703–738. https://doi.org/10.1086/261703De Long, J. B., Shleifer, A., Summers, L. H., & Waldmann, R. J. (1990). Positive feedback investment strategies and destabilizing rational speculation.

*The Journal of Finance,**45*(2), 379–395. https://doi.org/10.1111/j.1540-6261.1990.tb03695.xDeuflhard, P., & Bornemann, F. (2012).

*Scientific computing with ordinary differential equations*(Vol. 42). New York: Springer.Dieci, R., & He, X. Z. (2018). Heterogeneous agent models in finance. In C. H. Hommes, & B. LeBaron (Eds.), Handbook of computational economics, Elsevier, handbook of computational economics (Vol. 4, pp. 257–328). https://doi.org/10.1016/bs.hescom.2018.03.002.

Dieci, R., & Westerhoff, F. (2010). Heterogeneous speculators, endogenous fluctuations and interacting markets: A model of stock prices and exchange rates.

*Journal of Economic Dynamics and Control,**34*(4), 743–764. https://doi.org/10.1016/j.jedc.2009.11.002Franke, R., & Westerhoff, F. (2016). Why a simple herding model may generate the stylized facts of daily returns: Explanation and estimation.

*Journal of Economic Interaction and Coordination,**11*(1), 1–34. https://doi.org/10.1007/s11403-014-0140-6Green, E., & Heffernan, D. M. (2019). An agent-based model to explain the emergence of stylised facts in log returns. arXiv:1901.05053.

He, X. Z., & Westerhoff, F. H. (2005). Commodity markets, price limiters and speculative price dynamics.

*Journal of Economic Dynamics and Control,**29*(9), 1577–1596. https://doi.org/10.1016/j.jedc.2004.09.003Hommes, C. H. (2006). Heterogeneous agent models in economics and finance, chap 23. In L. Tesfatsion & K. L. Judd (Eds.),

*Handbook of Computational Economics*(Vol. 2, pp. 1109–1186). New York: Elsevier. https://doi.org/10.1016/S1574-0021(05)02023-XHommes, C. H., & Wagener, F. (2009). Complex evolutionary systems in behavioral finance. In T. Hens, K. R. Schenk-Hoppé (Eds.), Handbook of financial markets: Dynamics and evolution, North-Holland, San Diego, Handbooks in Finance (pp. 217–276). https://doi.org/10.1016/B978-012374258-2.50008-7.

Huang, W., & Day, R. H. (1993). Chaotically switching bear and bull markets: The Derivation of Stock Price Distributions from Behavioral Rules. In

*Nonlinear dynamics and evolutionary economics*(pp. 169–182).Iori, G., & Porter, J. (2018). Agent-based modeling for financial markets. In S. H. Chen, M. Kaboudan, & Y. R. Du (Eds.),

*The Oxford handbook of computational economics and finance*(pp. 635–666). Oxford: Oxford University Press.Kellett, C. M., Weller, S. R., Faulwasser, T., Grüne, L., & Semmler, W. (2019). Feedback, dynamics, and optimal control in climate economics.

*Annual Reviews in Control,**47*, 7–20. https://doi.org/10.1016/j.arcontrol.2019.04.003Kirman, A. (1993). Ants, rationality, and recruitment.

*The Quarterly Journal of Economics,**108*(1), 137–156. https://doi.org/10.2307/2118498Kukacka, J., & Kristoufek, L. (2020). Do ‘complex’ financial models really lead to complex dynamics? agent-based models and multifractality.

*Journal of Economic Dynamics and Control,**113*, 103855. https://doi.org/10.1016/j.jedc.2020.103855LeBaron, B. (2006). Agent-based computational finance, chap 24. In L. Tesfatsion & K. L. Judd (Eds.),

*Handbook of computational economics*(Vol. 2, pp. 1187–1233). New York: Elsevier. https://doi.org/10.1016/S1574-0021(05)02024-1Lux, T. (1995). Herd behaviour, bubbles and crashes.

*The Economic Journal,**105*(431), 881–896.Lux, T. (2008).

*Applications of statistical physics in finance and economics*. Kiel Working Paper 1425, Kiel Institute for the World Economy (IfW).Naimzada, A. K., & Ricchiuti, G. (2008). Heterogeneous fundamentalists and imitative processes.

*Applied Mathematics and Computation,**199*(1), 171–180. https://doi.org/10.1016/j.amc.2007.09.061Napoletano, M., Guerci, E., & Hanaki, N. (2018). Recent advances in financial networks and agent-based model validation.

*Journal of Economic Interaction and Coordination,**13*, 1–7. https://doi.org/10.1007/s11403-018-0221-zNordhaus, W. D. (2017). Revisiting the social cost of carbon.

*Proceedings of the National Academy of Sciences,**114*(7), 1518–1523. https://doi.org/10.1073/pnas.1609244114Platt, D. (2020). A comparison of economic agent-based model calibration methods.

*Journal of Economic Dynamics and Control,**113*, 103859. https://doi.org/10.1016/j.jedc.2020.103859Schmitt, N., & Westerhoff, F. (2014). Speculative behavior and the dynamics of interacting stock markets.

*Journal of Economic Dynamics and Control,**45*, 262–288. https://doi.org/10.1016/j.jedc.2014.05.009Schmitt, N., & Westerhoff, F. (2021). Trend Followers, contrarians and fundamentalists: Explaining the dynamics of financial markets.

*Journal of Economic Behavior & Organization*,*192*, 117–136.Schröppel, A. (2018). Marktmodellanpassung bezüglich stilisierter Fakten mittels Bootstrapping. Master’s thesis, Universität Bayreuth, Lehrstuhl für Angewandte Mathematik, supervisor: Lars Grüne.

Shampine, L. F., & Gear, C. W. (1979). A user’s view of solving stiff ordinary differential equations.

*SIAM Review,**21*(1), 1–17. https://doi.org/10.1137/1021001Shiller, R. J. (1980).

*Do stock prices move too much to be justified by subsequent changes in dividends?*Working Paper 456, National Bureau of Economic Research. https://doi.org/10.3386/w0456.Szafarz, A. (2012). Financial crises in efficient markets: How fundamentalists fuel volatility.

*Journal of Banking & Finance,**36*(1), 105–111. https://doi.org/10.1016/j.jbankfin.2011.06.008Tramontana, F., Gardini, L., Dieci, R., & Westerhoff, F. (2009). The emergence of bull and bear dynamics in a nonlinear model of interacting markets.

*Discrete Dynamics in Nature and Society,**2009*, 1–30. https://doi.org/10.1155/2009/310471Tramontana, F., Gardini, L., Dieci, R., & Westerhoff, F. (2010). Global bifurcations in a three-dimensional financial model of “bull and bear’’ interactions. In G. I. Bischi, C. Chiarella, & L. Gardini (Eds.),

*Nonlinear dynamics in economics, finance and social sciences: Essays in Honour of John Barkley Rosser Jr*(pp. 333–352). Berlin, Heidelberg: Springer.Tramontana, F., Westerhoff, F., & Gardini, L. (2013). The bull and bear market model of Huang and Day: Some extensions and new results.

*Journal of Economic Dynamics and Control,**37*(11), 2351–2370.Wanner, G., & Hairer, E. (1996).

*Solving ordinary differential equations II—Stiff and differential-algebraic problems*. Berlin, Heidelberg: Springer.Westerhoff, F., & Reitz, S. (2005). Commodity price dynamics and the nonlinear market impact of technical traders: Empirical evidence for the US corn market.

*Physica A: Statistical Mechanics and its Applications,**349*(3), 641–648. https://doi.org/10.1016/j.physa.2004.11.015Westerhoff, F. H., & Reitz, S. (2003). Nonlinearities and cyclical behavior: The role of chartists and fundamentalists. Studies in Nonlinear Dynamics & Econometrics. 10.2202/1558-3708.1125.

Zhang, W. B. (2018). Economics with heterogeneous interacting agents: A practical guide to agent-based modeling.

*Journal of Economic Interaction and Coordination,**13*, 197–200. https://doi.org/10.1007/s11403-017-0213-4

## Acknowledgements

This paper was presented at University of Bamberg (Second Behavioral Macroeconomics Workshop: Heterogeneity and Expectations in Macroeconomics and Finance, 2019), University of Perugia (43rd Annual Meeting of the Italian Association for Mathematics Applied to Economic and Social Sciences (AMASES), 2019), University of Gießen (German Network for New Economic Dynamics (GENED), 2020), University of Bayreuth (2019),University of Sussex (FAST Research Seminar, 2020), and University of Lisbon (8th UECE Conference on Economic and Financial Adjustments, 2020). The authors wish to thank all reviewers, participants, and discussants for very helpful comments.

## Funding

Open Access funding enabled and organized by Projekt DEAL. Not applicable.

## Author information

### Authors and Affiliations

### Corresponding author

## Ethics declarations

### Conflict of interest

The authors declare that they have no conflict of interest.

## Additional information

### Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

### Cite this article

Baumann, M.H., Baumann, M., Grüne, L. *et al.* Market Structure and Instability Artifacts in Heterogeneous Agent Models: Lessons from Implicit Discretizations of Stiff Equations.
*Comput Econ* (2022). https://doi.org/10.1007/s10614-022-10285-z

Accepted:

Published:

DOI: https://doi.org/10.1007/s10614-022-10285-z

### Keywords

- Market maker model
- Heterogeneous agents
- Stiff equation
- Implicit Euler scheme
- Instability artifact