Businesscyclesv9

Businesscyclesv9 preview image

1 collaborator

Default-person Jean van Haperen (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.5 • Viewed 395 times • Downloaded 32 times • Run 0 times
Download the 'Businesscyclesv9' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

breed [fundamentals fundamental]
breed [trendfollowers trendfollower]


fundamentals-own [
stock
  ]

trendfollowers-own [

  stock
 
  ]

turtles-own
[
  pricepaid
]

globals
[ 
  pricet
  pricet-1
  fundamentalvalue
    trendedvalue
   purchase?
   pricetx
  novolume?
]

to setup
  __clear-all-and-reset-ticks
  set-default-shape fundamentals "house"
  set-default-shape trendfollowers "person"
  create-ordered-fundamentals Numberoffundamentals
  [setxy random-ycor random-xcor]
  create-ordered-trendfollowers Numberoftrendfollowers 
  [setxy random-ycor random-xcor]
  set pricet random 50 + 10
  set pricet-1 random 50 + 10
  set trendedvalue random 50 + 10
  set fundamentalvalue 40
 
  ask fundamentals
  [set stock noStocksperTrader]
  
  ask trendfollowers
  [set stock noStocksperTrader
  ]
  set novolume? 0
end 

to go
  
  
  
  set fundamentalvalue fundamentalvalue + IncreaseFundamentalvalue
  set pricet-1 pricet
  set pricet mean [pricepaid] of trendfollowers
  ask-concurrent trendfollowers [buyorsell]
 

  tick
end 

to buyorsell
    
    without-interruption [
    set purchase? 0
   
     ifelse novolume? >= 1 and mean [stock] of trendfollowers != 0 [set trendedvalue trendedvalue - (1 / count trendfollowers) * novolume?][set trendedvalue (2 * pricet - pricet-1)]
     
     
     if any? fundamentals with [stock > 0] and trendedvalue > pricet
     [set purchase? 1]
    
    
     if any? trendfollowers with [stock > 0] and stock > 0 and pricet < fundamentalvalue
     [set purchase? -1]
       
    if purchase? = 1 [
    ask one-of fundamentals with [stock > 0 ] [set stock stock - 1]] 
  
    if purchase? = -1 [
    ask one-of fundamentals [set stock stock + 1]] 
    
    if purchase? = 0 [set novolume? novolume? + 1] 
     
    if purchase? = 1
      [set stock stock + 1
        set novolume? 0]
    
    if purchase? = -1
      [set stock stock - 1 
      set novolume? 0]
      
       if purchase? = 1
      [set pricepaid 0.5 * (fundamentalvalue + trendedvalue)]
      
      
       if purchase? = -1
      [set pricepaid 0.5 * (fundamentalvalue + trendedvalue)]
      
      if purchase? = 0 [
        if mean [stock] of trendfollowers = 0  [set pricepaid fundamentalvalue]
        if mean [stock] of fundamentals = 0 [set pricepaid trendedvalue]
        if mean [stock] of trendfollowers != 0 and mean [stock] of fundamentals != 0 [set pricepaid 0.5 * (fundamentalvalue + trendedvalue)]
        ]
      
     
    ]
end 
  
  

There is only one version of this model, created over 10 years ago by Jean van Haperen.

Attached files

File Type Description Last updated
Businesscyclesv9.png preview Preview for 'Businesscyclesv9' over 10 years ago, by Jean van Haperen Download

This model does not have any ancestors.

This model does not have any descendants.