The Emergence of Bull and Bear Dynamics in a Nonlinear Model of Interacting Markets

We develop a three-dimensional nonlinear dynamic model in which the stock markets of two countries are linked through the foreign exchange market. Connections are due to the trading activity of heterogeneous speculators. Using analytical and numerical tools, we seek to explore how the coupling of the markets may affect the emergence of bull and bear market dynamics. The dimension of the model can be reduced by restricting investors’ trading activity, which enables the dynamic analysis to be performed stepwise, from low-dimensional cases up to the full three-dimensional model. In our paper we focus mainly on the dynamics of the oneand twodimensional cases, with numerical experiments and some analytical results, and also show that the main features persist in the three-dimensional model.


Introduction
Financial market models with heterogeneous interacting agents have proven to be quite successful in the recent past.For instance, these nonlinear dynamical systems have the potential to replicate some important stylized facts of financial markets-such as the emergence of bubbles and crashes-quite well and thereby help us to understand what is going on in these markets.For pioneering contributions and related further developments see Day  The seminal model of Day and Huang 1 reveals that nonlinear interactions between technical and fundamental traders may lead to complex bull and bear market fluctuations.The dynamics of this model, which is due to the iteration of a one-dimensional cubic map, may be understood with the help of bifurcation analysis.A typical route to complex dynamics may, for instance, first display a pitchfork bifurcation, followed by a cascade of period-doubling bifurcations for each of two coexisting equilibria.As a result, cycles of various periods and then chaotic dynamics may emerge within two different regions.The two chaotic areas may eventually merge via a homoclinic bifurcation.If that is the case, we observe apparently random switches between bull and bear markets.
In this paper we develop and explore a nonlinear model in which the stock markets of two countries, say H ome and A broad , are linked via and with the foreign exchange market.So far, most of these models focus on one speculative market and not much is known about the implications of market interactions.A few exceptions include Westerhoff 19 , Chiarella et al. 20 and Westerhoff and Dieci 21 .The reason for the markets' coupling is quite natural.Note first that stock market traders who invest abroad have to consider potential exchange rate adjustments when they enter a speculative position.In addition, these agents obviously need foreign currency to conduct their transactions.We assume that there are two types of traders in the foreign exchange market.Fundamental traders believe that the exchange rate converges toward its fundamental value, and even expect that the strength of mean reversion increases with the mispricing.Although such trading behavior tends to have a stabilizing impact on markets, it also brings nonlinearity into the model.Technical traders optimistically pessimistically continue to submit buying selling orders when prices are high low , and thereby tend to destabilize the markets.In the absence of stock market traders who invest abroad, the three markets evolve independently of each other.In particular, the exchange rate is driven by a one-dimensional nonlinear law of motion, and complicated bull and bear market dynamics, as observed in Day and Huang 1 , may emerge.
To make matters as simple as possible, we assume that stock market traders only rely on a linear fundamental trading rule.If we allow stock market traders from country A to become active in country H, then the stock market H and the foreign exchange market are linked and coevolve in a two-dimensional nonlinear dynamical system.Our model turns into a three-dimensional dynamical system if stock market traders from country H also invest in country A. The expansion of the trading activity of stock market speculators, via the introduction of international connections, therefore results in a gradual increase of the dimension of the dynamical system.As it turns out, the bull and bear dynamics which originate in the foreign exchange market spill over into the stock markets.However, there is now also a feedback from the stock markets to the foreign exchange market, which makes the dynamics even more intricate.
A related model of interacting markets with a similar nonlinear structure was recently investigated by Dieci and Westerhoff 22 in Dieci and Westerhoff 22 , nonlinearity arises due to agents switching among linear competing trading rules , who focus on the nature of the stabilizing or destabilizing impact of international connections on the whole system, both in terms of local stability of the fundamental equilibrium and with regard to the amplitude of price fluctuations in this respect, similar results on the steady-state properties hold for the present model, too .The present paper is devoted to a quite different topic, namely the dynamic analysis of the global homoclinic bifurcations that mark the transition from a situation with multiple equilibria to one with chaotic dynamics across bull and bear market regions, similar to that highlighted by Day and Huang 1 .As a matter of fact, not much is known about such kind of dynamics in high-dimensional systems, nor leading to dynamics which are the natural extension to a three-dimensional space of those occurring also in the two-dimensional one.
The structure of the paper is as follows.In Section 2 we derive the dynamic model, by describing the behavior of the two stock markets Sections 2.1 and 2.2, resp.and the foreign exchange market Section 2.3 .In Section 3 we perform a full dynamic analysis of the one-dimensional case.In Section 4 we consider the two-dimensional case.In particular in Section 4.1 we focus on the conditions for the local asymptotic stability of the fundamental steady state and on the onset of a situation of bistability.We also show how, by increasing a relevant parameter, bistability turns into coexistence of two periodic or chaotic attractors.In Section 4.2 we describe in detail the sequence of homoclinic bifurcations that lead to the existence of a unique attractor covering two previously disjoint regions of the phase space, and to the associated bull and bear dynamics.In Section 5 we will consider the full three-dimensional model.In this case the analytical results are quite poor, but we can study the dynamics by numerical experiments, which show how the same kind of local and global bifurcations observed in the lower dimensional cases also occur in higher dimension, leading to similar results for the state variables of the model.Section 6 concludes this paper.Mathematical details are contained in four appendices.

The Model
This section is devoted to the description of the three-dimensional discrete-time dynamic model of internationally connected markets, which will then be analyzed in the lower dimensional subcases before exploring some of its properties in the full three-dimensional model.
We consider two stock markets which are linked via and with the foreign exchange market.The foreign exchange market is modeled in the sense of Day and Huang 1 ; that is, we consider nonlinear interactions between technical traders or chartists and fundamental traders or fundamentalists .The fraction of technical and fundamental traders is fixed, but fundamentalists rely on a nonlinear trading rule.The stock markets are denoted by the superscript H ome and A broad .For the sake of simplicity, we assume that only fundamental traders are active in the stock markets, with fixed proportions and linear trading rules.Two kinds of connections exist among the markets: first, stock market traders who trade abroad base their demand on both expected stock price movements and expected exchange rate movements.Second, in order to conduct their business they generate transactions of foreign currencies and consequent exchange rate adjustments.In each market, the price adjustment process is simply modeled by a linear price impact function.The latter may be interpreted as the stylized behavior of risk-neutral market makers, who stand ready to absorb the imbalances between buyers and sellers and then adjust prices in the direction of the excess demand.
In the following subsections we describe each market in detail.

The Stock Market in Country H
Let us start with a description of the stock market in country H.According to the assumed price impact function, the stock price in country H P H at time step t 1 is quoted as where a H is a positive price adjustment parameter and D HH F,t , D HA F,t reflect the orders placed by fundamental traders from countries H and A investing in country H, respectively.For instance, if buying orders exceed selling orders, prices go up.
The orders placed by fundamental traders from country H are given by where b H is a positive reaction parameter and F H is the fundamental value of stock H.Fundamentalists seek to profit from mean reversion.Hence, these traders submit buying orders when the market is undervalued and vice versa .Fundamental traders from abroad may benefit from a price correction in the stock market and in the foreign exchange market.Denote the fundamental value of the exchange rate by F S and the exchange rate by S, then their orders can be written as where c H ≥ 0, γ H > 0. Suppose, for instance, that both the stock market and the foreign exchange market are undervalued.Then the foreign fundamentalists take a larger buying position than the national fundamentalists assuming equal reaction parameters .However, if the foreign exchange market is overvalued, they become more cautious and may even enter a selling position .

The Stock Market in Country A
Let us now turn to the stock market in country A. We have a set of equations similar to those for stock market H.The new stock price P A at time t 1 is set as follows: with a A > 0. The orders placed by the fundamentalists from country A investing in stock market A amount to where b A > 0 and F A is the fundamental price of stock A. The orders placed by fundamentalists from country H investing in stock market A are given as where c A ≥ 0, γ A > 0. Note that the latter group takes the reciprocal values of the exchange rate and its fundamental value into account.

The Foreign Exchange Market
Let us now consider the dynamics of the exchange rate S , here defined as the price of one unit of currency H in terms of currency A. The exchange rate adjustment in the foreign exchange market is proportional to the excess demand for currency H.

2.8
Since e is a positive reaction parameter, 2.8 implies that chartists believe in the persistence of bull or bear markets.For instance, if the exchange rate is above its fundamental value, the chartists are optimistic and continue buying foreign currency.Fundamentalists seek to exploit misalignments using a nonlinear trading rule where f is a positive reaction parameter.As long as the exchange rate is close to its fundamental value, fundamentalists are relatively cautious.But the larger the mispricing, the more aggressive they become.Day and Huang 1 argue that such behavior is justified by increasing profit opportunities.Both the potential for and the likelihood of mean reversion are expected to increase with the mispricing.

The 1D Case
The complete dynamic model is given by 2. x e − fx 2 0, 3.3 which always gives three equilibria for any positive value of parameters e and f.The exchange rate dynamics produced by the third equation is similar to that described in the model by Day and Huang 1 .In our setting, the fundamental steady state; that is, the origin O x 0 , is always unstable φ 0 1 de > 1 , while the symmetric steady states x − : − e/f and x : e/f are both stable for de < 1.In the following, the chartist demand coefficient, e, will be chosen as the bifurcation parameter.
Map 3.2 is symmetric with respect to the origin φ x −φ −x , so that the bifurcations of the symmetric fixed points and cycles occur at the same value of e.The map is bimodal: it has a local minimum at x m −1 − 1 de /3df , at which the function assumes a value x m 0 −2 1 de /3 1 de /3df ; and by symmetry, a local maximum at x M −1 1 de /3df , at which the function assumes a value x M 0 2 1 de /3 1 de /3df we use the notation x m i 1 : φ x m i and x M i 1 : φ x M i .This allows us to obtain two symmetric absorbing intervals bounded by the critical values and their images: The set of initial conditions generating bounded trajectories is the interval whose borders are the points of an unstable 2-cycle α − , α see Figure 1 a .By taking an initial condition i.c.henceforth below α − or above α , the exchange rate diverges, while in the other cases it converges to one of the attractors located in the absorbing intervals.The immediate basin of attraction of the positive fixed point x is bounded by the fundamental steady state and by its positive rank-1 preimage, B 0 : O, O −1 .The immediate basin is not the only interval whose points generate trajectories converging to the positive steady steate.In fact, B 0 has a preimage formed by negative values, B −1 , which has a preimage  latter, in turn, has a preimage in the negative values, and so on Figure 2 a , thus forming an infinite sequence of intervals, which are all part of the basin of attraction of x and that accumulate at the points of the unstable 2-cycle α − , α .Such intervals alternate on the real line with the intervals belonging to the basin of x − , determined in a similar way.The borders of the intervals are given by the preimages of the fundamental steady state Figure 2 b .The union of the infinitely many intervals is the basin of attraction of x : and an analogous and symmetric explanation holds for the basin of the negative steady state, B − .
Figure 3: Periodic and chaotic attractors.In a a stable 2-cycle is obtained using the same set of parameters of Figure 1 except for e 3.483.In b the chaotic attractor is obtained with e 3.7436.The same happens for the chaotic intervals in I − , for the symmetry properties of the map.This is a remarkable global bifurcation, namely, a homoclinic bifurcation of x − and symmetrically x , occurring when the third iterate of the critical point merges with the unstable fixed point.Before this bifurcation, the asymptotic dynamics can only consist of cycles of even periods, whereas cycles of odd periods will appear after it.Moreover, this is the first parameter value at which the dynamics is chaotic on one interval in the sense of chaos of full measure on an interval .Figures 3 and 4, which are restricted to the upper right branch of the map, describe the dynamics and the structure of the attractors around the steady state x .To understand the global dynamics, we must consider the other portion, too.The global structure of the basins is similar to that described above Figure 2 for the case of coexisting stable steady states; that is, each basin consists of infinitely many intervals with the unstable two-cycle α − , α as the limit set.Thus taking the i.c. on the right or the left of the origin is not a sufficient condition for convergence to the attractor on that side.For the points close to the two-cycle α − , α in particular it is almost impossible to say whether there will be convergence to the attractor on the right or on the left.However, the two attractors and their basins will merge together for higher values of the parameter e.A further rise in the value of e takes x m 1 and x M 1 increasingly closer to the fundamental steady state, and increasingly closer to each other.As long as x m 1 < 0 and x M 1 > 0, the two absorbing intervals are still separated, but at e f μ x t μx t 1 − x t , for 3 < μ < 4. The global bifurcation occurring in the logistic map at μ 4 first homoclinic bifurcation of the origin O followed by diverging trajectories, is replaced here by a homoclinic bifurcation leading to the reunion of the two chaotic attractors.This is better illustrated in the bifurcation diagram in Figure 6.An i.c. in the immediate basin on the right tends to the attractor on the positive side in red in Figure 6 , while an i.c. in the immediate basin on the left tends to the attractor on the negative side in blue in Figure 6 .At the homoclinic bifurcation of the origin we observe their reunion: there is a unique attractor in green in Figure 6 and any point belonging to interval B : α − , α tends toward it.
This kind of dynamics persists as long as the chaotic interval is inside the repelling two cycle; that is, It is clear that the lastor final bifurcation here occurs at a value e e f , at which x m 0 α − and clearly also In Appendix A we show that x M 0 e tends to infinity faster than α e so that a finite value of e exists, say e f , leading to the final bifurcation 3.6 .As for the logistic map, after this final bifurcation the generic trajectory is divergent and thus the model is no longer meaningful .However, an invariant chaotic set inside interval x m 0 , x M 0 still exists for any larger value of e: a so-called chaotic repellor, which represents the only surviving bounded invariant set.Summarizing, we have proven the following.From an economic point of view it is interesting to note that already the onedimensional nonlinear map for the foreign exchange market is able to generate endogenous dynamics i.e., excess volatility and bubbles and crashes.For a more detailed economic interpretation of this scenario see the related setup of Day and Huang 1 .An interesting question is whether this kind of dynamic behavior may survive in a higher dimensional context; for example, when the foreign exchange market is coupled with a stock market.A first answer is provided in the following section.

The 2D Case
In this section we analyze the case in which stock market traders from H are not allowed to trade in A; that is, c A 0, while stock market traders from A are allowed to trade in H, c H > 0. In this case, stock market A decouples from the other two markets and is driven by an independent linear equation P A t 1 G A P A t whose dynamical properties were briefly discussed in the previous section .We thus have an independent two-dimensional system with the following structure: 4.2

Steady States and Multistability
With regard to system 4.2 , the equilibrium conditions for the stock price in country H and the exchange rate are given, respectively, by where q H : c H γ H / b H c H . Apart from the fundamental steady state, say O, represented by x 0 and y 0, two further equilibria denoted as P 1 and P 2 may exist, provided that e > e SN : For e e SN , the unique additional solution to 4.3 is given by x −b H q H 3 /2f < 0, which means that when e increases beyond the bifurcation value e SN , the newborn non-fundamental steady states are initially characterized by x < 0 equilibrium price H below fundamental and y > 0 equilibrium exchange rate above fundamental .Three steady states therefore coexist when the reaction parameter e which measures chartists' belief in the persistence of bull and bear markets is large enough.Although this scenario of multistability in the 2D model of interconnected markets is similar to that of the foreign exchange market in the 1D case, it should be remarked that a region of the parameter space now exists such that the system admits a unique stable steady state.A similar result has also emerged from the related model studied in Dieci and Westerhoff 22 .It was interpreted there in terms of a possible stabilizing effect of market interactions when speculative trading is not too strong.
In order to understand better which kind of bifurcations occur, Appendix B analyzes the Jacobian matrix of system 4.2 evaluated at the fundamental steady state, and proves that its eigenvalues are always real.Moreover, under the simplifying assumption that the price adjustment parameters are not too large, one of the eigenvalues is smaller than one in modulus, while the other becomes larger than 1 if the following condition is fulfilled: so that e CS represents the value of parameter e at which a change of stability occurs for the fundamental steady state.Given that f > 0, it follows that e CS > e SN , and we can then fully explain the bifurcation sequence leading to multiple steady states.By increasing parameter e, at e e SN a saddle-node bifurcation occurs and two new equilibria appear, P 1 and P 2 a saddle and an attracting node, resp. .We have thus proven the following Proposition 4.1.The two dimensional map in 4.2 always has an equilibrium in the origin, which is locally stable for e < e CS : b H F H q H .A pair of further equilibria appears via a saddle-node bifurcation at e e SN : − b H 2 q H 4 /4f b H F H q H and, therefore, for e SN < e < e CS there is coexistence of two stable equilibria.At e e CS a transcritical bifurcation takes place.
As cannot have the explicit expressions of the new pair of equilibria, cannot perform analytically their local stability analysis.Thus in the following we describe the results via numerical simulations.Note that we keep parameters d and f fixed at the same values used for the simulation in the one-dimensional case.For the sake of simplicity, we shall use the same set of parameter values in the entire paper.With regard to this, it is worth mentioning that for alternative parameter settings we have observed the same kind of dynamics and bifurcations as described in what follows.
Of the two new equilibria, the stable one, which we call P 2 , is the one further from the fundamental equilibrium.For values of parameter e in the range e SN < e < e CS were we have coexistence of two stable equilibria, the fundamental O coexists with the equilibrium point P 2 .The points of the phase plane either converge to O or to P 2 , and the two basins of attraction are separated by the stable set of the saddle equilibrium point P 1 .An example is shown in Figure 7 a , where we use the following parameter setting: a H 0.41, b H 0.11, c H 0.83, γ H 0.3, F H 4.279, F S 6.07, d 0.35, and f 0.7.
At e e CS the fixed point P 1 merges with the fundamental one and then crosses it, and the stability properties of the two steady states changes too transcritical bifurcation .It is worth noting that the range of values e SN , e CS of parameter e between the saddlenode bifurcation and the transcritical bifurcation becomes increasingly smaller as f increases compare equations 4.5 and 4.6 .For values of parameter e > e CS and close to the bifurcation, the fundamental equilibrium O is unstable while the two equilibria P 1 and P 2 are both stable.The stable set W S O of the saddle O is the separator between the two basins of attraction, B 1 and B 2 , respectively, while the two branches of the unstable set W u O have opposite behavior: one tends to attractor P 1 while the other tends to attractor P 2 .An example is shown in Figure 7 b .
As parameter e is further increased, both equilibria P 1 and P 2 become unstable via a flip or period doubling bifurcation.Moreover, a cascade of flip bifurcations, leading to chaos, will take place for both of them.However, unlike the results in the 1D model, the two sequences of flip bifurcations are not synchronized, due to the asymmetry of the 2D map.An example is shown in the bifurcation diagram of Figure 8.By fixing all parameters, except for e, we can see that equilibrium P 1 first undergoes a flip bifurcation at e e 1 and then P 2 at e e 2 > e 1 .In the narrow range e 1 < e < e 2 the points of the phase plane either converge to the stable equilibrium P 2 or to a stable 2-cycle born from the flip bifurcation of P 1 and close to it.The two basins B 1 , and B 2 are always separated by the stable set W S O of the saddle fundamental equilibrium O, while the two branches of the unstable set W u O of the fundamental equilibrium behave in an opposite manner: one tends to equilibrium P 2 and the other to the attractor born from P 1 .As parameter e increases, we observe several flip bifurcations associated with the two attractors, say A 1 and A 2 , while their basins B 1 , and B 2 are always separated by the stable set of O.The two branches of the unstable set of O still converge to the two different attractors until certain global bifurcations occur, as we will describe below.Also the structure of the attractors and that of the two basins undergo global bifurcations.
Although the two attractors A 1 and A 2 are not steady states, the long-run dynamics of the system still takes place in the same regions as that represented in Figure 7 b .In fact, the asymptotic states are either in region y < 0, x > 0, denoted as the bear region when orbits converge to A 1 or in region y > 0, x < 0, denoted as the bull region when orbits converge to A 2 .In the bear bull region, the exchange rate is below above its fundamental value, whereas stock price H is above below the fundamental value.An example is shown in Figure 9 a , where two 4-cycles coexist, while in Figure 9 b two chaotic attractors coexist, both formed by two separate chaotic areas.However, the structure of the basins of attraction B 1 and B 2 becomes much more complicated.They are disconnected, which is a consequence of the noninvertibility of the map.More precisely, for noninvertible maps the phase plane may be subdivided into regions of points having the same number of rank-1 preimages.These regions are separated by the critical curve LC, also shown in Figure 9 together with the locus LC −1 , where LC T LC −1 see Appendix C .When the parameter e changes, a portion of a basin of attraction may cross some arc of curve LC, thus entering inside a region with a higher number of preimages.This contact bifurcation causes the appearance of disconnected portions of the basin of attraction.An example is given by portion H of basin B 1 of attractor A 1 located near P 1 , which is shown to exist in Figure 9 b but not yet in Figure 9 a .The creation of this disconnected region is due to the small portion H of basin B 1 which has moved in Figure 9 b to the left of LC see arrow in Figure 9 b , thus entering a region of the phase space whose points have a higher number of preimages.Two new rank-1 preimages of H , appearing on opposite sides of LC −1 , create the disconnected portion of basin labelled H.

Global Bifurcations
The previous subsection has shown how, under increasing values of parameter e, the two attractors first equilibria P 1 and P 2 then A 1 and A 2 undergo a sequence of flip bifurcations which is not synchronized, leading the system to chaotic dynamics.The sequence of flip bifurcations can also be observed in Figure 10.From Figure 10 the existence of different intervals for parameter e can be noted, such that the dynamics in the phase plane are qualitatively the same within each range.Such intervals are denoted as A, B, C, D, and E. The borders between two adjacent intervals are associated with homoclinic bifurcations involving one or two of the three equilibria, and will be described in the present subsection.

First Homoclinic Bifurcation of P 1 and P 2
As stated above, for a wide interval of values of e, we observe two coexisting attractors A i , i 1, 2, each consisting of two parts.The dynamics on each attractor alternately jumps from one to the other side of the stable set W S P i of the saddle P i .The first global bifurcation occurring to the chaotic area is caused by the contact between the two parts constituting the chaotic attractor A i and the stable manifold W S P i , leading to a one-piece chaotic area A i .This corresponds to the first homoclinic bifurcation of the saddle equilibria P i .This bifurcation is the two-dimensional analogue of that occurring in the 1D case, described in Section 3,  AB we first observe it for P 1 , and it then occurs for P 2 at e e 2  AB > e 1 AB .In Figure 11 a , which shows the homoclinic bifurcation of P 1 , the value of e is approximately e 1 AB ∼ 3.6.Just after this global bifurcation, for e > e 1  AB but still close to the bifurcation value, attractor A 1 is a one-piece chaotic area.An interesting feature related to this homoclinic bifurcation is that the boundary of the chaotic attractor is no longer made up of only segments of critical curves, but includes both portions of critical curves and portions of the unstable manifold W u P 1 of saddle point P 1 a so-called mixed-type boundary,as described in Mira et al. 25 .This is highlighted in Figure 11 b .Clearly, the same kind of bifurcation occurs at e e 2 AB , involving the stable set W S P 2 of saddle equilibrium point P 2 and leading to a one-piece chaotic area A 2 .

Second Homoclinic Bifurcation of P 1 and P 2 , and Homoclinic Bifurcation of O
For e > e 2  AB , the two chaotic areas include the saddle equilibria P i on their border.These saddle points only have homoclinic points on one branch of their stable set: the one which is inside the chaotic area.A second homoclinic bifurcation of the equilibria P i will occur at higher values of e, involving the other side of the stable set of saddles P i , and leading to two other global bifurcations, whose effects are even more dramatic with respect to the first one.As expected, the two bifurcations do not occur simultaneously.Instead, as we shall see, each of these secondary homoclinic bifurcations of saddles P i is simultaneous to a homoclinic bifurcation of the saddle equilibrium O, involving one and then the other side of its unstable set, respectively.First the homoclinic bifurcation of P 1 occurs, at e e 1 BC , leading to the "disappearance" of the chaotic attractor A 1 and leaving A 2 as the unique attracting set .Then the homoclinic bifurcation of P 2 occurs, at e e 2  CD > e 1 BC , leading to the "explosion" of the chaotic attractor A 2 .Let us describe this sequence in our example.
By increasing parameter e, for e > e 2 AB the chaotic attractors become increasingly larger, until one of them has a contact with the frontier between its basin of attraction and that of the coexisting attractor.The first contact occurs at e e 1 BC 4.198 , involving equilibrium point P 1 , which is shown in Figure 12 a .We can see that tongues of basin B 2 have reached the boundary of chaotic area A 1 , and are accumulating along the branch of stable set W S P 1 .This means that the unstable set W u P 1 on the frontier of the chaotic area A 1 and the stable set W S P 1 whose points are accumulating on the frontier of basin B 1 are at the second homoclinic tangency of P 1 which will be followed by transverse crossing .In the meantime, we can see that tongues of chaotic area A 1 whose boundary consists of limit points of the unstable set W u O of the fundamental equilibrium have reached the boundary of the basin and have contacts with the stable set of the origin, W S O .We are therefore at the first homoclinic tangency of O which will be followed by transverse crossing .This is not a surprising situation but the standard mechanism, due to the fact that homoclinic points involve the whole stable set W S P 1 external to the chaotic area, and this branch is related to the frontier.This means that, besides the two homoclinic bifurcations occurring simultaneously at e e 1 BC , heteroclinic connections and heteroclinic loops between the two equilibria P 1 and O also occur.The effect of this bifurcation is "catastrophic:" the chaotic attractor A 1 disappears, becoming a chaotic repellor.For e e 1 BC , the unique attractor A 2 is left see Figure 12 b .For values of e not far from this bifurcation, convergence to the unique attractor may be very slow.This is due to the existence of the chaotic repellor in the same region previously covered by chaotic area A 1 and before convergence the system may exhibit a kind of chaotic behavior along the "ghost" of the old chaotic attractor A 1 sometimes it takes about 100 000 time periods before convergence to the new chaotic area A 2 can be observed .We remark that, starting from initial conditions close to P 2 , converging to A 2 , we cannot detect any differences in the dynamic behavior before and after this bifurcation, because the latter involves only the other attractor A 1 .This is clearly a global bifurcation of basin of attraction B 2 .In fact, at this bifurcation, the previous two basins merge into a unique one see Figure 12 b ; that is, basin B 2 becomes much wider and its frontier separates the points of the phase plane having bounded trajectories from those generating divergent trajectories basin B ∞ .However, it is worth noting that the numerically obtained picture of basin B 2 also includes all of the repelling cycles existing in the chaotic repellor, as well as its stable set.Namely, the colored area representing B 2 in Figure 12 b also contains the unstable equilibria O and P 1 with their stable sets, as well as infinitely many other cycles, all belonging to an invariant set characterized by chaotic dynamics which, however, has measure zero in the phase plane, so that it is not detectable in practice from the iterated points.The existence of a strange repellor, besides affecting the chaotic transient, as observed above, also causes another remarkable homoclinic bifurcation involving the chaotic area A 2 .In fact, as e increases, we approach the second homoclinic bifurcation of saddle P 2 , which is located on the boundary of the chaotic attractor.This bifurcation involves the branch of the stable set external to the chaotic area, and at the same time it also represents the second homoclinic bifurcation of the fundamental equilibrium O.The parameter bifurcation value is e e 2 CD , at which chaotic area A 2 becomes tangent to the left-hand side of the stable set W s O of the fundamental equilibrium O as can be argued from Figure 13 a , at a value of e just after the bifurcation .Again, though not visible from the figure, this occurs simultaneously to the homoclinic bifurcation involving the stable set W s P 2 and the unstable set W u P 2 , and is also related to the heteroclinic connections between the fixed point P 2 and the fundamental steady state O.The appearance of such homoclinic orbits is revealed from the dynamic effect occurring at the bifurcation.This results in a sudden increase of the chaotic area, which now also covers that of the chaotic repellor which is included in the wider chaotic area .
The asymmetry of the map implies that the contacts between the chaotic attractors and the stable manifold of O do not occur at the same time.In our example, for values of e such that e 1  BC < e < e 2 CD , the asymptotic dynamics of the exchange rate usually take place above the fundamental value, while the asymptotic values of stock price H are lower than the fundamental price.This dynamic behavior changes drastically at the global bifurcation occurring at e e 2 CD , leading to an explosion of the chaotic area.In general, for e < e 2  CD the asympotic behavior is approximately on one side of the fundamental.Apart from initial conditions taken in B ∞ , the asymptotic dynamics occur approximately either in the bear region the second quadrant, x > 0, y < 0 or in the bull region the fourth quadrant x < 0, y > 0 there may indeed be some points of the attractors located in the first or third quadrants .In contrast, for values of parameter e larger than e 2 CD , the asymptotic dynamics take place across both quadrants, and switches from one to the other at unpredictable points in time.After the bifurcation, but for e close enough to the bifurcation value, almost all realizations will be on the fourth quadrant see Figure 13 a , and only rare transitions to the area previously occupied by the chaotic repellor are observed.When e is sufficiently large, the number of iterations on each region and the number of switches becomes more frequent and totally unpredictable, so that the density of points in the two regions is the same on average see Figure 13 b .But differently, both regions become relevant to the dynamics in the time domain.Figures 13 c , 13 d represent time paths of state variables x and y, obtained with a value of parameter e larger than its second homoclinic bifurcation value e 2 CD .We remark that in the interval of values of e where a unique attractor exists that is, for e > e 2  CD , before the last homoclinic bifurcation final bifurcation described in what follows, several other periodic windows may arise, each related to a local bifurcation causing the appearance, in pairs, of a cycle saddle and a node, followed by a cascade of local and global bifurcations similar to those described earlier for the fixed points.Two periodic windows related to cycles of period 3 are clearly visible in the bifurcation diagram of Figure 10.However, as e increases, the dominant dynamics is chaotic behavior across the whole area.
From an economic perspective our findings imply that the famous bull and bear market dynamics first described by Day and Huang 1 -and also observed in the previous section-may indeed survive an extension to a higher dimensional context.However, price fluctuations may become even more intricate since now there is an additional irregular feedback from the stock market to the foreign exchange market.In addition, we see that an otherwise stable stock market may display complex endogenous dynamics when coupled with an unstable foreign exchange market.

Final Bifurcation
So far, we have observed several homoclinic bifurcations involving the chaotic area.It is worth noting that the homoclinic bifurcations occurring at e e 1  AB and e e 2 AB are also called interior crises in Grebogi et al. 26 .The reason for this is clearly related to their dynamic effect, while the bifurcations occurring at e e 1  BC and e e 2 CD are also called exterior crises, again in relation to their dynamic effect.Now let us describe the so-called final bifurcation, which is clearly an external crisis in the earlier characterization, as it leads to the destruction of the chaotic area.As seen above see Figure 13 b , at high values of e the one piece chaotic attractor comes very close to the boundary of its basin of attraction, and a contact with that boundary can easily be predicted.So far, the bifurcations have never involved the frontier of basin B ∞ , which also includes a 2-cycle saddle, {C 1 , C 2 }, whose stable set gives the boundary of the region of divergent trajectories.This cycle is shown in Figure 14 a .The same Figurere also shows that the frontier ∂B ∞ is approaching the unstable set of equilibrium point P 1 see arrow in Figure 14 a .The contacts between the frontier and the chaotic area occur at a value of e e DE , very close to that used in Figure 14 a , and we can see from the same Figurere that the contact points will appear both close to equilibrium P 1 and to the 2-cycle {C 1 , C 2 }.Thus, at e e DE , the first homoclinic bifurcation of the 2-cycle {C 1 , C 2 } occurs and at the same time it is also heteroclinic bifurcation or better, an heteroclinic connection between P 1 and the 2-cycle {C 1 , C 2 }.After that, for e > e DE , the stable and unstable sets of the 2-cycle {C 1 , C 2 } intersect, and intersections between the unstable set W u P 1 and the stable set W S C 1 ,C 2 also exist, and vice versa, between the stable set W S P 1 and the unstable set W u C 1 ,C 2 .It follows that almost all initial conditions inside the previous basin B will generate divergent trajectories, that is, the chaotic attractor turns into a chaotic repellor.This means that for e > e DE the initial conditions which generate bounded trajectories are confined to a set of zero Lebesgue measure, and for values of e close to the bifurcation we also have long chaotic transients on the "ghost" of the old attractor before observing divergent behavior.An example of such a chaotic transient is shown in Figure 14 b .

Analysis of the 3D Model
In this section we deal with the complete three-dimensional model.Our analysis mainly via numerical simulations will show that the dynamic phenomena highlighted in the previous lower dimensional models also persist in the full model.In particular, we shall see that as for the model in the previous section , the origin is always an equilibrium, and two more equilibria appear as parameter e increases, leading to bistability.A sequence of local and global bifurcations then determine the transition between different dynamic regimes, namely, to more complex coexisting attractors, up to a global bifurcation which brings about a regime of bull and bear market fluctuations, as we have seen both in the 1D and 2D model.Such regime is characterized by apparently random switches of prices across different regions of the phase space even more details on this setting may be found in Tramontana et al. 27 .
In the full model, stock market traders from countries A and H are allowed to trade in both markets; that is, c H > 0 and c A > 0. In this case, the two stock prices and the exchange rate are all interdependent, and the model has the complete structure expressed by equations 2.1 , 2.4 , 2.7 .The system, formulated in deviations although we work with deviations, in all the following numerical experiments we have checked that original prices never become negative from fundamental values, x P H − F H , y S − F S and z P A − F A , is expressed by the map T : R 3 → R 3 in the following form: The model is analytically not tractable.Apart from the fundamental fixed point, say O 0, 0, 0 , whose existence can be immediately checked, we cannot solve explicitly for the coordinates of further possible nonfundamental equilibria, nor can we obtain easily interpretable analytical conditions for their existence.A brief discussion of the steady states is provided as follows.
By imposing the fixed point condition to 5.1 , we obtain the following system of equations: We observe from 5.2 and 5.4 that any steady state must belong to both the sets of equations: y − x q H , z q A y y F S , 5.5 where This implies that when the steady state exchange rate is above the fundamental value y > 0 , steady state price A is then above the fundamental value z > 0 , whereas steady state price H is below the fundamental value x < 0 , and vice versa.From now on, we will label the region y > 0, z > 0, x < 0 as the bull region and region y < 0, z < 0, x > 0 as the bear region.By substituting 5.5 into 5.3 , we can express condition 5.3 in terms of the steady state deviation of price H only, as follows: where

5.8
Therefore, besides the fundamental solution x 0, further possible solutions are the roots of the expression in square brackets in 5.7 .When c A > 0 it becomes impossible to solve equation 5.7 analytically as it was for c A 0 .When c A is small enough, we may expect a steady state structure qualitatively similar to that of the two-dimensional subcase c A 0, with two further steady states appearing simultaneously in the bull region, via saddle-node bifurcation, and this will be confirmed by the numerical example given below.
We remark that the analytical investigation of the local stability properties of the fundamental fixed point O 0, 0, 0 is also a difficult task.The Jacobian matrix evaluated at O is given by and its eigenvalues cannot be found explicitly, nor can we write down tractable analytical conditions for the eigenvalues to be smaller than one in modulus.
We will now study the local and global bifurcations via numerical investigation, supported by our knowledge of the model behavior in the simplified, two-dimensional case.Our  0.36, and F A 1.1.In order to compare the dynamics we have chosen a value of c A not so far from zero, and lower than c H . Bifurcations similar to those described below are observed also with other parameter constellations.The numerical analysis performed in Appendix D shows that O loses stability when one eigenvalue becomes equal to 1 at e p 0.122.This probably corresponds to a pitchfork bifurcation, because we observe the simultaneous appearance of two further equilibria, which we denote as P 1 in the bear region and P 2 in the bull region .In Figure 15 we show the bifurcation diagrams of the state variable x as a function of the parameter e.As we can see in Figure 15 the effect of the local bifurcation of the fundamental steady state is qualitatively the same as for the two-dimensional subcase.That is, there exist two nonfundamental equilibria, and depending on the initial conditions, bounded trajectories are convergent either to one or to the other whereas initial conditions far from the equilibria here also give divergent trajectories, as expected .As the parameter e increases we observe bifurcation sequences involving the two coexisting equilibria, and then the two coexisting attractors.The structure of the observed bifurcations looks similar to those observed in the two-dimensional model, albeit involving stable and unstable manifolds in higher dimensions.Thus we confirm and strengthen almost all of the results of the twodimensional case, although via numerical simulations only.From Figure 15 we see that the sequence of bifurcations are asynchronous, first a flip bifurcation of the equilibrium point P 1 in the bear region, Figure 15 a occurs, at e f1 2.348, while that of the equilibrium point P 2 Figure 15 b occurs, at e f2 2.457.Then sequences of local and global bifurcations give rise to two coexisting chaotic sets, with basins which are separated by the stable set of the unstable fundamental equilibrium in the origin.The equilibrium point P 1 becomes homoclinic at e h1 3.565, while the first homoclinic bifurcation of P 2 occurs, at e h2 3.6.A global bifurcation causes the disappearance of the chaotic attractor associated with P 1 at e g1 4.215, after which we shall have a unique attractor.At first this unique attractor is associated with the bull region around P 2 , and after a global bifurcation at e g2 4.323 we have the explosion to a wide chaotic set, which covers the two regions previously disjoint, and the dynamics become totally unpredictable.The states will jump in a chaotic way from one region to the other, up to a final bifurcation probably due to a contact with the basin of divergent trajectories, which is now difficult to detect , at e f 5.06.
Note that the emergence of endogenous bull and bear market dynamics implies that the unstable foreign exchange market destabilizes both the home and the foreign stock market.With respect to the two stock markets our model thus implies that financial market liberalization in the sense of free capital movements may deteriorate market efficiency.In both stock markets we observe an increase in price volatility and persistent deviations between stock prices and their fundamental values.Of course, other effects related to financial market liberalization may counter this result.In addition, we have seen that for some parameter combinations the fixed point of the exchange rate may become stabilized in the presence of market interactions.

Conclusion
We have considered a three-dimensional discrete-time dynamic model of internationally connected financial markets, where two stock markets, populated by national and foreign fundamental traders, interact with each other via the foreign exchange market.In the latter, heterogeneous speculators are active, and their nonlinear trading rules are at the origin of complicated endogenous fluctuations across all three markets, similar to the well-known bull and bear market dynamics first observed by Day and Huang 1 in a stylized one-dimensional model.
The possibility to reduce the dimension of the dynamical system, via restrictions imposed on the activity of foreign traders, results in simplified one-and two-dimensional setups, whose analysis is simpler and helped in the understanding of those dynamic phenomena occurring in the complete three-dimensional model.While the one-dimensional case has the same qualitative dynamics of the Day and Huang 1 model, the twodimensional model represents a generalization of such dynamics to the case of two interacting markets, which can be studied by properly extending the methods and concepts used in the one-dimensional analysis.These include, in particular, the properties of noninvertible maps and the theory of homoclinic bifurcations.The numerical and graphical analysis becomes essential when switching from the one-to the two-dimensional case.Nevertheless, a suitable mix of analytical and numerical techniques allows us to detect a sequence of homoclinic bifurcations-analogous to those occurring in the one-dimensional case-through which the model switches across increasingly complex scenarios, as a crucial parameter is varied: from coexistence of two attractors in two distinct bull and bear areas, to the sudden disappearance of one of them, up to chaotic behavior on a unique attractor, with stock prices and exchange rates unpredictably switching among different regions of the phase space.Then we have seen that also in the three-dimensional model the local and global bifurcations, when considered as a function of the same parameter, follow a path strictly related to those of the two-dimensional model.From the coexistence of two attractors in two distinct bull and bear areas we see a transition to a wide chaotic set in which the jumps between the two regions become unpredictable.and to the point ξ : B α 2 .From the relations between the coefficients of the polynomial and its roots we have We can thus conclude that the product ξ 1 ξ 2 ξ tends to ∞ as fast as e, whereas we have x M 0 e 2 1 de /3 1 de /3df , which tends to ∞ as fast as e 3/2 .

B.
In this appendix we provide an analytical study of the eigenvalues of the Jacobian matrix evaluated at the fundamental steady state.
The Jacobian matrix of system 4.2 is the following: The eigenvalues are the roots of the characteristic polynomial P λ λ 2 − tr J λ det J , where tr J and det J are the trace and determinant of J, respectively.Simple computations allow us to check that tr J 2 − 4det J > 0, which rules out the possibility of complex eigenvalues.In order to localize the real eigenvalues with respect to the interval −1, 1 , it is convenient in this case to rewrite the characteristic equation in terms of the variable μ 1 − λ, as follows: Note that this implies α < 2 for any d, e > 0, as can be checked.Let us now consider the effect of increasing parameter e.It is clear that for e < b H q H F H : e CS both α and β are also strictly positive.Therefore, 0 < μ 1 < μ 2 < 2; that is, −1 < λ 2 < λ 1 < 1, where λ 1 : 1 − μ 1 , λ 2 : 1 − μ 2 .
In particular, for e b H q H F H , we obtain β 0 and therefore 0 μ 1 < μ 2 < 2. This means that λ 1 1, while λ 2 remains smaller than one in modulus.This corresponds to the loss of stability of the fundamental steady state, through a transcritical bifurcation, as can be argued from the numerical analysis performed in Section 4.

C.
In this appendix we provide the equation of the critical curve LC −1 of map T defined in 4.2 .
Starting from the Jacobian matrix B.1 , we can obtain LC −1 , which is defined as the set of points satisfying det J x, y 0. This equation can be reduced to the following form: x Ay 2 By C, C.1 where

C.2
The image LC T LC −1 is a curve which separates the plane in regions whose points have a different number of rank-1 preimages.Here we have the case that any point has at least one rank-1 preimage, while those on one side of curve LC have three rank-1 preimages

D.
Given

D.3
Following Farebrother 28 the eigenvalues of the polynomial given earlier have to satisfy the following conditions equivalent conditions can be found in Gandolfo 29 , Yury's condition in Elaydi 30 and Okuguchi and Irie 31 : In our case the condition i is satisfied if e < 0.122 approximate value .Condition ii becomes 4.5593 1.0306e > 0 and is obviously satisfied for positive values of e. Condition iii is satisfied for e < 1.0738 and e > 3.445.The last condition is fulfilled for e < 3.4145.
Starting from values of the parameter e positive and close to 0 and increasing the value, the first condition which is violated is i , so e 0.122 is the bifurcation value at which the fixed point loses stability, and at this value one eigenvalue is equal to 1.

Figure 1 :
Figure 1: Stable non-fundamental steady states.a and its enlargement b are obtained using the following set of parameters: d 0.35, e 2.687, and f 0.7.

Figure 2 :
Figure 2: Basins of attraction.In a the immediate basin of the steady state x and its rank-1 and rank-2 preimages are represented in blue.In b an enlargement of the interval between O −1 and α with the alternance of intervals belonging to the basin of attraction of x in blue and x − in green are shown.The parameters are as in Figure 1.

Figure 4 :
Figure 4: Homoclinic bifurcation of x .The two chaotic intervals around x merge into a unique chaotic interval for e 3.89.The remaining parameters are as in Figure 3.

Figure 5 :Figure 6 :
Figure 5: Homoclinic bifurcation of O.The two chaotic intervals around x and around x − merge into a unique chaotic interval for e 4.5659 .The remaining parameters are as in Figure 4.

√ 3 / 2 −
1 1/d , x m 1 and x M 1 merge in x 0. Each trajectory starting from interval x m 0 , x M 0 now covers the whole interval I − ∪ I x m 0 , x M 0 homoclinic bifurcation of O .The basin of the enlarged invariant interval I − ∪ I is the whole interval B : α − , α Figure 5 .Put differently, the two disjoint symmetric attractors exist as long as each unimodal part of the map behaves as the standard logistic map, x t 1

Proposition 3 . 1 . 1 1
The bimodal map in 3.2 is symmetric with respect to the origin, with a local maximum point at x M −de /3df and local maximum value x M 0 2 1 de /3 1 de /3df .An unstable fixed point in the origin always exists.A positive fixed point x e/f is locally asymptotically stable for de < 1.A flip bifurcation of x occurs at de 1.The attracting set on the half-line x > 0 is included in the absorbing intervalI x M 1 , x M 0 for 0 < e < 3 √ 3/2 − 1 1/d , disjointfrom the symmetric one, on the half-line x < 0, and the basins of the two disjoint invariant sets consist of infinitely many intervals, having the unstable 2-cycle with periodic points ( α − , α ) as limit set.At e 3 √ 3/2 − 1 1/d the homoclinic bifurcation of the origin occurs, and for 3 √ 3/2 − 1 1/d < e < e f the dynamics are bounded in the interval x m 0 , x M 0 .For e > e f the generic trajectory is divergent.

Figure 7 :
Figure 7: Change of stability in the two-dimensional case.Parameters are a H 0.41, b H 0.11, c H 0.83, γ H 0.3, F H 4.279, F S 6.07, d 0.35, and f 0.7.In a , at e 0.124697, the attractors are the fixed points P 2 and O, their basins are bounded by the stable manifold of P 1 .In b , at e 2.22, the attractors are P 1 and P 2 , the border between basins B 1 and B 2 is the stable manifold of the fundamental equilibrium O.

Figure 8 :
Figure 8: Bifurcation diagrams b.d. for short .In blue the b.d.corresponding to an initial condition close to P 1 , whereas the b.d. in red is obtained with an initial condition close to P 2 .Panel b is a magnification of a portion of the b.d. in a , which emphasizes the values of parameter e at which the steady states lose stability.

Figure 9 :Figure 10 :
Figure 9: Basins of attraction.Basin B 1 of the attractor located around P 1 is in pink, whereas basin B 2 , whose points lead to the attractor around P 2 , is in orange.In a , for e 3.43, attractors A 1 and A 2 are two coexisting 4-cycles.In b , for e 3.56, the attractors are two coexisting two-piece chaotic attractors.

Figure 4 .
Figure 4.The latter was due to a contact between a critical point on the boundary of the chaotic interval and the unstable steady state.Here we have a contact between arcs of critical curves, which constitute the boundary of the chaotic attractor see Mira et al.25 , and the stable set of the saddle.From Figure10we can see that such global bifurcations also occur in an asynchronous manner: at e e 1 AB we first observe it for P 1 , and it then occurs for P 2 at e e2  AB > e 1 AB .In Figure11 a, which shows the homoclinic bifurcation of P 1 , the value of e is approximately e1

Figure 11 :
Figure 11: First homoclinic bifurcation of P 1 .a shows the contact between the two pieces of attractor A 1 and the stable set W s P1 , at the bifurcation value e e 1 AB 3.6.b portrays the one-piece chaotic area A 1 after the bifurcation, at e 3.65, whose boundary is made up of pieces of both critical lines denoted as LC and unstable manifold W u P1 .

Figure 12 :
Figure 12: One-side homoclinic bifurcation of O. a shows the situation at the bifurcation value e 4.198, while b portrays a situation just after the bifurcation, at e 4.2.

Figure 13 :
Figure 13: Homoclinic bifurcation of O and final bifurcation.In a , we take e 4.3, while in b e 4.893.The points that will be involved in the contact between the strange attractor and the basin boundary can easily be guessed.In c and d we represent the dynamics of the state variables x and y in the time domain, switching between bull and bear markets, for e 4.75.

Figure 14 :
Figure 14: Homoclinic bifurcation of O and final bifurcation.In a , the value of e is 4.893 , while in b e 5.05.

Figure 15 :
Figure 15: Bifurcation diagram of the dynamic behavior of x as a function of the parameter e, in the threedimensional model, at the other parameter values given in the text Section 5 .Pitchfork bifurcation of the fundamental O at e p 0.122.Flip bifurcation of P 1 at e f1 2.348, flip bifurcation of P 2 at e f2 2.457.First homoclinic bifurcation of P 1 e h1 3.565, first homoclinic bifurcation of P 2 at e h2 3.6.Global bifurcation causing the disappearance of the chaotic set with P 1 at e g1 4.215, global bifurcation causing the explosion to a wide chaotic set at e g2 4.323.Final bifurcation at e f 5.06.
. The points belonging to curve LC have two merging rank-1 preimages in a point belonging to LC −1 and one more preimage called extra preimage in Mira et al. 25 .An example of curves LC −1 and LC is shown in Figure 9.As briefly explained in the text, such curves are responsible for the global bifurcations occurring to the structure of the basins of attractions.Disconnected portions of the basins can only emerge in the case of noninvertible maps, and are associated with contacts of the basin boundary with curve LC interested readers are invited to consult Mira et al. 25 .
The excess demand, in turn, depends not only on the stock traders who are active abroad, but also on foreign exchange speculators.The latter group of agents consists of technical and fundamental traders.The exchange rate for period t 1 is where d is a positive price adjustment parameter.Note that the stock orders placed by the stock traders are given in real units, so that these traders' demand for currency is the product of stock orders times stock prices.In particular, P y : 1 − a H b H c H −a H c H γ H −dc H 2x γ H y F H 1 − d c H γ H x F H − e 3fy 2 We simplify the analysis by introducing the additional requirement which is largely fulfilled in our numerical examples that parameters d and a H are not too large, namely, b H c H a H dq H F H < 2. B.7 the parameters selection used in this work that is, a H F A 1.1 , from 5.9 the Jacobian matrix of the three dimensional map evaluated at the so that we look for the necessary and sufficient conditions for O to have all the eigenvalues less than one in modulus, roots of the characteristic polynomial: