Netlogo Financial Market

Preview:

Citation preview

An Agent-based Financial Market in Netlogo

Blake LeBaron

International Business School

Brandeis University

www.brandeis.edu/~blebaron

SFI CSSS, 2007Santa Fe, NM

Goals

A simple/transparent market simulationEasy 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)

PreferencesConsumption

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

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

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

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

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)

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

Parameters and Agents

Constant across agents Consumption fraction Risk aversion

Changing Memory, m Technical fraction, z

Wealth Redistribution

 

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

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

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å )

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å ))

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

Benchmark

Homogeneous agentsHold all equity portfoliosConsume dividends

Benchmark Pricing(p/d constant)

 

pt =1bDt- 1

i

(1- 1b )st- 1i

pt =bDt

(1 - b )

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

Netlogo Code

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

over (x,y) coordinatesSpace and distance meaningless

Interesting Parameters

Strategy update frequencyMemoryVariance updates

Displays and Results

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

persistenceVolume/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

Recommended