Netlogo Financial Market

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

Transcript of Netlogo Financial Market

Page 1: Netlogo Financial Market

An Agent-based Financial Market in Netlogo

Blake LeBaron

International Business School

Brandeis University

www.brandeis.edu/~blebaron

SFI CSSS, 2007Santa Fe, NM

Page 2: Netlogo Financial Market

Goals

A simple/transparent market simulationEasy to use modeling language

(Netlogo)“Code as theory”

Page 3: Netlogo Financial Market

Outline

Description Basic economic structure Trading strategies Market clearing

Simple simulation results Replicating features Convergence and parameters

Page 4: Netlogo Financial Market

Basic Economic Structure

Assets Equity Cash (risk free)

PreferencesConsumption

Page 5: Netlogo Financial Market

Assets

Equity (Stock) Risky dividend, Autoregressive order 1 Fixed supply (1 share) price = p(t) (Determined by market)

Cash Infinite supply Constant interest: 0% per year 

dt = d + r (dt- 1 - d ) + et

Dt = edt

Page 6: Netlogo Financial Market

Budget Constraint and Policy(c = consumption, b = cash)

 

wt = (pt + Dt )st- 1 + bt- 1 = pt st + bt + ct

ct = (1- b )wt

ptst = a t bwt

bt = (1- a t )bwt

b = fixed

Page 7: Netlogo Financial Market

Equity Fraction(Mean/Variance Objective)

 

rt+1p = a trt+1 + (1- a t )rf

U = E(rt+1p ) + (l /2)s p

2

s p2 = E(rt+1

p - E(rt+1p ))2 , s t+1

2 = E(rt+1 - E(rt+1))2

a t =E(rt+1 - rf )

l s t+12

a t =E(rt+1)

l s t+12

Page 8: Netlogo Financial Market

Agent Expectations

 

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

E(s t +12 ) = ht » m(rt - 1 - r )2 + (1- m)ht - 1

m = memory, varies over agents

Page 9: Netlogo Financial Market

Combining Technical and Fundamental Expectations

 

rt+1 =pt+1 + dt+1 - pt

pt

rt+1 =pt+1 - pt

pt+

dt+1pt

gt = E(rt+1)

Page 10: Netlogo Financial Market

Technical and Fundamental Forecasts

 

E(rt+1) = zgt + (1- z)(E(Dt+1)

pt)

a t =

zgt + (1- z)(E(Dt+1)

pt)

l ht

Page 11: Netlogo Financial Market

Parameters and Agents

Constant across agents Consumption fraction Risk aversion

Changing Memory, m Technical fraction, z

Page 12: Netlogo Financial Market

Wealth Redistribution

 

wt = ( pt + Dt )st- 1 + bt- 1 = pt st + bt + ct

ct = ((1- b ) +w (wt- 1 - w t- 1))wt

Page 13: Netlogo Financial Market

Price Setting

 

ptsti + bt

i = pt st- 1i + bt- 1

i - cti

bt -1i includes t -1 dividends

pt (sti - st- 1

i ) = bt- 1i - bt

i - cti

pt (sti - st- 1

i )i

å = (bt- 1i - bt

i - cti )

0 = (bt- 1i - bt

i - cti

iå )

Page 14: Netlogo Financial Market

Price Setting 2

 

0 = (bt- 1i - bt

i - cti

iå )

0 = (bt- 1i - (1- a t

i )bwti - (1- b )wt

i

iå )

0 = (bt- 1i + (a t

ib - 1)wti

iå )

0 = (bt- 1i + (a t

ib - 1)(ptst - 1i + bt- 1

i

iå ))

Page 15: Netlogo Financial Market

Final Price Equation

 

0 = (bt- 1i + (a t

ib - 1)(pt st- 1i + bt- 1

i

iå ))

pt =a t

ibbt- 1i

(1- a tib )st- 1

i

Page 16: Netlogo Financial Market

Benchmark

Homogeneous agentsHold all equity portfoliosConsume dividends

Page 17: Netlogo Financial Market

Benchmark Pricing(p/d constant)

 

pt =1bDt- 1

i

(1- 1b )st- 1i

pt =bDt

(1 - b )

Page 18: Netlogo Financial Market

Tricky Problems In Pricing

 

a t =zgt + (1- z)(

E(Dt+1)

pt)

l ht

Fundamental depends on p(t) Guess p(t) = p(t-1)

g(t), h(t) depend on p(t) - Ignore

Page 19: Netlogo Financial Market

Netlogo Code

Patches are individual tradersPatch display shows relative wealthMemory and tech trading strength vary

over (x,y) coordinatesSpace and distance meaningless

Page 20: Netlogo Financial Market

Interesting Parameters

Strategy update frequencyMemoryVariance updates

Page 21: Netlogo Financial Market

Displays and Results

Excess kurtosis (fat tails)Volatility and volume persistencePrice/dividend variability and

persistenceVolume/volatility correlations

Page 22: Netlogo Financial Market

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

Page 23: Netlogo Financial Market

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

Page 24: Netlogo Financial Market

Parsimony

Bob the Builder “Can we build it? Yes we can!”

Model complexity Proceed with caution “Just say no!”

Miller/Page(2007) Computational theory