Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Successfully reported this slideshow.

Like this presentation? Why not share!

- Lppl models MiFIT 2013: Vyacheslav ... by Vyacheslav Arbuzov 7083 views
- Perm winter school 2014.01.31 by Vyacheslav Arbuzov 3539 views
- Seminar psu 20.10.2013 by Vyacheslav Arbuzov 4098 views
- Seminar PSU 09.04.2013 - 10.04.2013... by Vyacheslav Arbuzov 4300 views
- Seminar psu 21.10.2013 financial ... by Vyacheslav Arbuzov 1764 views
- Seminar PSU 10.10.2014 mme by Vyacheslav Arbuzov 847 views

3,496 views

Published on

Published in:
Economy & Finance

No Downloads

Total views

3,496

On SlideShare

0

From Embeds

0

Number of Embeds

2,345

Shares

0

Downloads

25

Comments

0

Likes

2

No embeds

No notes for slide

- 1. Financial market simulation based on zero intelligence models Vyacheslav Arbuzov1,2 arbuzov@prognoz.ru 1Prognoz Risk Lab 2Perm State University Perm 21.03.2014 Applied Economic Modeling Workshop Vyacheslav Arbuzov Financial market simulation
- 2. 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
- 3. 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 orders 2 Rate/placement/size of limit orders 3 Rate/placement/size of cancellations Volume Price Figure 2. Diﬀerent types of orders Vyacheslav Arbuzov Financial market simulation
- 4. 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 Power of 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 over 300,000 in total Vyacheslav Arbuzov Financial market simulation
- 5. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Data LSE data. Farmer, Patelli & Zovko stock num. events average limit market deletions # days ticker (1000s) (per day) (1000s) (1000s) (1000s) AZN 608 1405 292 128 188 429 BARC 571 1318 271 128 172 433 CW. 511 1184 244 134 134 432 GLXO 814 1885 390 200 225 434 LLOY 644 1485 302 184 159 434 ORA 314 884 153 57 104 432 PRU 422 978 201 94 127 354 RTR 408 951 195 100 112 431 SB. 665 1526 319 176 170 426 SHEL 592 1367 277 159 156 429 VOD 940 2161 437 296 207 434 Vyacheslav Arbuzov Financial market simulation
- 6. 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 of liquidity 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
- 7. 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,101 VOD 2,676,888 SBRY 927,874 TATE 243,348 REED 2,353,755 GUS 836,235 FGP 207,390 AZN 2,329,110 HAS 683,124 NFDS 200,654 LLOY 1,954,845 III050 602,416 DEB 182,666 SHEL025 1,708,596 BOC100 500,141 BSY100 177,286 PRU 1,413,085 BOC050 345,129 NEX 134,991 TSCO 1,180,244 BPB 314,414 AVE 109,963 BSY050 1,207,885 Vyacheslav Arbuzov Financial market simulation
- 8. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Data MOEX data Aeroﬂot 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
- 9. 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
- 10. 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 diﬀusion and market friction based on trading 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
- 11. 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 (the sizes of limit orders and market orders are the same) Vyacheslav Arbuzov Financial market simulation
- 12. 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 likely so eﬀectively rate µ/2 for each). Patient agents place buy limit orders with Poisson rate α shares per price per time (uniformly in the semi-inﬁnite interval (−∞; a(t)) and sell limit orders with the same rate in) (b(t); ∞) Cancellations occur with probability δ per unit time (akin to radioactive decay) All processes are independent Vyacheslav Arbuzov Financial market simulation
- 13. 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
- 14. 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). Given real data of all orders/cancellations, can calibrate the parameters σ, α, δ, µ For buy orders calculate relative price ∆ = m − p and for sell orders ∆ = p − m , where m - logarithm of midquote price and p is the logarithm of order price Rt = Qupper t − Qlower t , where Qlower t 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 that capture 58 % of day t’s limit orders and Lt is the total number of shares of eﬀective limit orders within this range. Vyacheslav Arbuzov Financial market simulation
- 15. 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 calculated using only cancelled limit orders in the price range Rt. Measure δt as the inverse of the average lifetime of a cancelled limit orders σ is calculated simply as the average size of all limit orders. The model assumes both averages equal and in practice the average limit order size is only slightly larger than the average market order size. µ is calculated as the ratio of the number of shares of market orders to the number of events during the trading day. Vyacheslav Arbuzov Financial market simulation
- 16. 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.108 orders perasecond · peraprice Figure 4. Heavy tails of price distribution (in this case ∆ = priceorder − pricebestaside) Vyacheslav Arbuzov Financial market simulation
- 17. 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.287 dp Tick size 0.01 σ Volume of orders 1184 Vyacheslav Arbuzov Financial market simulation
- 18. 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
- 19. 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
- 20. 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
- 21. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Mike-Farmer model Mike S., Farmer J. D. (2008) An empirical behavioral model of liquidity and volatility, J. Econ. Dyn. Control 32 . The Mike-Farmer model Vyacheslav Arbuzov Financial market simulation
- 22. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Description Basic knowledge Important properties of the order ﬂow for a future upgrade of the model (from Farmer et al. (2006)): Trending of order ﬂow Power placement of limit prices Non-Poisson order cancellation process Vyacheslav Arbuzov Financial market simulation
- 23. 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 buy orders x = π − πb and for sell order x = πa − π. -0.01 -0.005 0 0.005 0.01 x = relative limit price from same best 10 0 10 1 10 2 10 3 P(x) Student distribution, alpha=1.3 S0 = 0 S0 = 0, BUY S0 = 0, SELL S0 = 0.003 AZN MOEX data LSE data Vyacheslav Arbuzov Financial market simulation
- 24. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Empirical calculations Conditional cancellation process Position in the order book The distance of the price of the order i from the opposite best at time 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 placed yi = 0 - when order is executed Vyacheslav Arbuzov Financial market simulation
- 25. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Empirical calculations Conditional cancellation process Position 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 5 y 10 -3 10 -2 10 -1 P(C|y) real data fitted curve MOEX data LSE data Vyacheslav Arbuzov Financial market simulation
- 26. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Empirical calculations Conditional cancellation process Order book imbalance nimb = nbuy/(nbuy + nsell) for buy orders nimb = nsell/(nbuy + nsell) for sell orders , where nbuy - number of buy orders in order book nsell - 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 1 nimb 0 0.004 0.008 0.01 P(C|nimb) real data linear fit MOEX data LSE data Vyacheslav Arbuzov Financial market simulation
- 27. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Empirical calculations Conditional cancellation process Number 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
- 28. 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
- 29. 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 10 0P(|r|>R) real data Simulation IV. RETURN Figure 8. Distribution of returns Vyacheslav Arbuzov Financial market simulation
- 30. 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 10 0P(s>S) real data Simulation IV. SPREAD Figure 9. Spread distribution Vyacheslav Arbuzov Financial market simulation
- 31. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Empirical calculations Mike-Farmer results of simulations (LSE results) 10 0 10 1 10 2 10 3 tau 10 -6 10 -4 10 -2 P(tau) Simulation, slope = -1.9 Real data, slope = -2.1 Figure 10. Lifetime distribution Vyacheslav Arbuzov Financial market simulation
- 32. 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
- 33. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Empirical calculations Fitting of price distribution Figure 12. Price distribution ﬁtting using Power Law and t-Student Vyacheslav Arbuzov Financial market simulation
- 34. 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
- 35. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Empirical calculations Conditional cancellation process Bayes’ rule: P(Ci|RTCI) = P (RT CI|Ci) P (RT CI) P(C) P(Ci|RTCI) = K4(RTCI + D3) Figure 13. Conditional cancellation process Vyacheslav Arbuzov Financial market simulation
- 36. 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
- 37. 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
- 38. Intoduction Daniels model Mike-Farmer model Upgrading model Results of models Empirical calculations Results of simulations (MOEX) tau P(tau) 100 101 102 103 10−5 10−4 10−3 10−2 10−1 100 Empirical Daniels MF Upgrade Figure 16. Order lifetime distribution of analyzing models Vyacheslav Arbuzov Financial market simulation
- 39. 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 ﬁnancial 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 diﬀusion 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 Evolving Complex 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 ﬁnancial 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

No public clipboards found for this slide

Be the first to comment