Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 24

An Agent-based Financial

Market in Netlogo

Blake LeBaron
International Business School
Brandeis University
www.brandeis.edu/~blebaron

SFI CSSS, 2007


Santa Fe, NM
Goals
A simple/transparent market simulation
 Easy to use modeling language
(Netlogo)
 “Code as theory”
Outline
 Description
 Basic economic structure
 Trading strategies
 Market clearing
 Simple simulation results
 Replicating features
 Convergence and parameters
Basic Economic Structure
 Assets
 Equity
 Cash (risk free)
 Preferences
 Consumption
Assets
 Equity (Stock)
 Risky dividend, Autoregressive order 1
 Fixed supply (1 share)
 price = p(t) (Determined by market)
dt = d + r (dt- 1 - d ) + et
Dt = e dt

Cash
 Infinite supply
   Constant interest: 0% per year
Budget Constraint and Policy
(c = consumption, b = cash)
wt = ( pt + Dt )s t- 1 + bt- 1 = pt s t + bt + ct
ct = (1 - b )wt
pt s t = a t bwt
bt = (1 - a t )bwt
b = fixed
Equity Fraction
(Mean/Variance Objective)
p
rt+1 = a t rt+1 + (1- a t )r f
p 2
U = E(rt+1) + (l /2)s p
2 p p 2 2 2
s p = E(rt+1 - E(rt+1 )) , s t+1 = E(rt+1 - E(rt+1 ))
E(rt+1 - r f )
at =
l s 2t+1
E(rt+1 )
at =
l s 2t+1
Agent Expectations

E(rt +1 ) » gt = mrt - 1 + (1 - m)gt- 1


2 2
E(s t +1 ) = ht » m(rt - 1 - r ) + (1 - m)ht - 1
m = memory, varies over agents

 
Combining Technical and
Fundamental Expectations
pt+1 + dt+1 - pt
rt+1 =
pt
pt+1 - pt d t+1
rt+1 = +
pt pt
gt = E(rt+1 )

 
Technical and Fundamental
Forecasts
E(Dt+1 )
E(rt+1 ) = zgt + (1 - z)( )
pt
E(Dt+1 )
zgt + (1 - z)( )
pt
at =
l ht

 
Parameters and Agents
 Constant across agents
 Consumption fraction
 Risk aversion
 Changing
 Memory, m
 Technical fraction, z
Wealth Redistribution

wt = ( pt + Dt )s t- 1 + bt- 1 = pt s t + bt + ct
ct = ((1 - b ) + w (wt- 1 - wt- 1 ))wt

 
Price Setting
pt s ti + bti = pt s t-
i
1 + b i
t- 1 - c i
t
i
bt - 1 includes t -1 dividends
pt (s ti - s t-
i
1 ) = b i
t- 1 - bt
i
- c i
t
i i i i i
pt å (s t - s t- 1 ) =å (bt- 1 - bt - ct )
i i
i i i
0 = å (bt- 1 - bt - c t)
i

 
Price Setting 2

0 = å (bt-i 1 - bti - cti )


i
i i i i
0=å (bt- 1 - (1 - a t )bwt - (1 - b )wt )
i
i i i
0=å (bt- 1 + (a tb - 1)wt )
i
i i i i
0=å (bt- 1 + (a tb - 1)( pt st - 1 + bt- 1 ))
i
Final Price Equation

i i i i
0=å (bt- 1 + (a t b - 1)( pt s t- 1 + bt- 1 ))
i
i i
å a t bbt- 1
pt = i
i i
å (1 - a t b )s t- 1
i

 
Benchmark
 Homogeneous agents
 Hold all equity portfolios
 Consume dividends
Benchmark Pricing
(p/d constant)

å 1bDt-i 1
i
pt =
å (1- 1b )st-i 1
i
bDt
pt =
(1 - b )

 
Tricky Problems In Pricing
 Fundamental depends on p(t)
 Guess p(t) = p(t-1)
 g(t), h(t) depend on p(t) - Ignore

E(Dt+1 )
zgt + (1 - z)( )
pt
at =
l ht
Netlogo Code
 Patches are individual traders
 Patch display shows relative wealth
 Memory and tech trading strength vary
over (x,y) coordinates
 Space and distance meaningless
Interesting Parameters
 Strategy update frequency
 Memory
 Variance updates
Displays and Results
 Excess kurtosis (fat tails)
 Volatility and volume persistence
 Price/dividend variability and
persistence
 Volume/volatility correlations
Limitations
 Agent utility
 Too simple
 Mean/Variance
 Dividend/time calibration
 What is d?
 Do real dividends look like this?
 Time and yields
 Strategies
 Too simple
 Learning to exploit predictability
 Pricing
 Incorporate p(t) info in strategies
Design Questions
 Preferences
 Price determination
 Strategy representation and learning
 Agent evolution
 Information sharing and social learning
 Information timing
 Benchmarks
 Steady state equilibrium
 Zero intelligence traders
 Software
 Parsimony
Parsimony
 Bob the Builder
 “Can we build it? Yes we can!”
 Model complexity
 Proceed with caution
 “Just say no!”
 Miller/Page(2007)
 Computational theory

You might also like