+ All Categories
Home > Economy & Finance > Financial market simulation based on zero intelligence models

Financial market simulation based on zero intelligence models

Date post: 17-Aug-2014
Category:
Upload: arbuzov1989
View: 563 times
Download: 2 times
Share this document with a friend
Description:
 
Popular Tags:
39
Financial market simulation based on zero intelligence models Vyacheslav Arbuzov 1,2 [email protected] 1 Prognoz Risk Lab 2 Perm State University Perm 21.03.2014 Applied Economic Modeling Workshop Vyacheslav Arbuzov Financial market simulation
Transcript
Page 1: Financial market simulation based on zero intelligence models

Financial market simulation based on zerointelligence models

Vyacheslav Arbuzov1,2

[email protected]

1Prognoz Risk Lab

2Perm State University

Perm 21.03.2014Applied Economic Modeling Workshop

Vyacheslav Arbuzov Financial market simulation

Page 2: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Basic knowledge about LOB

Continuous double auction scheme

Figure 1. Order book representation

Vyacheslav Arbuzov Financial market simulation

Page 3: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Basic knowledge about LOB

Continuous double auction

Three fundamental processes specifying a LOB are:1 Rate/size of market orders2 Rate/placement/size of limit orders3 Rate/placement/size of cancellations

Volume

Price

Figure 2. Different types of orders

Vyacheslav Arbuzov Financial market simulation

Page 4: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Data

LSE data. Farmer, Patelli & Zovko

Data from Farmer, Patelli & Zovko (2005), The Predictive Powerof Zero Intelligence in Financial Markets

Only used data from electronic order book

01/08/1998 to 30/04/2000 (434 trading days)

Selected 11 stocks, each with over 80 events per day and over300,000 in total

Vyacheslav Arbuzov Financial market simulation

Page 5: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Data

LSE data. Farmer, Patelli & Zovko

stock num. events average limit market deletions # daysticker (1000s) (per day) (1000s) (1000s) (1000s)

AZN 608 1405 292 128 188 429BARC 571 1318 271 128 172 433CW. 511 1184 244 134 134 432GLXO 814 1885 390 200 225 434LLOY 644 1485 302 184 159 434ORA 314 884 153 57 104 432PRU 422 978 201 94 127 354RTR 408 951 195 100 112 431SB. 665 1526 319 176 170 426SHEL 592 1367 277 159 156 429VOD 940 2161 437 296 207 434

Vyacheslav Arbuzov Financial market simulation

Page 6: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Data

LSE data. Mike, Farmer

Data from Mike, Farmer (2008), An empirical behavioral model ofliquidity and volatility

Only used data from electronic order book

02/05/2000 to 31/12/2002

Selected 25 stocks

Trading day from 9:00 am to 16:00.

Vyacheslav Arbuzov Financial market simulation

Page 7: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Data

LSE data. Mike, Farmer

Stock # of orders Stock # of orders Stock # of orders

SHEL050 3,560,756 BLT 984,251 III050 301,101VOD 2,676,888 SBRY 927,874 TATE 243,348REED 2,353,755 GUS 836,235 FGP 207,390AZN 2,329,110 HAS 683,124 NFDS 200,654LLOY 1,954,845 III050 602,416 DEB 182,666

SHEL025 1,708,596 BOC100 500,141 BSY100 177,286PRU 1,413,085 BOC050 345,129 NEX 134,991TSCO 1,180,244 BPB 314,414 AVE 109,963BSY050 1,207,885

Vyacheslav Arbuzov Financial market simulation

Page 8: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Data

MOEX data

Aeroflot JSC

Only used data from electronic order book

01/01/2012 to 31/01/2012 (21 trading days)

History of all orders and trades

2 765 074 orders

15 786 trades

Trading day from 10:00 am to 18:45.

Vyacheslav Arbuzov Financial market simulation

Page 9: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Tool kit

Tools for market simulations

Data warehouse: Oracle

Statistical calculations and visualization: R-3.0.2

Market engine simulations: C++

R package (RODBC) for working with database

R package (Rcpp) for working with MinGW compilers (C++)

Vyacheslav Arbuzov Financial market simulation

Page 10: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

ZI model of 2003

Daniels M.G., Farmer J.D., Gillemot L., Iori G., Smith E. (2003)Quantitative model of price diffusion and market friction based ontrading as a mechanistic random process, Phys. Rev. Lett. 90.There is no established name of this model.So in our research, we try to named this model as

The Daniels model

Vyacheslav Arbuzov Financial market simulation

Page 11: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Theory

Basic knowledge

Standard settings and parameters of the zero-intelligence model.Model works in the logarithm space.

ZI agents place and cancel orders randomly

The logarithm of the tick size is dp

The logarithm of the best (lowest) ask price is a(t)

The logarithm of the best (highest) bid price is b(t)

The spread at time t is s(t) = a(t)− b(t)Each order/cancellation has characteristic size σ shares (thesizes of limit orders and market orders are the same)

Vyacheslav Arbuzov Financial market simulation

Page 12: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Theory

Poisson process

Impatient agents place market orders with Poisson rate µshares per unit time (buy and sell market orders equally likelyso effectively rate µ/2 for each).

Patient agents place buy limit orders with Poisson rate αshares per price per time (uniformly in the semi-infiniteinterval (−∞; a(t)) and sell limit orders with the same ratein) (b(t);∞)

Cancellations occur with probability δ per unit time (akin toradioactive decay)

All processes are independent

Vyacheslav Arbuzov Financial market simulation

Page 13: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Theory

Poisson process

Figure 3. Scheme of the Daniels model

Vyacheslav Arbuzov Financial market simulation

Page 14: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Estimation of parameters

Estimation of α

We follow the methods of Farmer, Patteli, Zovko (2005). Givenreal data of all orders/cancellations, can calibrate the parametersσ, α, δ, µ

For buy orders calculate relative price ∆ = m− p and for sellorders ∆ = p−m , where m - logarithm of midquote priceand p is the logarithm of order price

Rt = Quppert −Qlower

t , where Qlowert is the 2 percentile of

density of ∆ and Qupper is the 60 percentile

α is calculated each day and then averaged. On day t,αt = Lt/|Rt|, where Rt is the range of relative prices thatcapture 58 % of day t’s limit orders and Lt is the totalnumber of shares of effective limit orders within this range.

Vyacheslav Arbuzov Financial market simulation

Page 15: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Estimation of parameters

Estimation of σ, δ, µ

δt is calculated each day and then averaged. δt is calculatedusing only cancelled limit orders in the price range Rt.Measure δt as the inverse of the average lifetime of acancelled limit orders

σ is calculated simply as the average size of all limit orders.The model assumes both averages equal and in practice theaverage limit order size is only slightly larger than the averagemarket order size.

µ is calculated as the ratio of the number of shares of marketorders to the number of events during the trading day.

Vyacheslav Arbuzov Financial market simulation

Page 16: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Practice

Estimation of α

Qupper = 12 tick size Qlower = −11 tick size

L = 1, 655, 646 α = 0.108orders

perasecond · peraprice

Figure 4. Heavy tails of price distribution(in this case ∆ = priceorder − pricebestaside)

Vyacheslav Arbuzov Financial market simulation

Page 17: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Practice

Estimation of µ,δ,σ

Parameters Description Value

α Intensity of limit orders 0.108µ Intensity of market orders 0.006δ Intensity of cancellations 0.287dp Tick size 0.01σ Volume of orders 1184

Vyacheslav Arbuzov Financial market simulation

Page 18: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Practice

Results of simulations

Figure 5. Distribution of spread

Vyacheslav Arbuzov Financial market simulation

Page 19: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Practice

Results of simulations

Figure 6. Distribution of returns

Vyacheslav Arbuzov Financial market simulation

Page 20: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Practice

Results of simulations

Figure 7. Orders lifetime distribution

Vyacheslav Arbuzov Financial market simulation

Page 21: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Mike-Farmer model

Mike S., Farmer J. D. (2008) An empirical behavioral model ofliquidity and volatility, J. Econ. Dyn. Control 32.

The Mike-Farmer model

Vyacheslav Arbuzov Financial market simulation

Page 22: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Description

Basic knowledge

Important properties of the order flow for a future upgrade of themodel (from Farmer et al. (2006)):

Trending of order flow

Power placement of limit prices

Non-Poisson order cancellation process

Vyacheslav Arbuzov Financial market simulation

Page 23: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Price distribution

Let’s x is logarithmic distance from the same best price. For buyorders x = π − πb and for sell order x = πa − π.

-0.01 -0.005 0 0.005 0.01x = relative limit price from same best

100

101

102

103

P(x)

Student distribution, alpha=1.3

S0 = 0S0 = 0, BUYS0 = 0, SELLS0 = 0.003

AZN

MOEX data LSE data

Vyacheslav Arbuzov Financial market simulation

Page 24: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Conditional cancellation processPosition in the order book

The distance of the price of the order i from the opposite best attime t is:

∆i(t) = π − πb(t) - for sell orders∆i(t) = πa(t)− π - for buy orders

∆i(0) - the distance to the opposite best when the order is placed∆i(t) = 0 - when the order is executed

yi(t) = ∆i(t)∆i(0)

yi = 1 - when order is placedyi = 0 - when order is executed

Vyacheslav Arbuzov Financial market simulation

Page 25: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Conditional cancellation processPosition in the order book

Bayes’ rule: P (Ci|yi) = P (yi|Ci)P (yi)

P (C)

P (Ci|yi) = K1(1−D1e−yi) P (Ci|yi) = K1(1− e−yi)

0 1 2 3 4 5y

10-3

10-2

10-1

P(C

| y)

real datafitted curve

MOEX data LSE data

Vyacheslav Arbuzov Financial market simulation

Page 26: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Conditional cancellation processOrder book imbalance

nimb = nbuy/(nbuy + nsell) for buy ordersnimb = nsell/(nbuy + nsell) for sell orders , wherenbuy - number of buy orders in order booknsell - number of sell orders in order book

Bayes’ rule: P (Ci|nimb) = P (nimb|Ci)P (nimb)

P (C)

P (Ci|nimb) = K2(nimb +B)

0 0.2 0.4 0.6 0.8 1nimb

0

0.004

0.008

0.01

P(C

| ni

mb)

real datalinear fit

MOEX data LSE data

Vyacheslav Arbuzov Financial market simulation

Page 27: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Conditional cancellation processNumber of orders in the order book

ntot = (nbuy + nsell)

Bayes’ rule: P (Ci|ntot) = P (ntot|Ci)P (ntot)

P (C)

P (Ci|ntot) = K3(1−D2e−ntot) P (Ci|ntot) = K3

ntot

MOEX data LSE data

Vyacheslav Arbuzov Financial market simulation

Page 28: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Combined cancellation model

P (Ci|yi, nimb, ntot) = P (yi|Ci)P (nimb|Ci)P (ntot|Ci)P (yi)P (nimb)P (ntot)

P (C).

P (Ci|yi, nimb, ntot) = A(1−D1e−yi)(nimb +B)(1−D2e

−ntot) .where

.A = K1K2K3

P (C)2

Vyacheslav Arbuzov Financial market simulation

Page 29: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Mike-Farmer results of simulations (LSE results)

10-4

10-3

10-2

10-1

R

10-4

10-2

100

P(|r|

> R

)

real dataSimulation IV.

RETURN

Figure 8. Distribution of returns

Vyacheslav Arbuzov Financial market simulation

Page 30: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Mike-Farmer results of simulations (LSE results)

10-4

10-3

10-2

10-1

S

10-4

10-2

100

P(s

> S

)

real dataSimulation IV.

SPREAD

Figure 9. Spread distribution

Vyacheslav Arbuzov Financial market simulation

Page 31: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Mike-Farmer results of simulations (LSE results)

100

101

102

103

tau

10-6

10-4

10-2

P(ta

u)

Simulation, slope = -1.9Real data, slope = -2.1

Figure 10. Lifetime distribution

Vyacheslav Arbuzov Financial market simulation

Page 32: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Heavy tails in price distribution

Figure 11. Power Law of logarithmic distance

Vyacheslav Arbuzov Financial market simulation

Page 33: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Fitting of price distribution

Figure 12. Price distribution fitting using Power Law and t-Student

Vyacheslav Arbuzov Financial market simulation

Page 34: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Liquidity metric

Arbuzov V., Frolova M. Market liquidity measurement and econometric

modeling // Market Risk and Financial Markets Modeling, Springer, 2012

RTCI =

n∑i=1|pi−p|·ni

n∑i=1

pini

where pi – price of order i,ni - volume of order i,

p – best bid price for buy orders and best ask price for sell orders

Vyacheslav Arbuzov Financial market simulation

Page 35: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Conditional cancellation process

Bayes’ rule: P (Ci|RTCI) = P (RTCI|Ci)P (RTCI) P (C)

P (Ci|RTCI) = K4(RTCI +D3)

Figure 13. Conditional cancellation process

Vyacheslav Arbuzov Financial market simulation

Page 36: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Results of simulations (MOEX)

Figure 14. Returns distribution

Vyacheslav Arbuzov Financial market simulation

Page 37: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Results of simulations (MOEX)

Figure 15. Spread distribution

Vyacheslav Arbuzov Financial market simulation

Page 38: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Empirical calculations

Results of simulations (MOEX)

tau

P(t

au)

100 101 102 103

10−

510

−4

10−

310

−2

10−

110

0

Empirical DanielsMF Upgrade

Figure 16. Order lifetime distribution of analyzing models

Vyacheslav Arbuzov Financial market simulation

Page 39: Financial market simulation based on zero intelligence models

Intoduction Daniels model Mike-Farmer model Upgrading model Results of models

Answers and questions

References

Arbuzov V., Frolova M. (2012) Market liquidity measurement and econometric modeling. Market Risk and

Financial Markets Modeling, Springer.

Bouchaud J.-P., Gefen Y., Potters M., Wyart M., (2004) Fluctuations and response in financial markets:

the subtle nature of ‘random’ price changes. Quantitative Finance 4 (2), 176–190.

Daniels M.G., Farmer J.D., Gillemot L., Iori G., Smith E. (2003) Quantitative model of price diffusion and

market friction based on trading as a mechanistic random process, Phys. Rev. Lett. 90

Farmer J. D., Gillemot L., Iori G., Krishnamurthy S., Smith D. E., Daniels M. G. (2006) A Random Order

Placement Model of Price Formation in the Continuous Double Auction. The Economy as an EvolvingComplex System III, 133-173. New York: Oxford University Press.

Farmer J. D., Patelli P., Zovko I. I. (2005) The predictive power of zero intelligence in financial markets,

Proc. Natl. Acad. Sci. USA 102 2254–2259

Mike S., Farmer J. D. (2008) An empirical behavioral model of liquidity and volatility, J. Econ. Dyn. Control

32 200–234

R Core Team (2013) R: A language and environment for statistical computing. R Foundation for Statistical

Computing, Vienna, Austria.

Vyacheslav Arbuzov Financial market simulation


Recommended