Marianna Caldana, Paolo Cova, Umberto Viano

Computer Science and Simulation for Economics

Project work on

"Fundamentalists and imitators in a simple stock market."

 

The applet requires Java 1.4.1 or higher. 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. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.


created with NetLogo

view/download model file: multiagent.nlogo

WHAT IS IT?

The aim of our program is the creation of a financial market in which a single stock is traded; the agents (three categories) who act on such market are characterized by bounded rationality and differentiated into three types according to their behavior (Imitator, Fundamentalist and Stubborn); moreover, every agent has a tied budget, expressed by an endowment and a maximum debt they can reach before default. Through the imposition of some conditions, in part introduced by the user who can easy interact with the program and in part determined casually, we have realized some interesting simulations with various results, demonstrating that simple hypotheses are sufficient to induce complessity.


HOW TO USE IT

Click the SET UP button to setup the operators (patches).
Click the GO button to run the simulation.
The operators, or agents, can be divided into three categories: “imitator” (I), “fundamentalist” (FD) and "stubborn" (ST).
With the sliders FUNDAMENTALISTS and IMITATORS you can choose the average percentage of fundamentalists and imitators; the percentage of Stubborns is determined residually.
The I are characterized, as in AFM (Artificial Financial Markets, see below), by the volatility of their opinions, the sensitivity to the news, the propensity to sentiment contagion, imitation and decision (the sentiment contagion refers to the sentiments of the I surrounding the patch; the imitation is concerned with the FD neighbours; the decision with the ST neighbors).
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 maximum.
The FD have only one feature: the behavior volatility, which determines their chances of turning into I.

The procedure "GO" is based on the AFM model. First, new informations arrive on the market and the news have a uniform distribution between 0 and 1. Despite all the values which the news can have, every value above 0.5 is turned into 1 (good news) and every value below 0.5 is turned into -1 (bad news).
The I 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 result of many factors: the opinion of the I neighbours (as it was in the last period) multiplied by the propensity to sentiment contagion, the mood of the FD and ST neighbours multiplied by the propensity to imitation and decision, 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 I is partially rational, as the new information affects their behavior. On the other hand it is 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.
Another type of agent is Stubborn: they buy or sell the share randomly, they are not influenced by other agents.
After the trading is completed, the price and the return of the share are obtained as a result of everybody’s action, and the program notes the agents' balance.
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 herding behavior of the I increases. That means the propensity to market contagion increases by the amount of the return. The effect is the same if after good news the return increases, or after bad news the return decreases. If the news are 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 I 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 three groups has a number of members at least as big as the value of the slider OPINION VOLATILITY surrounding the fundamentalist patch. Only the ST cannot change into anyone else, and no-one else can become ST.


THINGS TO NOTICE

With the model described above, we have realized a great number of simulations, changing the parameters from time to time and turning on or off the switches, obtaining some interesting results.
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 I (Noise Traders in AFM).
At the beginning, if endowment and maximum debt are high, the market will be more stable (even if price or return fluctuations are possible),especially in the starting phases of the market and the failed agents are unusual. In our simulation we have fixed endowment at 30 and maximum debt at zero; different values of these parameters would postponed the same scenarios.


THINGS TO TRY

How can be the results different?
Watch how different are result when all-or-just-neighbors? switch is ON or OFF; when strong-change? switch is ON or OFF; when weak-change? is ON or OFF: the first one refers to the fact the user can choose if the I decide their behavior on the basis of the 8 closest patches or of the whole world; the other ones refers to the majority required to change their opinion.
It is also interesting to look at composition of the operators; the behaviour of agents that are affected by other operators produces different situations in the market, in price and return fluctuations and in case of default.
In general we can say that when imitators are affected only by their own 8 neighbours, the market is very stable, especially if “weak change” switch is activated. Otherwise if imitators are affected by all agents the market (especially in a second phase: 51st-100th steps) presents very frequent crashes and bubbles.
Moreover the results of simulations can vary when the weight of each kind of agents changes, in fact we can see that if the market is dominated by fundamentalists it is less stable and this instability continues during the simulation and produces a great number of failed agents, also because there are relevant bubbles. At the contrary, a market dominated by imitators is unstable in a first moment, but it became homogeneous step to step and defaults stop.
A scenario dominated by stubborns is more stable at the beginning, but it becomes unstable during the second phase, price rises producing a real “explosion” that determines a great number of defaults.


NETLOGO FEATURES

The screen is the market, where the agents, which are rapresented by patches, assumes different color.
The agents who enliven the market through the sale and the purchase of actions are divided into three categories, based on their behavior:
1] Fondamentalists (white). They decide to buy or sell the asset if its present value is greater or smaller than the price of the asset;
2] Imitators (green). They base their decision on the behavior of their eight neighbors or, if the all-or-just-neighbors? switch is turn on, of all the other agents who operate in the market. At first, they become optimistic, changing their color (violet), or pessimists (black), as a result of the arrival of the news on the asset; subsequently they will modify their opinion basing on the behavior of the other agents. The user can choose the degree of dependency of their decisions, activating the switch called strong-change?, in which case such agents will change their decision only with a strong majority of purchases or sales operated by their neighbors, or the switch weak-change?, in which case they change the direction of their exchange decisions simply with a parity of purchases and sales of the neighbors; if such switches were not activated, the agent imitator would follow the behavior of the absolute majority of the neighbors. The user can choose the weight, in terms of percentages, that the imitators give to the decision of all tipology of agents;
3] Stubborns (red). The stubborns represent the noise traders of the market, deciding randomly whether to buy or to sell the asset.
The user can choose the maximum percentage of agents of type fondamentalists and imitators (whose sum must not be over 100, otherwise there will be a message of error and the program will stop), therefore the program extracts a random number on the basis of which the proportion of such tipology of agents is determined; the number of stubborns is determined residually.
The sum of the decisions of every agent determines the return of the asset, that will modify the price: every step the program re-computes the value of the balance of the operators, that is the number of own assets times the asset price, and the liquidity, modified by adding (in case of sale) or subtracting (in case of purchase) an amount equal to the price of the asset.
An agent fails when her portfolio value and her liquidity is inferior than themaximum debt established by the user of the program. If only liquidity is inferior than maximum debt agent sells his shares to exceed its threshold value; otherwise if only portfolio value is inferior than maximum debt, because of a great number of short sales, liquidity is mobilized to buy assets just to get the portfolio value over its superior limit again.
Failed agents change their colour and they become yellow, they stop to belong to one of the three typologies of agents and lose their shares, moreover they don’t affect the other agents’ behaviour any more.
The simulation has also six graphs: the price, the variation of price as a percentage, the return, the volatility of return, the minimum-average-maximum portfolio value and the minimum-average-maximum liquidity.


SETTING THE PARAMETERS

It can be interesting to see what happens to the market by changing MAX-NEWS-SENSIBILITY, PROPENSITY-TO-IMITATION, PROPENSITY-TO SENTIMENT-CONTAGION and PROPENSITY-TO-DECISION (they characterize the behaviour of imitators with respect to news and to the opinion of imitators, fondamentalists and stubborns).


EXTENDING THE MODEL

As explained before, in this market agents can swap only one type of stock per time; furthermore, the number of shares is potentially infinite, because agents can sell or buy the stock when they want with an "invisible counterpart" and the stock price is calculated on the basis of the direction of the trades and not on the operators' opinion.
What would happen if these restrictions were removed?


CREDITS AND REFERENCES

To write our program, we started from these these models:
- Wilensky U., VOTING, 1998 ( http://ccl.northwestern.edu/netlogo/models/Voting )
- Gonçalves C.P., ARTIFICIAL FINANCIAL MARKET, 2003
( http://ccl.northwestern.edu/netlogo/models/community/Artificial%20Financial%20Market )
- Bizzotto J. - S.Bolatto - S.Minardi, LMMODEL, 2005
( http://web.econ.unito.it/terna/tesine/luxandmarchesi )