Jacopo Bizzotto, Stefano Bolatto, Stefania Minardi

Computer Science and Simulation for Economics

Project work on

"Lux and Marchesi: A Stock Exchange Model"


The applet requires Java 1.4.1 or higher to run. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4 applets (Safari works, IE does not). On other operating systems, you may obtain the latest Java plugin from Sun's Java site.


created with NetLogo

view/download model file: lmmodel.nlogo


This is a model of a financial market with heterogeneous agents. Some of them are influenced by the sentiment of their closest colleagues regarding the future evolution of the market, while the others act in a rational way.
Our model tries to replicate the work of Thomas Lux and Michele Marchesi in Moduleco with Netlogo, and can be considered a revised version of Artificial Financial Market
(made by Carlos Pedro Gonçalves, 2003), a model that can be found in your Netlogo Models Library.
The crucial difference between our work and AFM is the introduction of a new kind of agent, which acts on a rational base, and makes its decision on the basis of the real value of the share.
The market is simplified, as it contains just one kind of share and the operators can trade only one unit per time.
Every period, news (good or bad) reaches the market, and each operator can choose between selling and buying a share.

Click the SET UP button to set up the operators (patches).
Click the GO button to run the simulation.
The operators, or agents, can be divided in two categories: “noise-traders” (NT) and “fundamentalist” (FD). With the slider FUNDAMENTALIST you can choose the average percentage of fundamentalists.
The NT are characterized, as in AFM, by the volatility of their opinions, their sensitivity to the news, their propensity to sentiment contagion and to imitation (the sentiment contagion refers to the sentiments of the NT surrounding the patch; the imitation is concerned with the FD neighbours).
To set these features you can use the slides provided. Each slide defines the maximal value which the features can reach. Then every operator gets a randomly-distributed value between 0 and the max.
The FD have only one feature: the behavior volatility, which determines their chances of turning into NT.

The GO procedure is based on the AFM model. First new information arrives on market, and as in AFM the news has a normal distribution with a mean of zero. Despite all the values which the news can have, every value above 0 is turned into 1 (good news) and every value below 0 is turned into -1 (bad news).
The NT act first: they set up their opinion (they can be optimistic or pessimistic) and then decide between buying and selling.
As in AFM, the opinion is the results of many factors: the opinion of the NT neighbours (as it was in the last period) multiplied by the propensity to sentiment contagion, the mood of the FD neighbours multiplied by the propensity to imitation, the nature of the news, multiplied by the news-sensitivity, and a random value normally distributed (the mean of the random value is set by the slider EPSILON, while its variance is set by the slider OPINION-VOL).
The behavior of the NT is partially rational, as the new information affects their behavior. It is also partially irrational, as it takes into account the behavior of the neighbours during the last period, and there is also a random component in their decision rule.
The FD act after the NT, but as a matter of fact they don’t take into account the action of the NT this period, they just compare price and real value of the share and act as a consequence.
After all the trading the price and the return of the share are obtained as a result of everybody’s action.
If the return of the share moves in the direction “suggested” by the new information, the irrational operators become more confident on their neighbours, and the herd behavior of the NT increases. That means the propensity to market contagion is increased by the amount of the return. The effect is the same if after a good news the return increases, or after a bad news the return decreases. If the news is not followed by the expected movement of return, the confidence decreases.
At the end of every period every patch has a certain chance of changing the type: the NT have a chance set by the slider NEW FUNDAMENTALIST of turning into fundamentalists.
On the other hand FD can turn optimistic or pessimistic if one of the two groups has a number of members at least as big as the value of the slider OPINION VOLATILITY surrounding the fundamentalist patch.

Our model, as Artificial Financial Market, presents very frequent crashes and bubbles, normally due to an unusual dominance of one mood over the other in the NT.
AFT simulations often end up in polarized situations, with black areas and pink areas well defined. However, in our model, these situations are basically avoided. This is due to the existence of Fundamentalist operators, who act regardless of their neighbours.
A rational behavior can enhance the chances of abnormal movements of the price as the rational agents move in the same direction at the same time.

The screen is the market, the white patches are the fundamentalists, while the pink ones are the optimistic NT, and the black ones are the pessimistic NT.
The simulation has also four graphs: the price, the return, the volatility of return, and the variations of the price as a percentage are plotted against time.
If you want to notice what happens at every step of the period you can click the button STEP ONCE instead of GO.

It can be interesting to see what happens to the market if you change MAX-NEWS-SENSIBILITY, PROPENSTY-TO-IMITATION, and PROPENSITY-TO SENTIMENT-CONTAGION.
While higher values of the first two parameters will probably lead to an unstable market, the third parameter is positively correlated to polarization.

In our model, as explained before, the transactions regard only one share per time.
What if the agents could swap more shares for each transation?