The Microscopic Structure of Financial Markets: a brief introduction for physicists M. Bartolozzia,b • a Research Group, Boronia Capital, Sydney, Australia • b Special Research Centre for the Subatomic Structure of Matter (CSSM), University of Adelaide, Adelaide, Australia Achievements & New Directions in Subatomic Physics, Adelaide 15 – 19 Feb 2010 Outline (Econo)Physics and finance A brief introduction to high-frequency finance and market microstructure Signal detection, persistency and Antipersistency at short time scales Empirical features of market microstructure and relaxation times in the imbalance between demand and supply Conclusions What is Econophysics? “ Econophysics is the application of typical methods from physics to the study of the financial markets, seen as a complex system.” H. E. Stanley, Boston University, Boltzmann Medal 2004: “For his influential contribution to several areas of statistical physics…” However…it is nothing really that new! E. Majorana, Scientia, Vol. 36, 58 (1942) “On the value of the statistical laws in physics and in social sciences.” Physica A, Vol. 285, p. 1 (2000) Exotic statistical physics with applications to biology, medicine and economics. Physics and Finance: a very short history (I) R. Brown (1827) -> Introduction of the concept of Brownian motion. L. Bachelier (1900) -> The concept of Brownian walk is applied to the Paris Bourse. A. Einstein (1905), P. Langevin (1908), N. Wiener (1923), K. Ito (1944) -> Development of stochastic calculus. B.B. Mandelbrot (1963) -> Levy or other “fat-tailed” distributions seems to closer to empirical data that Gaussian distributions. The ’80s -> The availability of electronic data start increasing exponentially thanks to new technologies. 1997 -> “…the financial industry employs about the 48% of the new Ph.D. in mathematics and physics…”, Nature, Vol. 393, 496 (1998). 1997 -> M. Scholes and R. Merton win the Nobel prize for the Black&Scholes – Merton model for Option pricing (F. Black has passed away in the meantime). Physics and Finance: a very short history (II) 1990 – Today -> Econophysics articles are published on different prestigious journals such as Nature, Physical Review Letters, Physical Review E, Physica A, European Physical Journal B etc… 1999 -> The European Physical Society recognizes Econophysics as a new area of research. 2000 – Today -> Different textbooks are published. 2000 – Today -> University courses are set up. Australia: ANU Canberra. 2000 – Today world. -> Different Symposia and Conferences are held around the Textbooks in Econophysics J.P. Bouchaud and M. Potters – Theory of Financial Risk and Derivative Pricing: from Statistical Physics to Risk Management, Cambridge University Press (2003) J. Voit – The Statistical Mechanics of Financial Markets, Springer (2005) R.N. Mantegna and H.E. Stanley – An Introduction to Econophysics: Correlations and Complexity in Finance, Cambridge University Press (2000) High-Frequency Finance: the state of art in automated trading • High-frequency trading (HFT) broadly defines all the strategies which holding period is less than one day • In 2009 HFT accounted for about 60% of the total traded volume around the world (and it’s growing!). • HFT is suitable for all the liquid financial instruments (exchange rates, equities, futures, options, fixed income) • Why is HFT attractive? - Relative low risk and constant steady profit. - Low correlation with long term strategies and, therefore, allowing for diversification. Challenges in High-Frequency Finance • Dealing with very large data bases (order of Tb) for backtesting IT • Speed of execution • Identify a profitable strategy! • Possible Frameworks: - Regime Recognition - Event Trading - Statistical arbitrage - Market Making - Microstructure Trading - Cointegration - Machine Learning Research Measuring Long Memory: Hurst and his dam The concept of Hurst exponent has been originally developed in the context of reservoir control on the Nile river dam project: Hurst’s algorithm is known as R/S (or rescaled range) analysis. H. Hurst, Trans. Amer. Soc. Civil Eng. 116, 770 (1951) 1 (t ) t 1 t X (t , ) (u ) u 1 R( ) max X (t , ) min X (t , ) 1t R / H 1t Persistency and anti-persistency in non-stationary time series Following the spirit of Hurst, H has been used in different contest as a benchmark for persistency, anti-persistency or randomness in time series analysis. See E.E. Peters “Chaos and Order in Capital Markets”, Wiley finance edition (1991), for example. • H=0.5 random process • 0.5<H<1 persistency • 0<H<0.5 anti-persistency Hold on! Financial time series are non-stationary and “fat”-tailed: they are “not well behaved”. What is the consequence of this? Hurst exponent in finance During the years there has been a proliferation of methods to estimate the Hurst exponent (mostly outside the financial contest): • Rescaled Range (R/S) • Periodgram Regression • (m,k)-Zipf method • Average Wavelet Coefficient Method • ARFIMA estimation by exact maximum likelihood • Whittle estimation • Detrended Fluctuation Analysis • Detrended Moving Average However, no much attention has been dedicated to their “efficiency” when used on non-stationary and fat-tailed data sets For a general review: T. Di Matteo, Quant. Finan. 7(1), 21 (2007) How do they look like? Hurst exponent in futures markets: is it stationary? The local Hurst exponent is local either in time and scale H L (t ) Local Hurst exponent for S&P500 and DJ. L=8192 (~ 16 days). In orange a confidence interval based on Gaussian fluctuations. Hurst exponent in futures markets: possible exploitation? Time Dependent Dynamics: how to predict the next Hurst? Different distributions of the local Hurst exponent in three different periods (BP): the market can be hardly stationary! Expectation values for local Hurst exponents Indices Commodities Exchange rates Fixed income As the scale gets shorter we can move from H>0.5 to H<0.5. Moreover, the various financial instrument seem to cluster in separate classes. The EOD (and large deviations) issue Indices Commodities Exchange rates Fixed income End of day (EOD) gaps can represent an important issue for the calculation of high frequency quantities in finance: H is particulary sensitive to these large fluctuations (most of the algorithm are!!) M. Bartolozzi, C. Mellen, T. Di Matteo and T. Aste, Eur. Phys. J. B. 58 (2007) p.207-220 Modern Double Auction Markets: the Limit Order Book Volume ----Market Order --(or Market Order -- Limit Order -- limit) -- -- Cancellation--- Slippage-- gap gap gap gap Best Ask Best Bid Price Tick Size: Granularity Mid Point Price Bid Ask Limit Order Book Volume ----Market Order --(or Market Order -- Limit Order -- limit) -- -- Cancellation--- Slippage-- gap gap gap gap Best Ask Best Bid Price Tick Size: Granularity Mid Point Price Bid Ask Ultra high-frequency features of modern double auction markets LOB Dynamics on Large Scale (II) Eurex Bunds Futures: Note the Periodicity due to the expiration of the contract. LOB Dynamics on Large Scale (III) SPIFutures LOB Asymptotic Distribution Average distribution of the LOB for QQQ and SPY. Exchange traded founds that track Nasdaq and S&P500 Cumulative distribution of incoming orders. The dashed line is a power law with exponent 1. M. Potters and J.-P. Bouchaud, Physica A, Vol. 324, p. 133 (2003) Relaxation in the limit order book imbalance How long it takes for the limit order book to get back from an “out-of-equilibrium” position to a new “meta-stable” equilibrium? ~ (t ) Nb Na i 1 Nb j 1 Na i 1 j 1 b a V ( t ) V i j (t ) ~ [1,1] b a V ( t ) V i j (t ) Is the time required for a volume imbalance to “relax” back to the “meta-equilibrium” position. For the analysis we used tick-by-tick snapshots of the order book from 13/07/2004 to 08/12/2006 for the DAX (~5*107 and N=10) and the SPI (~6*106 and N=5). Empirical PDFs of relaxation times 0.1 0 ~ ] P( ) exp[ / P ( ) The distribution seem to be well fitted by the stretched exponential: this is actually similar to what happens in many physical systems (k=0.4 in the inset)! F. Alvarez, A. Alegria and J. Colmenero, Phys. Rev. B 44, 7306 (1991) Possible explanations Kohlrausch-WilliamsWatts equation (KWW) ~ exp[ ( / ) ] e ( )d 0 ( ) Debye distribution •Dielectric polarization decay •Quasi-elastic neutron scattering •Kinetic relaxations...etc Theoretical justification :: The Levy stable distribution is a solution of the previous equation for some parameter values. Moreover, the KWW equation can be solved numerically once the value of α as been fixed. Summary and conclusion (I) Implementation of HFT systems requires a lot of care in terms of signal detection. High-frequency data are not usually “user-friendly”. Application of Hurst analysis for high-frequency (1 min) futures contracts: emergence of different dynamics related to the scale of observation and the particular financial instrument. Practical Issues: - Non-stationarity – Spikes (EOD) M. Bartolozzi, C. Mellen, T. Di Matteo and T. Aste, Eur. Phys. J. B. 58 (2007) p.207-220 Discussion and conclusion (II) Introduction to the “quark structure of finance”: the limit order book Relaxation times in demand and supply are characterized by stretched exponential distributions, analogously to those of many physical systems… M. Bartolozzi et. al., Proc. of SPIE, vol. 6802,680203, (2008) http://aps.arxiv.org/abs/0712.2910, The Microscopic Structure of Financial Markets: a brief introduction for physicists M. Bartolozzia,b • a Research Group, Boronia Capital, Sydney, Australia • b Special Research Centre for the Subatomic Structure of Matter (CSSM), University of Adelaide, Adelaide, Australia Achievements & New Directions in Subatomic Physics, Adelaide 15 – 19 Feb 2010 Financial Data Price Index P(t ) Logarithmic Price Returns R(t ) ln[ P(t 1)] ln[ P(t )] Volatility v(t ) R(t ) Standard & Poor 500 (S&P500) data set from 3/1/1950 to 18/7/2003. N=13468. DFA and Gaussian increments (I) How accurate the DFA estimator really is? First we test it against well behaved data, that is with fractional Gaussian increments generated via a wavelet construction method proposed by Mayer and Sellan (Appl. And Comp. Harmonic Anal., Vol. 3(4), p. 377 (1996)). Ensemble average fractional Brownian motion DFA-1 DFA-2 L=1024 DFA and Gaussian increments (II) DFA-2 H = 0.2 H = 0.3 H = 0.4 H = 0.5 H = 0.6 H = 0.7 H = 0.8 L=1024 0.22 (4) 0.31 (4) 0.40 (4) 0.50 (5) 0.60 (6) 0.70 (6) 0.79 (7) In this case we have bias just for strong correlations and the errors are power law distributed with exp ~ 0.36. DFA and Levy increments…a legend of “fat tails” The distribution of i.i.d. variable DOES NOT converge only to Gaussian distribution: there exist another important family of stable distributions with “fat”-tails: they are called Levy distributions lim L ( y, ) y (0,2) 1 y 1 α=2 Gaussian The Levy distributions can be RESCALED to collapse in a single distribution L* -> Levy distributions are self-affine (fractal) distributions Mantegna & Stanley, Nature 376, p.46 (1995) L ( y, ) 1/ L ( 1/ y,1) 1/ L ( 1/ y) A self-affine process (statistically): f ( x ) ( ) f ( x ) Self-affine processes and Levy distributions A mono-fractal self-affine process is defined as (fractional Brownian motion, for example) x(t ) ( ) x(t ) ( ) H The distribution of these processes at a certain scale t can be rescaled t P( x(t ), t ) G ( y , ) t G ( x(t ), t ) G ( y, ) y y 1 1 P ,1 P ( ) ( ) ( ) ( ) Fractal and Levy processes are statistically self-affine and they scale in the same way with For λ=τ H 1 dx P( x, t ) y , dy ( ) H H DFA and Levy… (II) For Levy i.i.d. data α > 1 (H>0.5) The “fat”-tails matter! For the algorithm: Samorodnitzky and Taqqu, Stable non-Gaussian Random Process (2004) H=0.6 H=0.7 H=0.8 L=1024 L=4096 L=16384 0.56 (8) 0.63 (10) 0.68 (12) 0.58 (7) 0.57 (5) 0.64 (8) 0.65 (7) 0.70 (10) 0.71 (8) An Hurst exponent different from 0.5 does not mean necessary prsistency or antipersistency. Large, self-similar, increments enhance the “diffusion” of the time seires and the scaling of the variance goes “as if” there exist serial correlations. In practice, “fat tails” can enhance the value of H! “Tails” in Futures Data We test the relevance of the large fluctuations in data sets of futures data. In particular we report an example on a small window with Bunds data. In this case we cannot make ensamble average: concept of local Hurst exponent -> HL(t) 1 min Bunds futures (Jan 2003/Dec 2004) L=1024, slide 10 min (~ 2 days) The large fluctuations enhance the value of H. r (t ) g (t ) r (t ) g (t ) if if r (t ) 0 r (t ) 0 Limit orders and Levy distributions Possible drawback with the previous interpretation: why a stable Debye distribution should exist after all? The framework of stochastic processes comes to help in this case. In fact the KWW is satisfied for L , Levy distribution with parameters: (0,1) 1 NOTE: Levy distributions are fixed points for the addition of i.i.d. random variables, xi, whose individual distributions are asymptotically a power law, Pi(xi) ≈ |xi|-1-μ with 0<μ<2, that is, with infinite variance. Moreover, the distribution of relaxation times depends on the initial imbalance L , 1 L , 1 ( ) Herding effects? Decrease of heterogeneity? Average relaxation time as a function of the imbalance For 0.1< k <0.6 the relation is basically linear. ~ 1 ~ Some Credits • Boronia Capital Research Group. In particular, the Order Book group which includes: C. Mellen, F. Chan, D. Fussell, M. Fender and D. Oliver. http://www.boroniacapital.com.au • The econophysics group at ANU and, in particular, T. Di Matteo and T. Aste. http://wwwrsphysse.anu.edu.au/~tdm110/econophysics.html Persistency and anti-persistency in non-stationary time series Following the spirit of Hurst, H has been used in different contest as a benchmark for persistency, anti-persistency or randomness in time series analysis. See E.E. Peters “Chaos and Order in Capital Markets”, Wiley finance edition (1991), for example. • H=0.5 random process • 0.5<H<1 persistency • 0<H<0.5 anti-persistency Hold on! Financial time series are non-stationary and “fat”-tailed: they are “not well behaved”. What is the consequence of this? First we check the performance of the algorithm against Gaussian and Levy increments, afterwards we apply our results to the analysis of different futures indices The Detrended Fluctuation Analysis: an algorithm for non-stationary time series • The time series is divided in M=N/ non-overlapping boxes of equal length • For each box we calculate the local polynomial trend and then the fluctuations around this trend are calculated. The DFA is usually denoted as DFA-p according to the polynomial used for the detrending • As the final step we average the fluctuations at each scale. Then the Hurst exponent, H, is calculated via the following scaling relation Scale Time (t) 2 1 i i F ( , p) x (t ) y , p (t ) tithbox i F ( , p) M H Some average estimates of the errors Hurst exponent in futures markets (III) Distribution of local Hurst exponents: emerging patterns (I) Distribution of local Hurst exponents: emerging patterns (II)