Trend Switching Phenomena in Financial Markets

Tobias Preis

Chair of Sociology, in particular of Modeling and Simulation, ETH Zurich Center for Polymer Studies, Department of Physics, Artemis Capital Asset Management GmbH [email protected] αrtemis Tobias Preis April 19, 2011 Tobias Preis April 19, 2011 „Random Walk“

Tobias Preis April 19, 2011 Outline

(i) “Econostatics” vs. “Econodynamics”

(ii) Analysis of complex pattern-based correlations in high frequency financial market data.

(iii) Switching processes in financial markets.

(iv) Agent-based model reproducing empirical stylized facts based on an order book structure.

Tobias Preis April 19, 2011 Outline

(i) “Econostatics” vs. “Econodynamics”

(ii) Analysis of complex pattern-based correlations in high frequency financial market data.

(iii) Switching processes in financial markets.

(iv) Agent-based model reproducing empirical stylized facts based on an order book structure.

Tobias Preis April 19, 2011 “Econostatics” Time

Price

Constructing a histogram of price changes Frequency

T= 1 Price Changes Tobias Preis April 19, 2011 “Econostatics” Time

Price

Constructing a histogram of price changes Frequency

T= 2 Price Changes Tobias Preis April 19, 2011 “Econostatics” Time

Price

Constructing a histogram of price changes Frequency

T= 3 Price Changes Tobias Preis April 19, 2011 “Econostatics” Time

Price

Constructing a histogram of price changes Frequency

T= 4 Price Changes Tobias Preis April 19, 2011 “Econostatics” Time

Price

Constructing a histogram of price changes Frequency

T= 5 Price Changes Tobias Preis April 19, 2011 “Econostatics” Time

Price

Constructing a histogram of price changes Frequency

Price Changes Tobias Preis April 19, 2011 20.06.2008 German Stock Index (DAX)

15.09.2008

FDAX 09/2008 q!6p!6tï"" ï1

"" ï 19.09.2008 ï

t 6t =25 6

! ï2 p 6 !

P ï3 10

log ï4

ï20 ï15 ï10 ï5 0 5 10 15 20 6p!6tï" 2 φ(∆p(∆t−)) = u exp( v∆p ) X. Gabaix et al., 423, 267-270 (2003). − Tobias Preis April 19, 2011 Milestones of trading CBOT trading pit, Chicago, 1993

Floor trading 1602 Options on shares of East-Indian Company (NL) 1634-36 Tulip bulb speculation bubble (NL) ... 1848 CBOT: trading of future contracts (USA) ... 1978 CBOE: trading of option contracts (USA) ... 1990 DTB: futures and options (D) ... 1998 EUREX: DTB+SOFFEX (D, CH) Electronic trading ... AG headquarter, Frankfurt, 2007 Tobias Preis April 19, 2011 Sequence of Price Changes FDAX

20.06.2008 19.09.2008

Random Walk

• Empirical stylized facts of financial time series include:

➡ Fat-tailed return distributions / Power law (Gene Stanley et al.)

➡ Log-periodic power law / Bubble detection (Didier Sornette et al.)

➡ Non-trivial scaling behavior of the returns,

➡ Volatility clustering

➡ ... Tobias Preis April 19, 2011 Outline

(i) “Econostatics” vs. “Econodynamics”

(ii) Analysis of complex pattern-based correlations in high frequency financial market data.

(iii) Switching processes in financial markets.

(iv) Agent-based model reproducing empirical stylized facts based on an order book structure.

Tobias Preis April 19, 2011 Fluctuation Patterns „The aim is to compare the current reference pattern of time interval length ∆ t − with all previous patterns in the time series.“

(a) Pattern conformity analysis of financial market fluctuations

Δt− Δt+

Price Pattern

Transaction by transaction (b) Δt− Δt+ Price

Pattern Tobias Preis April 19, 2011 (c) Financial data (FDAX) (d) Random walk (no correlation) 0.10 0.002

0.08 0.001 0.06 0.000 0.04

0.02 −0.001 Pattern conformity Pattern

Pattern conformity Pattern 0.00 −0.002 0 0 25 5 25 5 20 10 20 10 15 15 15 − 10 15 + − 10 + 5 20 t Δt 5 20 Δt Δt 0 25 Δ 0 25 www.tobiaspreis.de Fluctuation Patterns True range adapted modified time series

~6tï 1.0 p^t (t) ~6tï p^t

0.5 ~6tï ^ p^t (t < 1)

0.0

^ ï ^ ^ t <6t t < 1 t

Tobias Preis April 19, 2011 T. Preis, W. Paul, and J. J. Schneider, Europhys. Lett. 82, 68005 (2008)

T. Preis, D. Reith, and H. E. Stanley, Phil. Trans. R. Soc. A 368, 5707-5719 (2010) Pattern Conformity / Trivial Cases

• Straight Line • Random Walk (a) (b)

1.002 0.002

1.001 0.001

U1.000 U0.000

0.999 ï0.001

0.998 0 ï0.002 0 25 5 25 5 20 20 15 10 15 10 10 15 10 15 ï 5 20 + ï 5 20 + 6t 0 25 6t 6t 0 25 6t + + ξχ ∆t ,∆t− Ξχ ∆t ,∆t− = T ∆t+ tˆ ∆t− + !sgn ωˆ "(τ,∆t ) ! " − | t | $ ∆t % ˆ τ=τ exp χQ − (τ) Tobias Preis t=#∆t− #∗ tˆ April 19, 2011 $ % Pattern Conformity / FDAX

(a) (b)

0.10 0.25 0.08 0.20 0.06 0.15 * U U 0.04 0.10 0.02 0.05 0.00 0.00 0 0 25 5 25 5 20 10 20 15 15 10 10 15 10 15 ï 5 20 + ï 5 20 + 6t 0 25 6t 6t 0 25 6t Complex correlations for financial market time series – especially for large pattern lengths. Tobias Preis T. Preis, P. Virnau, W. Paul, and J. J. Schneider, New J. Phys. 11, 093024 (2009) April 19, 2011 GPU-Computing GT200

single precision

G80 3.2 GHz Realistic illustrations Harpertown Driving force: NV30 computer game industry Source: NVIDIA CUDA programming guide 2003 2006 2008 Tobias Preis April 19, 2011 Outline

(i) “Econostatics” vs. “Econodynamics”

(ii) Analysis of complex pattern-based correlations in high frequency financial market data.

(iii)Switching processes in financial markets.

(iv) Agent-based model reproducing empirical stylized facts based on an order book structure.

Tobias Preis April 19, 2011 artemis-2:eurex_time_series tobias$ head -n 20 index_fdax_032007_pvt.filter 2007 1 2 8 0 9 78 6674.5 608 2007 1 2 8 0 10 1 6674.5 2 2007 1 2 8 0 11 79 6674 2 2007 1 2 8h 0 11 79 6674.5 3 2007 1 2 8 0 m12 29s 6673 1 2007 1 2 8 0 12 37 6673cs 1 year2007 1 2 8 0 12 37 6674 2price volume 2007 1 2 8 0 12 46 6674 3 2007 1 2 8 0 12 51 6674 3 2007month 1 2 8 0 12 55 6674 1 2007 1 2 8 0 12 55 6674.5 2 2007 1 2 8 0 12 60 6674.5 3 2007 1 2 8 0day 12 84 6673.5 2 Time Series 2007 1 2 8 0 14 20 6673 1 2007 1 2 8 0 15 25 6672.5 1 – 2007 1 2 8 0 15 25 6673 3 2007 1 2 8 0 15 62 6673 1 2007 1 2 8 0 15 62 6674 4 Data Structure 2007 1 2 8 0 19 16 6673 1 2007 1 2 8 0 19 16 6673.5 1 artemis-2:eurex_time_series tobias$

Tobias Preis April 19, 2011 Rescaling Analysis !"# $%&%'()*"&)+*,+-,.+/".,0')/%,%1&'%(","*2,'%*+'(".)3"&)+*

Trend #2 6t 6t 6t 6t Price 13,991,275 trades FDAX – June 2007 6t 6t 6t 6t – September 2008 – December 2008 Volume Trend #1 Trend #3

Transaction by transaction Volume sequence of trend #1

¡=0 ¡=1 ¡=2 Tobias Preis Renormalized time April 19, 2011 Rescaling Analysis

Extraction of trend sequences Volume sequence of trend #1

ε=0 ε=1 ε=2 Transaction by transaction

Volume sequence of trend #2

ε=0 ε=1 ε=2 Transaction by transaction

Volume sequence of trend #3

ε=0 ε=1 ε=2 Transaction by transaction Tobias Preis April 19, 2011 Rescaling Analysis

Renormalization of trend sequences Volume sequence of trend #1

ε=0 ε=1 ε=2 Renormalized time scale

Volume sequence of trend #2

ε=0 ε=1 ε=2 Renormalized time scale

Volume sequence of trend #3

ε=0 ε=1 ε=2 Renormalized time scale Tobias Preis April 19, 2011 Rescaling Analysis

Averaged volume sequence

ε=0 ε=1 ε=2 Renormalized time scale

Tobias Preis April 19, 2011 Rescaling Analysis

Averaged volume sequence for FDAX time series

Δt ranges from 50 to 100

ε=0 ε=1 ε=2 Renormalized time scale

Tobias Preis April 19, 2011 (a) (b)

Volume 1.1 Inter-trade times 1.4 1.0 1.3 ) ) ε ε ( ( * * 1.2 0.9 τ v 1.1 0.8 1.0 0.7 1.10 1.5 90 90 1.05

80 1.4 80 1.00

0.95 70 1.3 70 0.90 60 60 1.2 0.85 50 50 0.80 t of extrema [units of tick] of [units extrema of t t of extrema [units of tick] of [units extrema of t 1.1 Δ Δ 40 40 0.75 1.0

Order 30 Order 30 0.70

0.9 0.65 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 Renormalized time ε between successive extrema Renormalized time ε between successive extrema

Tobias Preis T. Preis and H. E. Stanley, APCTP Bulletin 23, 18 (2009) April 19, 2011 T. Preis and H. E. Stanley, J. Stat. Phys. 138, 431 (2010)

T. Preis, J. J. Schneider, and H. E. Stanley, accepted for publication in PNAS (2010) Quantities With Scale-Free Behavior (a) Transaction volume (FDAX) (b) Inter-trade times (FDAX) 1.4 1.0 1.3 ) ) ε ε ( ( * * 1.2 0.9 τ v 1.1 0.8 1.0

0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 Renormalized time ε between successive extrema Renormalized time ε between successive extrema

(c) Δt range: 50 to 1000 ticks (d) Δt range: 50 to 100 ticks 0.20 + β+ = β = −0.15 0.00 v 0.12 * * 0.15 v v v

10 − 10 0.10 −0.05 β = v 0.09 log log 0.05 β− = v −0.07 −0.10 0.00

−2.8− 2.4 −2.0 −1.6 −1.2 −1.6− 1.2 −0.8 −0.4 log10 ε−1 log10 ε−1 • Randomly reshuffling confirms our findings. Tobias Preis April 19, 2011 Reproduction with a Model

1.30 + ï0.11 1.25 0.06 `v ! ï 1.20 ` ! ï0.04

* v

v 0.04 " ¡

1.15 10 ! * v 1.10 log 0.02 1.05 0.00 1.00

0.8 0.9 1.0 1.1 1.2 ï2.8 ï2.6 ï2.4 ï2.2 ï2.0 ï1.8 ï1.6 ï1.4 ï1.2 ï1.0 Renormalized time ¡ between successive extrema log10 ¡<1

Tobias Preis April 19, 2011 Outline

(i) “Econostatics” vs. “Econodynamics”

(ii) Analysis of complex pattern-based correlations in high frequency financial market data.

(iii) Switching processes in financial markets.

(iv) Agent-based model reproducing empirical stylized facts based on an order book structure.

Tobias Preis April 19, 2011 Order Book Structure

• Price-time priority

• Discrete price levels

• Limit orders

• Market orders

T. Preis, S. Golke, W. Paul, and J. J. Schneider, Europhys. Lett. 75, 510 (2006)

Tobias Preis T. Preis, S. Golke, W. Paul, and J. J. Schneider, Phys. Rev. E 76, 016108 (2007) April 19, 2011 Model Definition

• Liquidity provider NA • Best bid pb

• Liquidity taker NA • Best ask pa

pa + pb • Limit order rate α • Midpoint pm = 2

µ s = p p • Market order rate • Spread a − b

• Order cancel rate δ

1 q = q = • Buy/Sell probability provider taker 2

Tobias Preis April 19, 2011 Model Definition

• Exponentially distributed order entry depth

• Limit price of a limit buy order

pl = p 1 η i a − −

• Limit price of a limit sell order

l pi = pb +1+η

η = λ log(x) • with stochastic variable !− 0 × $

Tobias Preis April 19, 2011 Results of the Model

2000 10 simulation data q (p-p ) 1500 9 LN m 8 1000 7 )>

m 6 ) [ticks] 0 500 5 4 0

p(t)-p(t 3 -500 2 1 -1000 0 1 2 3 4 5 6 7 8 9 10 0 100 200 300 400 500 5 t [10 MCS] p-pm [ticks]

1 (ln x M)2 PLN (x)=A exp −2 Sx√2π !− 2S "

• Order book depth: log-normal distribution

Tobias Preis April 19, 2011 Autocorrelations

0.2

0.1 ω(t + τ)ω(t) ω(t) 2 ) 0 !(ω(t)τ)=! "−! " 6o 2 2

(t), -0.1 ω(t) ω(t) t

( ! "−! " l -0.2 t(t)=bp(t) t(t)=|bp(t)| 2 -0.3 t(t)=bp (t)

-0.4 100 101 102 103 104 105 6o [MCS]

• Negative autocorrelation on short time scales

• Volatility clustering

Tobias Preis April 19, 2011 Results of the Model

0.6 10-1

0.5 10-2

0.4 10-3 )

p) -4 6o 0.3 6 10 H( P( 0.2 10-5 6o=200 random walk 6o=400 N =500 -6 =800 0.1 A 10 6o NA=250 6o=1600 NA=125 q(6p) 0 10-7 101 102 103 104 105 1 10 100 6o [MCS] 6p [ticks]

2 • H (∆τ) (∆p) 1/2 (∆τ) ∆τ H Hurst exponent : ! " ∝

• Random walk: H =1/2

Tobias Preis April 19, 2011 Asymmetric Order Flow

• Time dependent buy/sell probability (micro trends):

• Deterministic perturbation: Sawtooth

• Stochastic perturbation: Feedback random walk (FRW): RW with mean reversion tendency

T. Preis, S. Golke, W. Paul, and J. J. Schneider, Europhys. Lett. 75, 510 (2006) Tobias Preis April 19, 2011 Sawtooth

1 10-1 random walk N =500 0.8 A 10-2 NA=250 NA=125 0.6 10-3 )

p) -4 6o 0.4 6 10 H( P( 6o=200 0.2 10-5 6o=400 6o=800 -6 =1600 0 10 6o 6o=3200 q(6p) -0.2 10-7 101 102 103 104 105 1 10 100 6o [MCS] 6p [ticks]

• Deterministic modulation with a period of 200 MCS is reflected in the mean square displacement, leading to quasi-periodic oscillations of the Hurst exponent.

Tobias Preis April 19, 2011 Feedback Random Walk

0.7 10-1

0.6 10-2 0.5 10-3

) 0.4 p) -4 6o 6 10 H( 0.3 P( 10-5 6o=200 0.2 random walk 6o=400 N =500 -6 6o=800 0.1 A 10 NA=250 6o=1600 NA=125 q(6p) 0 10-7 101 102 103 104 105 1 10 100 6o [MCS] 6p [ticks]

• Again an anti-persistent behavior on short time scales, but a persistent behavior on medium time scales, and a diffusive regime on long time scales.

Tobias Preis T. Preis, J. Phys.: Conf. Ser. 221, 012019 (2010) April 19, 2011 Dynamic Order Depth

0.8 10-1 6o=200 0.7 -2 6o=400 10 6o=800 0.6 =1600 -3 6o 0.5 10 q(6p) )

p) -4 6o 0.4 6 10 H( P( 0.3 10-5 0.2 random walk N =500 A 10-6 0.1 NA=250 NA=125 0 10-7 101 102 103 104 105 -4 -3 -2 -1 0 1 2 3 4 3 6o [MCS] 6p [10 ticks]

• Hurst exponent H • Dynamic order entry depth leads to fat-tailed distribution p(t +∆t) p(t) q 1/q ∆tHq (∆t) !| − | # ∝ of price changes

T. Preis, S. Golke, W. Paul, and J. J. Schneider, Europhys. Lett. 75, 510 (2006)

Tobias Preis T. Preis, S. Golke, W. Paul, and J. J. Schneider, Phys. Rev. E 76, 016108 (2007) April 19, 2011 Conclusions

• Complex pattern-based correlations in high frequency financial market data.

• Switching processes in financial markets: Power-law behavior close to switching points.

• Order Book Model: Reproduction of anti-persistent scaling behavior on short time scales, persistent on medium time scales, and diffusive behavior on long time scales; fat-tailed price change distributions.

• Reproduction of switching point behavior.

Tobias Preis April 19, 2011 Conclusions

• Complex pattern-based correlations in high frequency financial market data.

• Switching processes in financial markets: Power-law behavior close to switching points.

• Order Book Model: Reproduction of anti-persistent scaling behavior on short time scales, persistent on medium time scales, and diffusive behavior on long time scales; fat-tailed price change distributions.

• Reproduction of switching point behavior.

Tobias Preis April 19, 2011 Conclusions

• Complex pattern-based correlations in high frequency financial market data.

• Switching processes in financial markets: Power-law behavior close to switching points.

• Order Book Model: Reproduction of anti-persistent scaling behavior on short time scales, persistent on medium time scales, and diffusive behavior on long time scales; fat-tailed price change distributions.

• Reproduction of switching point behavior.

Tobias Preis April 19, 2011 Conclusions

• Complex pattern-based correlations in high frequency financial market data.

• Switching processes in financial markets: Power-law behavior close to switching points.

• Order Book Model: Reproduction of anti-persistent scaling behavior on short time scales, persistent on medium time scales, and diffusive behavior on long time scales; fat-tailed price change distributions.

• Reproduction of switching point behavior.

Tobias Preis April 19, 2011 physicsworld.com Feature: Thank you ... Xxxxxxx

EPJ ST: Issue 194

TOPICS IN PHYSICS

How to Characterize Trend Switching Processes in Financial Markets Bubble trouble Tobias Preis    䤋 and H. Eugene Stanley  õ When a stock market rises unsustainably, it can create a financial bubble that sooner or later will burst. 1Center for Polymer Studies, Department of Physics, 590 Commonwealth Avenue, Boston, Massachusetts 02215, USA 2Institute of Physics, Johannes Gutenberg University Mainz, Staudinger Weg 7, 55128 Mainz, Germany 3Artemis Capital Asset Management GmbH, Gartenstr. 14, 65558 Holzheim, Germany Tobias Preis and H Eugene Stanley examine whether concepts from physics can be used to create a law describing exactly how such crashes occur

One of the key con- izing the singular Wild fluctuations in the stock prices and currency a PhD thesis in which he analysed real financial data. Tobias Preis and ceptual elements in behavior of functions modern statistical phy- such as thermodynamic exchange rates of every country have had a huge impact Bachelier claimed that a histogram of the changes in HEugene Stanley sics is the concept of functions. The second scale invariance, codi- category is a sort of on the world economy and the personal fortunes of mil- share price (measured over any period of time) forms a are at the Center for fied in the scaling data collapse, where hypothesis that func- under appropriate axis lions of us over the last few years. These instabilities bell-shaped curve known as a Gaussian function, with Polymer Studies, tions obey certain func- normalization, diverse tional equations whose data “collapse” onto a have also had another, perhaps unintended, conse- very large fluctuations essentially never occurring. In Department of solutions are power laws. The scaling hypothesis has two single curve. categories of predictions, both of which have been verified quence – of thrusting the academic discipline of other words, he believed that the chances of a serious Physics, Boston by a wealth of experimental data on diverse systems. The Econophysics research has been addressing a key ques- University, US. Preis first category is a set of relations, called scaling laws, that tion of interest: focusing on the challenge of quantifying “econophysics” firmly into the limelight. But does a crash occurring are almost zero. Such serious crashes serve to relate the various critical-point exponents character- the behavior of probability distributions of large fluctua- is also at ETH Zurich, tions of relevant variables such as returns, volumes, and the field that involves applying the concepts of statistical are indeed very rare, but when they do occur, their number of transactions. Sampling the fat tails of such distri- Switzerland, H. Eugene Stanley is a University Professor in the Department of butions require a large amount of data. However, there is a physics to economics really have anything important to effects can be devastating. Physics and Director of the Center for Polymer Studies at Boston truly gargantuan amount of pre-existing precise financial e-mail mail@ University. He had worked for MIT as a physics professor before market data already collected, many orders of magnitude contribute to discussions about the current economic The model associated with Bachelier is often referred he moved to Boston University. He also serves as editor-in-chief more than for typical complex systems. Accordingly, finan- tobiaspreis.de of Physica A and as editor of several journals including Quantita- cial markets are becoming a paradigm of complex systems, crisis? Yes – absolutely – because finding laws describ- to as the “random walk” or “drunkard’s walk” because tive Finance. He was elected to the National Academy of Sciences and increasing numbers of scientists are analyzing market Preis will be giving (USA) and was awarded the Boltzmann Medal from the Interna- data [1-7]. Empirical analysis has been focused on quanti- tional Union of Pure and Applied Physics (IUPAP) in 2004 for ing fluctuations is the essence of statistical physics. he assumed that stock prices go up or down randomly fying and testing the robustness of power-law distributions a free online lecture his contribution to statistical physics. In particular, the term that characterize large movements in stock market activity. Physicists are not, of course, the first people to apply by an amount that has a characteristic value. In recent “econophysics” was coined by him in the mid 1990s. He holds a at 4 p.m. BST on Ph. D. in Physics from Harvard University. Using estimators that are designed for serially and cross- sectionally independent data, findings support the hypothe- statistics to economics, with mathematicians also hav- years, however, econophysicists have been able to get sis that the power law exponents that characterize fluctua- 12 May – see Tobias Preis is a Research Assistant and Doctoral Candidate in tions in stock price, trading volume, and the number of Department of Physics at the Johannes Gutenberg University ing contributed to the field for many years. One of their their hands on a staggering quantity of real-time finan- physicsworld.com/ Mainz (Germany). He was elected to the Gutenberg Academy of trades [8, 9] are seemingly “universal” in the sense that Young Academics in 2009. He is also working for Artemis Capital they do not change their values significantly for different first significant breakthroughs came in 1900 when cial data, including the price, volume and timestamp of cws/channel/ Asset Management GmbH as Managing Director. Homepage: 䤋 http://www.tobiaspreis.de Electronic address: [email protected] Louis Bachelier, working under the tutelage of the every transaction of every stock you can think of. Thanks multimedia for õ Electronic address: [email protected] great French mathematician Henri Poincaré, published to this information, which is now available in huge finan- more details

18 APCTP BULLETIN

Physics World May 2011 1

Tobias Preis | www.tobiaspreis.de April 19, 2011