Price, Personality and Market Equilibrium

Price, Personality and Market Equilibrium preview image

1 collaborator

Default-person Hossein Sabzian (Author)

Tags

behavioral finance 

Tagged by Hossein Sabzian almost 5 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.1 • Viewed 513 times • Downloaded 34 times • Run 0 times
Download the 'Price, Personality and Market Equilibrium' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This model is aimed at explaining how price of a stock (Stock A) can affcet the market equilibrium when it is mediated by traders'personality.

HOW IT WORKS

There is a market where a single stock ( Stock a) is traded by two types of trader's personality. these include momentum personality and contrarian personality. Traders that have momentum personality buy the stock when its price is increased and sell it when the price gets decreased. contrarian do the opposite meaning that they buy in the price decrease and sell in the price increase. traders have an evaluation period that when it is completed they act ( buy or sell).This evaluation period is actually the length of time period of stock A price that the analysis of it volatility is the basis of traders' action.

HOW TO USE IT

number-of-traders Slider: All traders that participate in the markert

Number-of-stock-A-holders Slider: All those traders having stock A

percent-of-momentum-personality Slider: Traders that have a momentum personality and the rest have the contrarian personality.

price-of-stock-A Input: It sets the price of stock A

Evaluation-period Input: length of time period of stock A price that the analysis of it volatility is the basis of traders' action

Time-period Input: it sets the length of model run

Experiment-seed Input : it sets a fixd experiment for model runs

THINGS TO TRY

Increase the momentum personalities to 70% and see the effect of stock A price change on the market equilibrim ( stock holders and non-owners )

Consider the following questions:

Why the variance of stock frequency distribution decreases when the traders frequently buy?

Why the variance of stock frequency distribution increases when the traders frequently sell?

EXTENDING THE MODEL

Add a specific evaltauion-period for each person.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

turtles-own [
personality ;Type of personality including momentum & contrarian
stock-a-list ; It gets 1 one I buy it and 0 when I sell it.
]

globals [
stock-a-price-vector
selected-stock-a-price-vector
mean-of-price-vector
mean-of-selected-price-vector
initial-stock-holders
]

to setup
ca
   random-seed Experiment-seed

   ask patches [set pcolor white ]

   create-turtles number-of-traders [ ; number-of-persons is set by a slider
      setxy random-xcor random-ycor
      set shape "person"
      personalities-distribution  ;; momentum & contrarian
      set stock-a-list [0]        ; having no stock
      set color red               ; those who have not stock are red
                                    ]

   ask n-of ((percent-of-stock-a-holder / 100) * count turtles)  turtles [   ; percent-of-stock-a-holder is set by a slider
      set stock-a-list [1]        ; having stock
      set color blue              ; those who have  stock are blue
                                   ]

   set stock-a-price-vector (list Price-of-stock-a) ; Price-of-stock-a is set by an input box

   set initial-stock-holders count turtles with [ sum stock-a-list > 0 ]
reset-ticks
end 

to go

   If ticks = time-period [stop] ;; Time period is set by an input box

  ask turtles [ personalities-distribution ] ; type of personalities (momentum or contrarian) are set here by slider

   stock-a-price-updata

   if is-evaluation-period-completed?  [
   set mean-of-selected-price-vector (mean selected-stock-a-price-vector );;;;; take the mean of vector
   ask turtles [if mean-of-selected-price-vector = indicator [ifelse random-float 1 > 0.5 [sell-stock ] [buy-stock]] ]  ;;;;;; No change in stock price
   ask turtles [ if  mean-of-selected-price-vector > indicator [act-based-on-increase]  ]                               ;;;;;;; increase of stock price
   ask turtles [if mean-of-selected-price-vector <  indicator [act-based-on-decrease]  ]                                ;;;;;;; decrease of stock price
   ]

   ask turtles [ color-updating rt random 90 lt random 90 fd random-float 1]
tick
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Helper procedures


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Setup & go procedure

to personalities-distribution
 ifelse (random-float 1 <= percent-of-momentum-personality) [set personality "MOMENTUM" ][set personality "CONTRARIAN"] ; percent-of-momentum-strategist is set by a slider
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Go procedures

to stock-a-price-updata

set stock-a-price-vector (lput Price-of-stock-a stock-a-price-vector )   ;;; Updates the vector based on current price data
set mean-of-price-vector mean(stock-a-price-vector) ;;;; Mean of price vector
set selected-stock-a-price-vector stock-a-price-vector  ;;;; save the vector in a selected vector
end 

to-report is-evaluation-period-completed?

 while [length selected-stock-a-price-vector  > evaluation-period-length ] [
 set selected-stock-a-price-vector remove-item 0 selected-stock-a-price-vector         ;;; when the vector exceeds the evaluation period length, it trims it.
  ]
report length selected-stock-a-price-vector  = evaluation-period-length
end 

to-report indicator
 report item 0 selected-stock-a-price-vector   ;; the first element of vector used for comapring with the mean.
end 

to act-based-on-increase
  ifelse personality = "MOMENTUM" [buy-stock] [sell-stock]
end 

to act-based-on-decrease
   ifelse personality = "MOMENTUM" [sell-stock] [buy-stock]
end 

to sell-stock
if sum stock-a-list > 0 [
set stock-a-list lput -1 stock-a-list
ask one-of other turtles [set stock-a-list lput 1 stock-a-list  ]
                       ]
end 

to buy-stock
set stock-a-list lput 1 stock-a-list
ask one-of other turtles with [sum stock-a-list > 0] [set stock-a-list lput -1 stock-a-list]
end 

to color-updating
  ifelse sum stock-a-list > 0 [set color blue ] [ set color red]
end 

There is only one version of this model, created almost 5 years ago by Hossein Sabzian.

Attached files

File Type Description Last updated
Price, Personality and Market Equilibrium.png preview Preview for 'Price, Personality and Market Equilibrium' almost 5 years ago, by Hossein Sabzian Download

This model does not have any ancestors.

This model does not have any descendants.