The applet requires Java 1.5 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: stock_market_with_simplified_book.nlogo
This model is a multi-agent model in which a stock exchange is simulated. Each agent owns some features that univocally identify it. The price formation process is realised through the mechanism of a negotiation book. The model is able to identify the operator in the default condition.
There are 2 types of agents,trend-followers, who act looking at the present time, and hedgers, who have memory of what happened in the last negotiations.
Agents are identified by patches. There is only one security available for exchange.
Every patch has got an "endowment" variable, which shows the amount of liquid resources available for title purchases, and a "quantity" variable, which shows the number of titles in portfolio for every operator. The initial values of "endowment" and "quantity" can be fixed by the user through slider. Therefore wealth, every instant, will be equal to
Wealth = endowment + price * quantity
Proper of every agent is, besides, the coeff-risk-adversion variable, that quantifies the aversion to the risk of every patch.
During the simulation, agents, every instant, arrange themselves from a side or from the other of the book: a book variable assumes value 1 if the operator arranges himself from the side of the offer otherwise the variable assumes value -1.
Information is included in the model. It is propagated in two ways: through some "vehicle" operators, turtles agents which, with their movements, have the ability to influence the "information" variable, proper of every patch, or with rules of proximity. Through the use of a slider, the user can decide how many near patches with equal information are necessary to influence an agent and to determine the changing of his "information" variable. This variable can assume two determinations: +1, connected with positive expectations about the price of the security, and -1, which means that the agent expects a decrease in the price of the security.
During the negotiation, the agents that purchase titles assume red color, while the agents that sell titles assume green color. The agents in default will be black in colour.
Trend followers’ strategy is speculative: they decide to formulate an offer of purchase if the individual price ("own-price"), interpretable as the price expected by the operator, is higher than the price formed in the last bargaining ("price"). Otherwise they decide to sell. The mechanism of formation of the own-price is the following:
uniform-tf = random number from 0 to price;
information-power-tf = variable defined by the user through slider, that defines the impact of the information on the expected price of the operators.
Hedgers’ strategy is conservative: the mechanism of formation of the individual price keeps in mind the average of the last ten prices ("mean-price" variable) happened on the market; if such average is lower than the expected price, the agents will decide to purchase. Otherwise they decide to sell. Thus expected price will be:
uniform-hg = random number from 0 to mean-price;
information-power-hg = variable defined by the user through slider, that defines the impact of the information on the expected price of the operators.
They are the subjects whose "endowment" and "wealth" variables are both equal or less than zero. Such operators assume a black coloration and they can’t operate on the market anymore. Starting from the bargaining following to the default, the operators have the possibility to return active on the market with a probability "prob-ret" defined by the user through a slider.
The model has been realized using two different types of a simplified book mechanism. It is also possible to decide whether to give the advantage of "leaving the first word to the other" to the buyers or to the sellers.
Exchanges always happen for unitary quantities.
The first type of model finds the agent with the minimum offered price of sale and the one with the maximum price of purchase, and matches them. The proposals of purchase and sale result therefore ordered and the exchanges among agents continue until the minimum price to which an agent who has not yet exchanged is ready to sell doesn't exceed the maximum price to which someone is ready to purchase or, obviously, when they are not more buyers or sellers in the market.
The second approach consists instead of casually combining the patches arranged in the two sides of the book: the exchange between the two agents will happen obviously only if the price proposed by the seller is smaller than that proposed by the potential buyer. As in the previous case, the exchanges end when all the operators present in one of the two sides of the book of negotiation have been combined.
In both the types of book, the price to which the bargaining is effected is the price of sale in the models that give an advantage to the buyer, that of purchase in the models that give an advantage to the seller.
The user can choose which kind of matching rule to use by choosing "random" or "ordered" on the chooser "book-type" and whom to give the advantage in the negotiations by choosing between "buyers" and "sellers" on the chooser "market-advantage".
It is possible to set the initial conditions, the probability of an agent in default to return active, the number of the turtles which spread information, the probabilty to carry "positive information" (through the slider "pct-good"), the variables of "information power", the probability of an agent to be trend-follower or hedger.
To setup the model use the "setup" button and to start the simulation click on the "go" button.
The initial price is fixed equal to every agent’s initial wealth (initialwealth) divided by 3. The number of turtles (number), the probability that they are carriers of positive information (pct-good), the number of patches with the same information necessary to influence an agent (change-info-influence), the influence of the information on the expected price of the two categories of agents (information-power-tf and information-power-hg), the endowment (initialwealth) and the initial quantity (initial quantity) are values defined by the user through slider.
One of the problems met in the construction of the model concerned the fact that the price, once begun a drop, continued up to reach the 0 and negative values. This behavior derives from the fact that the single ones "values expected by the operators" ("own-price") are determined as percentages of price or as an average of prices.
To resolve this problem, the user has the possibility to activate the switch "rescuers", that, if activated, forces the trend-followers agents to automatically arrange themselves from the side of the demand if the price goes down below a certain threshold (identified in the maximum value of the vector of the prices divided by 6 and modifiable only from the code). This allows the price, in the greatest part of the simulations, to remain above the value 0.
The formulas by which the agents formulate their strategies use some arbitrary values. The user could try to adjust these formulas according to his will.
The idea of the model is original. We inspired to the model "Artificial Financial Market II - Tail Risk" by Carlos Pedro Goncalves to characterize the different types of agents.
The model was realized during the course of "Computer science, simulation and economics" (2005-2006) by Professor Pietro Terna at the University of Turin. The authors are Michele Ciccone, Luca Regis and Daniele Saglia, who created this model under the supervision of Professor Pietro Terna, who we would like to thank.