High-Frequency Covariance Estimation in R
High-Frequency Covariance Estimation in R
Author: Supervisor:
Patrick C HANG & Roger Assoc. Prof. Tim G EBBIE
B UKURU
Declaration of Authorship
We, Patrick C HANG & Roger B UKURU , declare that this report titled, “An Ex-
ercise in R: High Frequency Covariance estimation using Malliavin-Mancino
and Hayashi-Yoshida estimators” and the work presented in it are our own.
We confirm that:
• This work was done wholly or mainly while in candidature for a re-
search degree at this University.
• Where any part of this thesis has previously been submitted for a de-
gree or any other qualification at this University or any other institu-
tion, this has been clearly stated.
• Where we have consulted the published work of others, this is always
clearly attributed.
• Where we have quoted from the work of others, the source is always
given. With the exception of such quotations, this thesis is entirely our
own work.
• We have acknowledged all main sources of help.
• Where the thesis is based on work done by ourselves jointly with oth-
ers, we have made clear exactly what was done by others and what we
have contributed ourselves.
Signed:
Date:
v
Abstract
Science
Department of Statistical Sciences
Acknowledgements
We would firstly like to thank our supervisor Tim Gebbie for guiding us
through the various difficulties of this project and never revealing the answer
straight away, giving us the satisfaction of solving the problem ourselves. Ef-
fectively guiding us to ensure we were on time for the deadlines and always
finding the time to answer our questions.
We would secondly like to thank Etienne Pienaar and Melusi Mavuso for
their input and assistance. We would also like to thank Diane Wilcox, Chanel
Malherbe and Dieter Hendricks who provided us with resources to fast track
our progress.
Patrick Chang would like to thank the National Research Foundation for
funding his study at the University of Cape Town.
Thank You
Patrick C HANG & Roger B UKURU
ix
Contents
Abstract v
Acknowledgements vii
1 Introduction 1
2 The Theory 3
2.1 Trigonometric Fourier Transform . . . . . . . . . . . . . . . . . 3
2.1.1 Derivation . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.2 Numerical Implementation . . . . . . . . . . . . . . . . 5
2.2 Complex Exponential Fourier Transform . . . . . . . . . . . . . 6
2.2.1 Derivation . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.2 Numerical Implementation . . . . . . . . . . . . . . . . 8
2.3 Hayashi-Yoshida Estimator . . . . . . . . . . . . . . . . . . . . 10
2.3.1 Derivation . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.2 Numerical Implementation . . . . . . . . . . . . . . . . 11
4 Data Engineering 25
4.1 Data Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1.1 Collecting Data From Bloomberg . . . . . . . . . . . . . 25
4.1.2 Updated HF-Data Pipeline . . . . . . . . . . . . . . . . 26
4.2 Data Cleaning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.1 Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.2 Aggregation . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2.3 Overnight returns . . . . . . . . . . . . . . . . . . . . . . 29
4.3 Creating Data Samples . . . . . . . . . . . . . . . . . . . . . . . 30
4.3.1 Asynchronous Data . . . . . . . . . . . . . . . . . . . . 30
4.3.2 Calendar Time TAQ Data Aggregation . . . . . . . . . 31
4.3.3 Intrinsic Time TAQ Data Aggregation . . . . . . . . . . 34
Derman Framework . . . . . . . . . . . . . . . . . . . . 34
Lining Up Events . . . . . . . . . . . . . . . . . . . . . . 36
5 Data Science 39
x
6 Concluding Remarks 49
A Supporting Algorithms 51
B Appendix Derivation 55
B.1 Proof for Theorem 2.1.1 and 2.1.2 . . . . . . . . . . . . . . . . . 55
B.1.1 Proof for aq (Σ) . . . . . . . . . . . . . . . . . . . . . . . 55
B.1.2 Proof for a0 (Σ) . . . . . . . . . . . . . . . . . . . . . . . 59
B.1.3 Proof for bq (Σ) . . . . . . . . . . . . . . . . . . . . . . . 60
B.1.4 Proof for aq (Σi,j ) . . . . . . . . . . . . . . . . . . . . . . 61
B.1.5 Proof for a0 (Σi,j ) . . . . . . . . . . . . . . . . . . . . . . 62
B.1.6 Proof for bq (Σi,j ) . . . . . . . . . . . . . . . . . . . . . . 62
B.2 Proof for Theorem 2.2.1 . . . . . . . . . . . . . . . . . . . . . . . 63
B.3 Proof for Theorem 2.3.1 . . . . . . . . . . . . . . . . . . . . . . . 65
C Miscellaneous 73
C.1 Run times and General issues . . . . . . . . . . . . . . . . . . . 73
C.2 Supporting plots . . . . . . . . . . . . . . . . . . . . . . . . . . 75
xi
List of Figures
List of Tables
List of Abbreviations
Chapter 1
Introduction
Chapter 2
The Theory
d
∑ σi dW i + β j dt.
j
dp j = (2.1.1)
i =1
If we denote Si (t) to be the generic asset price at time t, we will set pi (t) =
ln(Si (t)). It can be shown that the covariance matrix of diffusion processes
given by (2.1.1) can be presented as
d
∑ σi (t)σik (t).
j,k j
Σ (t) = (2.1.2)
i =1
1 2π Z
j
a0 (dp ) = dp j (t),
2π 0
1 2π
Z
j
ak (dp ) = cos(kt)dp j (t), (2.1.3)
π 0
1 2π
Z
j
bk (dp ) = sin(kt)dp j (t),
π 0
1 2πZ
a0 ( Σ ) = Σ(t)dt,
2π 0
1 2π
Z
ak (Σ) = cos(kt)Σ(t)dt, (2.1.4)
π 0
1 2π
Z
bk ( Σ ) = sin(kt)Σ(t)dt.
π 0
The main idea behind this method is to find a mathematical expression of the
Fourier coefficients of Σ using the Fourier coefficients of dp j [1]. This leads to
Theorem 3.1 in [1]:
Theorem 2.1.1 Fix an integer n0 > 0, then the Fourier coefficients of the volatility
are given by the following formulae:
N
π 1 2
a0 (Σ) = lim
N →∞ N + 1 − n0 ∑ ( a (dp j ) + bs2 (dp j )),
2 s
s = n0
N
2π
aq (Σ) = lim
N →∞ N + 1 − n0 ∑ (as (dp j )as+q (dp j )), (2.1.5)
s = n0
N
2π
bq (Σ) = lim
N → ∞ N + 1 − n0
∑ (as (dp j )bs+q (dp j )),
s = n0
N
k
Σ(t) = lim
N →∞
∑ 1−
N
( ak (Σ) cos(kt) + bk (Σ) sin(kt)) , ∀t ∈ (0, 2π ).
k =0
(2.1.7)
The Féjer inversion formula has the advantage that if Σ is a positive function,
then the approximation (2.1.7) will again be positive [1]. However, we are
more interested in the integrated volatility defined as
Z 2π
σ̂ij2 = Σi,j (t)dt. (2.1.8)
0
2π (t j − t1 )
τj = , j = 1, ..., n. (2.1.10)
( t n − t1 )
The integrals for the Fourier coefficients of dp j can be computed using inte-
gration by parts [15]. Resulting in
p j (2π ) − p j (0) k 2π
Z
ak (dp j ) = + sin(kt) p j (t)dt,
π π 0 (2.1.11)
k 2π
Z
j
bk (dp ) = − cos(kt) p j (t)dt.
π 0
We note that (2.1.11) is numerically stable, because it does not involve the
differentiation of p j [1]. Furthermore, since the data gathered from financial
markets are discrete and therefore finite, we need an assumption of how the
data points are connected in order to compute (2.1.11). Malliavin and Man-
cino assume that p j (t) is equal to p j (ti ) in the interval [ti , ti+1 ] [1], also known
as the previous-tick interpolation [12]. Resulting in
N −1
p j (2π ) − p j (0) 1
ak (dp j ) ≈
π
+
π ∑ [cos(kti ) − cos(kti+1 )] p(ti ),
i =1
(2.1.12)
N −1
1
j
bk (dp ) ≈
π ∑ [sin(kti ) − sin(kti+1 )] p(ti ).
i =1
6 Chapter 2. The Theory
d
∑ σi dW i + b j dt,
j j
dp = j = 1, ..., n, (A-I)
i =1
hZ T i
E (b j (t))2 dt < ∞,
0
hZ T i (A-II)
j
E (σi (t))4 dt < ∞,
0
i = 1, ..., d; j = 1, ..., n.
The idea main idea behind this derivation is the same as section 2.1. We
want to establish a connection between the Fourier transform of the volatility
process (2.1.2) and the Fourier transform of the price process [9].
We first re-scale the time window from [0, T ] to [0, 2π ]. We then define the
Fourier transform of dp j as
1
Z
j
F (dp )(k) := exp(−ikt)dp j (t), (2.2.1)
2π [0,2π ]
and the Bohr convolution product between two functions Φ, Ψ on the inte-
gers Z as
N
1
(Φ ∗ B Ψ)(k) := lim ∑ Φ ( s ) Ψ ( k − s ).
N →∞ 2N + 1 s=− N
(2.2.2)
1
F (Σij )(k) = F (dpi ) ∗ B F (dp j )(k), ∀k ∈ Z. (2.2.3)
2π
The equality (2.2.3) is attained in probability, which means the limit in the convolu-
tion product exists in probability
Using Theorem 2.2.1, we get that
2π
F (Σij )(k) = lim
N →∞ 2N + 1
∑ F (dpi )(s)F (dp j )(k − s),
|s|≤ N (2.2.4)
∀k ∈ Z.
8 Chapter 2. The Theory
Now that we have an expression for the Fourier coefficients of the volatility
process, we can reconstruct Σ(t) using the Féjer inversion formula. Yielding
|k|
Σij (t) = lim
N →∞
∑ 1−
N+1
F (Σij )(k) exp(ikt). (2.2.5)
|k|≤ N
Having an expression for the Fourier coefficients of the volatility process al-
lows for the computation of the integrated volatility as
Z 2π
σ̂ij2 = Σij (t)dt = 2π F (Σij )(0)
0 (2.2.6)
2 i j
= (2π ) (F (dp ) ∗ B F (dp ))(0).
n −1
p1n (t) := ∑ p1 (t1i ) I[t1i ,t1i+1 ) (t),
i =1
n −1
(2.2.7)
p2n (t) := ∑p 2
(t2j ) I[t2 ,t2 ) (t).
j j +1
j =1
Malliavin and Mancino [2] defines Ii1 := [t1i , t1i+1 ) and Jj1 := [t2j , t2j+1 ) and the
returns by δI 1 ( p1 ) := p1 (t1i+1 ) − p1 (t1i ) and δ J 2 ( p2 ) := p2 (t2j+1 ) − p2 (t2j ). Then
i j
the Fourier coefficients of the price process through use of a simple function
approximation becomes
n −1
1
F (dp1n )(k) ≈
2π ∑ exp(−ikt1i )δIi1 ( p1 ),
i =1
n −1
(2.2.8)
1
F (dp2n )(k) ≈
2π ∑ exp(−ikt2j )δIj2 ( p2 ).
j =1
Z 2π n −1 n −1
1 is(t1 −t2 )
0
ij
Σ (t)dt = ∑ ∑ ∑
2N + 1 |s|≤ N j=1 i=1
e i j δ I 1 ( p1 ) δ I 2 ( p2 )
i j
(2.2.9)
n −1
V := ∑ ( Pt1i+1 − Pt1i )( Pt2i+1 − Pt2i ). (2.3.1)
i =1
The realized covariance estimator has the well known property that as the
RT
Mesh tends towards 0 (i.e. max1≤i≤n−1 |ti+1 − ti | → 0), then V → 0 Σij (t)dt
in probability. As Hayashi and Yoshida point out [3], there are two crucial is-
sues regarding the implementation of the realized covariance estimator. The
first is that actual transaction data is asynchronous. Secondly, due to the
asynchrony, a significant portion of the original data set will be missing at
pre-specified grid points. Therefore, in order to use (2.3.1), we must choose a
common interval h first, and impute or interpolate the missing observations
in some way [3] - this is commonly referred to as synchronizing the data. The
first thing to notice is that the estimate V heavily depends on the value of h
we pick. Additionally, as we have mentioned before Barucci and Renò [7]
found that linear interpolation induces a bias. Malherbe [15] points out that
the common intervals h need not be the same length, however we note that
it is important for the intervals to be common. Otherwise the contribution in
(2.3.1) will be 0.
Hayashi and Yoshida proposed a cumulative covariance estimator which is
free from the need to synchronize the data beforehand. The assumptions
required are that the price process follows the one-dimensional Itô process
dpl = µl dt + σl dW l , l = 1, 2, (A-III)
where | I | is the length of an interval I [3]. Hayashi and Yoshida define the
cumulative covariance estimator as
n n
Un := ∑ ∑ ∆P1 ( I i )∆P2 ( J j )1{ I i ∩ J j 6=∅} . (2.3.2)
i =1 j =1
Z T Ni
0
Σii (t)dt = ∑ [∆P1 ( I i )]2. (2.3.3)
i =1
For the case when i 6= j, we use Kanatani’s weighted realized volatility [19]
defined as
Z T
0
Σij (t)dt = ∆Pi W∆P j
0
Ni Nj (2.3.4)
= ∑ ∑ wkl ∆P ( I i k j
)∆P ( J ),l
k =1 l =1
where
Pi (t1i ) − Pi (t0i )
w11 . . . w1Nj
.. . .. .. .
∆Pi = , W = ..
. . .
i i i i
P (t Ni ) − P (t Ni −1 ) w Ni 1 . . . w Ni Nj
Remark 2.3.2 Kanatani’s weighted realized volatility can also be used for Malliavin
and Mancino’s Fourier estimator. See [19] or [16].
Chapter 3
dSi (t)
= µi dt + σi dWi (t), i = 1, 2. (3.1.1)
Si ( t )
Figure 3.1 1 (a), we see that both MM (blue dotted line) and HY (red dotted
line) perfectly recover the induced correlation (black dotted line) for the syn-
chronous case. From figure 3.1 (b) through to (d), it is clear that as the level of
asynchrony increases, MM appears to have a downward bias towards zero
which [12] attributes to the Epps effect [4] while HY recovers the induced
correlation regardless of the level of asynchrony.
Hayashi and Yoshida claim that the Epps effect is a bias that arises from the
estimator for which their estimator is immune to [3]. Looking at figure 3.1,
this seems to be the case. However, this goes against the findings of [6],
[12], [13], [20]. The current literature has identified the main sources for the
Epps Effect to be: smaller sampling intervals [4], [20], lead-lag [6], [12] and
asynchronicity [12], [13]. Closed-form expressions recovering the Epps Effect
can be found in [6], [20] - indicating that the Epps Effect is not a bias from the
1 Figure 3.1 can be reproduced using MissingData.R.
14 Chapter 3. Monte Carlo Experiments
estimator. This, in turn, means that it is the HY that is upward biased even
though it recovers the induced correlation.
correlation (ρ)
Induced Induced
0.0 0.0
MM MM
HY HY
−0.5 −0.5
−1.0 −1.0
0 5 10 15 20 0 5 10 15 20
simulation simulation
0.0 0.0
MM MM
HY HY
−0.5 −0.5
−1.0 −1.0
0 5 10 15 20 0 5 10 15 20
simulation simulation
This experiment although recovers the Epps effect arising from asynchrony,
is not an experiment conducted on a truly asynchronous process. It is rather
a missing observation experiment. Therefore, the argument is that the HY
estimator is the better estimator of the two if one believes that the observed
prices in the market are discrete samples of an underlying continuous stochas-
tic process and that asynchrony is a missing data problem. Then the HY
estimator will be able to reproduce the true underlying correlation between
3.2. Effect of the SDE 15
dSi (t)
= µi dt + σi dWi (t) + dJi (t), i = 1, 2. (3.2.1)
Si (t−)
16 Chapter 3. Monte Carlo Experiments
correlation (ρ)
MMSyn MMSyn
0.0 0.0
HYSyn HYSyn
MMAsyn MMAsyn
−0.5 −0.5
HYAsyn HYAsyn
−1.0 −1.0
0 5 10 15 20 0 5 10 15 20
simulation simulation
correlation (ρ)
correlation (ρ)
MMSyn MMSyn
0.0 0.0
HYSyn HYSyn
MMAsyn MMAsyn
−0.5 −0.5
HYAsyn HYAsyn
−1.0 −1.0
0 5 10 15 20 0 5 10 15 20
simulation simulation
N (t)
Ji (t) = ∑ (Yj − 1), (3.2.2)
j =1
3.2. Effect of the SDE 17
Si ( t ) = U ( t ) − D ( t ) , i = 1, 2, (3.2.3)
U and D are limited to have the same shape and scale parameters allowing
an alternative representation W ( G (t)) where W is a standard Brownian mo-
tion, G a gamma process [22] and corr(dW1 , dW2 ) = ρ ranging from (-1, 1).
A sample path of 10,000 seconds is simulated starting at R100 with daily pa-
rameters µ1 = µ2 = 0.01, σ12 = 0.1, σ22 = 0.2 and β 1 = β 2 = 1. This model
will determine if a pure jump process will cause the estimators to differ.
The bivariate GARCH (1,1) model satisfies the following SDEs:
and
p
dσ12 (t) = θ1 [w1 − σ12 ]dt + 2λ1 θ1 σ12 (t)dW3 (t),
p (3.2.6)
dσ22 (t) = θ2 [w2 − σ22 ]dt + 2λ2 θ2 σ22 (t)dW4 (t).
where corr(dW1 , dW2 ) = ρ ranges from (-1, 1). We simulate a sample path
of 10,000 seconds starting at R100 using the parameters from [12], [23] i.e.
θ1 = 0.035, θ2 = 0.054, w1 = 0.636, w2 = 0.476, λ1 = 0.296 and λ2 = 0.48
2 . This model will determine if stochastic volatility and volatility clustering
where corr(dW1 , dW2 ) = ρ ranges from (-1, 1). A sample path of 10,000 sec-
onds is simulated starting at R100 with parameters µ1 = µ2 = 100, σ12 = 0.1,
σ22 = 0.2, θ1 = 0.035 and θ2 = 0.054. This model will see if the two estimators
differ under mean-reversion.
(a) GARCH (1,1) (b) Ornstein Uhlenbeck
1.0 1.0
Method Method
correlation (ρ)
MMSyn MMSyn
0.0 0.0
HYSyn HYSyn
MMAsyn MMAsyn
−0.5 −0.5
HYAsyn HYAsyn
−1.0 −1.0
0 5 10 15 20 0 5 10 15 20
simulation simulation
Figure 3.2 3 (a) through to (c), λ1 = λ2 = 0, 0.2 and 0.5 respectively. The
asynchronicity is induced by down-sampling each price path by 20%. For all
the plots in figure 3.2, the synchronous MM (blue dotted line) is the same as
the synchronous HY (red dotted line). The asynchronous HY (orange dotted
line) recovers the synchronous estimates while the asynchronous MM (pur-
ple dotted line) has a lower correlation estimate than the synchronous case.
In figure 3.2 (a) through to (c), both the synchronous MM and HY estimators
produce the same estimate which drops towards zero as λ increases. This
drop in correlation is not due to any bias from the estimators but rather due
to the fact that the jump process of the Merton model is independent of the
underlying diffusion process. Therefore as the intensity of jumps increase,
the impact from the independence, seeps through to change the correlation
structure of the overall jump-diffusion process. This is the case because when
the trades are synchronous, HY becomes the Realized Volatility (RV) [16] and
the RV is consistent under jumps [24]. Therefore, the two estimators seem to
3 Figure 3.2 can be reproduced using SDE1.R.
3.3. Effect of Asynchrony 19
only differ under asynchrony and it is not dependent on the type of diffusion
process.
Figure 3.3 4 , the asynchrony is induced by down-sampling each price path
by 20%. Once again, the synchronous MM (blue dotted line) is the same
as the synchronous HY (red dotted line) and the asynchronous HY (orange
dotted line) recovers the synchronous estimates while the asynchronous MM
(purple dotted line) has a lower correlation estimate than the synchronous
case. Figure 3.3 provides the insight that neither volatility clustering nor
mean-reversion causes the two estimators to differ under synchronicity. The
two estimators only seem to produce different estimates under asynchronous
conditions.
This experiment falsifies the idea that various stochastic processes will cause
the two estimators to differ, rather it further validates that the two estima-
tors differ only under asynchronous conditions, where the HY estimator is
immune to the Epps effect brought through by asynchrony (under missing
data conditions) while MM estimator picks up the Epps effect.
Method Method
0.350
Correlation (ρ)
Correlation (ρ)
Induced Induced
0.34
0.345
MM Asyn MM Asyn
MM Syn
0.340 MM Syn
0.33
0.335
F IGURE 3.4: We recover the result from [12] using the complex
exponential Fourier Transform 2. The average correlation as
a function of the sampling frequency N in (2.2.2). Concretely,
the asynchronous sample paths for (a) and (b) are exponen-
tial inter-arrival time samples from 86,400 seconds of simulated
data. The exponential inter-arrival times have a mean of 15 sec-
onds and 45 seconds respectively for asset 1 and asset 2. The
synchronous sample paths for (a) and (b) are achieved by forc-
ing the first time series to be observed at the same times as the
second time series. (a) is simulated by adjusting (3.2.5) to how
[12] defined the SDE and implemented by adjusting algorithm
12 accordingly. (b) is simulated from (3.2.5) using algorithm 12.
As per the figure legend, the green dots and blue dots are the
asynchronous and synchronous sample paths estimated using
algorithm 2 respectively. The orange line is the induced corre-
lation between (3.2.5). The results are obtained through 10,000
replications.
Drawing attention back to comparing the two estimators, we modify the ex-
periment slightly. Specifically, for figure 3.5, the experiment is conducted
5 Figure 3.4 can be reproduced using Reno Recovery.R.
3.3. Effect of Asynchrony 21
by first simulating price paths of 10,000 seconds from the various stochas-
tic processes from above, using their respective parameters as before 6 . The
asynchrony is induced by sampling the first asset with an exponential inter-
arrival time with mean 30 seconds and the second asset with a mean of 45
seconds. The synchronous case here is achieved by forcing the first time se-
ries to be observed at the same time as the second time series. The rationale
behind adjusting the experiment is so that the Nyquist frequency can be in-
dicated.
From figure 3.5 7 , it is clear that for the MM estimates, the correlations de-
crease for the asynchronous case as the number of Fourier coefficients (N)
increase; whereas for the synchronous case the correlations become closer
to the synchronous HY estimates as N increases. Additionally, the error
bars calculated to be the standard deviation from the estimates decrease as
N increases indicating that the estimates become more accurate with more
Fourier coefficients. The HY estimates are not a function of N, but rather it
a baseline to compare the MM estimate against. For figure 3.5 (a) through
to (e), the asynchronous HY estimate recovers the synchronous HY estimate
which is expected as Hayashi and Yoshida have claimed that their estimator
is immune to the Epps effect. Oddly enough, the HY estimator demonstrates
an Epps effect when using the Ornstein Uhlenbeck process. This was not
picked up by the experiments before and a possible explanation for this is
due to how this experiment is set up. In the previous experiments asyn-
chrony was induced through a missing data manner, while in this experi-
ment, the asynchrony is induced through exponential inter-arrival times to
sample the price paths. Combined with the mean-reversion from the OU
process, the sampling may have picked up different co-movements between
the price paths. Another possible explanation is due to the combination of
sampling method and mean-reversion, spurious lead-lag relations may have
arisen due to the high levels of asynchrony which is another source for the
Epps effect as investigated by [6], [12]. This further highlights the downfall of
the HY estimator for high-frequency finance. Although the HY estimate may
be immune to the Epps effect in a missing data manner, it is not immune to
the Epps effect arising from lead-lag [10] nor from smaller synchronous sam-
pling intervals [4] as seen in real financial data in later sections. Additionally,
when levels of asynchrony is high - common for high-frequency data, the
HY deletes observations [11] and therefore it is not well suited to study the
co-movement between events.
6 The Merton Model has λ1 = λ2 = 0.2
7 Figure 3.5 can be reproduced using Reno Extended.R.
22 Chapter 3. Monte Carlo Experiments
0.4 0.4
Correlation (ρ)
Correlation (ρ)
HY Syn HY Syn
0.3 0.3
Induced Induced
0.2 0.2
MM Asyn MM Asyn
Nyquist Frequency Nyquist Frequency
0.1 0.1
MM Syn MM Syn
0.4
0.4
Correlation (ρ)
Correlation (ρ)
HY Syn HY Syn
0.3
0.3
Induced Induced
0.2
0.2
MM Asyn MM Asyn
Nyquist Frequency
0.1 Nyquist Frequency
0.1
MM Syn MM Syn
HY Asyn HY Asyn
0.50
Correlation (ρ)
Correlation (ρ)
HY Syn HY Syn
0.4
Induced Induced
0.25
MM Asyn MM Asyn
0.2 Nyquist Frequency
From figure 3.5, the Nyquist frequency is calculated using the average sam-
pling frequency, this is not the true cutoff required to avoid any aliasing.
3.3. Effect of Asynchrony 23
The true cutoff required is computed by first finding the highest sampling
frequency present in the data, then computing the corresponding Nyquist
frequency. Using the true cutoff is how we compute all the MM estimates in
this paper except in figure 3.4 and 3.5. The rationale behind this is that we
are trying to study the co-movement between high-frequency events, there-
fore picking a lower N to avoid market microstructure noise will lead to the
aliasing of the event data. Picking a lower N, in essence, creates a smooth-
ing effect due to aliasing of higher frequencies which is useful to identify the
true signal under the market microstructure noise argument [9], but for the
context of identifying the co-movement of events, picking a lower N will be
a fatal choice to make.
This means that using the appropriate cutoff for the asynchronous cases in
figure 3.5, all the correlations for the MM estimate diminish to zero. This
result combined with the drop in correlation as the % of missing data in-
creased in figure 3.1, indicates the importance the level of asynchrony has in
contributing towards the Epps effect [13].
A point to be noted is that although this paper argues for the efficacy of
the MM estimator over the HY estimator in the high-frequency paradigm
through an event-based view of the world, we have presented results from
the classical continuous-time stochastic processes which is a slight inconsis-
tency to the event-based view we are taking. This is because of the limited
techniques present in the literature to simulate a price process. Therefore
we do note an extension on our results is to study how the correlations be-
have when the process is simulated from a Hawkes process [25] which can
hopefully provide more insight into the co-movement between events and
their relation to the Epps effect. However, our results are not futile because
we have recovered and validated the work from previous researchers and
have further performed a wholistic comparison of the two estimators with
the various SDEs.
Although we have argued for the efficacy of the MM estimator over the HY
estimator through an event-based view of the world, other researchers have
also argued for the efficacy of the MM estimator in the market-microstructure
noise view of the world. Specifically, [9] shows that the MM estimator is
unbiased for the contaminated price process by an appropriate choice of n
and N; while [11] points out that the HY estimator is infeasible in the setting
of market microstructure noise.
Finally, a subtle point to notice is that all the SDEs used in this paper has
dimensionless correlation which does not depend on time and therefore we
could not study the Epps effect arising from smaller sampling intervals us-
ing Monte Carlo experiments, but from figure 3.4 and 3.5, we use the Fourier
methods to study smaller sampling intervals. This subtle difference is due
to what [6] showed. The correlation arising from asynchrony not only de-
pends on the level of asynchrony, but also on the sampling intervals chosen.
Therefore it seems that the Epps effect arising from smaller sampling inter-
vals and asynchrony have some form of relation, and therefore more rigorous
24 Chapter 3. Monte Carlo Experiments
where the correlation only decreases and does not change signs. However,
in section 5, we show that there seems to be a structural change in the corre-
lation that it is not only decreasing but also becoming positively correlated.
Indicating that there is more to this problem than what meets the eye.
25
Chapter 4
Data Engineering
The manual (GUI) and excel add-in are unreliable when it comes to extract-
ing large datasets from Bloomberg; furthermore, it has the added complica-
tion of not being easily reproducible. Thus we will consider more dynamic
programmatic methods such as C, Python and R. The main complication that
arises with C and Python is that one might not have the administrative rights
to run the APIs, therefore we opt for the R API to extract TAQ data from
Bloomberg.
For the purpose of collecting TAQ data, the choice of R comes with its caveats,
mainly:
• Writing the TAQ data into flat files results in large flat files, which can
take several hours to complete depending on the memory available on
the terminal.
• Large flat files are complicated to read in R and often require Java or
C++ interfaces to speed up the process.
This issue is not trivial due to the large nature of TAQ data. For example,
one of the more liquid tickers - Naspers (NPN) has 15,544,244 data points
for a period of 6 months which results in a flat-file of 450-500MB. Therefore
obtaining data for all 10 tickers translates to roughly 5GB of data, illustrating
the non-trivial nature of this problem.
After identifying these issues, we realised the need to find a more efficient
and easily reproducible process to overcome the issues presented above.
R Environments
of Ticker Data
Data Processing
Data Pulling
The key factor that solves the issue of large files and long computation time
is simply saving the data as R environments rather than flat files. The advan-
tages achieved by doing so are exceptional, namely:
• R environments are significantly smaller when saving data compared
to flat files. For example, the Naspers (NPN) ticker when saved to a
flat-file results in a size of 500MB, while as an R environment, the size
reduces to 47MB - a decrease of 90.6% in storage size.
• Reading in the R environment is significantly quicker - even more so
than using third party interfaces such as Java or C++ and furthermore
avoids any memory issues which arise from large file sizes.
Now the largest overhead left is simply the time it takes to extract data from
Bloomberg since the other areas have been streamlined. To see the efficiency
up the updated pipeline, we consider the file sizes and time spent in extract-
ing and loading TAQ data. We initially pulled 24 tickers which took approx-
imately 3 hours to extract from Bloomberg. Now saving the extracted data
as an R environment resulted in a file of 557.6MB as opposed to the 4.9GB
when saving the data as flat files. The point of significance is when we have
to read the data. Loading the R environment takes on average 25-30 seconds
while loading the flat files took several hours with no result 1 . Finally, the last
advantage this approach presents is that it is ring-fenced within R and does
not rely on third-party interfaces such as rJava or Rcpp 2 .
The pipeline although advantageous, does present some potential pitfalls
which we have not yet encountered. Specifically, if the R environment ex-
ceeds 2GB then reading in data might pose an issue. This can be pragmati-
cally solved by writing various assets into their own R environment. How-
ever, this should never present itself as a real issue given the limitation of
the Bloomberg terminal which only allows for 6 months of TAQ data to be
extracted. Finally, the pipeline is designed to extract TAQ data, but this can
easily be extended to pull other forms of data from Bloomberg.
process. The other trade types are after-hour trades (LT), correction of previ-
ous days published off book trade (LC) and an indicative auction price based
on the volume maximising auction algorithm used to determine the auction
uncrossing price (IP) [27] - which are irrelevant to the analysis.
4.2.2 Aggregation
An issue with Bloomberg data which is not present with Thomson Reuters
data is that timestamps are only shown up to seconds, therefore there are
multiple trades with the same timestamp - illustrated in figure 4.2. This poses
an issue when using the MM and HY estimators - the two estimators require
unique time stamps for each trade.
In figure 4.3 we demonstrate the output of algorithm 4 using one set of “re-
peated” trades Jj from figure 4.2.
The merging is achieved by first pre-populating a data frame with the high-
est available sampling frequency (1 second) over the period of consideration,
then slotting the prices for each asset into their respective times and remov-
ing entire rows of NaNs afterwards.
4.3. Creating Data Samples 31
To create the return matrix required, the returns are computed separately for
each asset over each of the days considered, and the first return for each day
takes on the time index of the second trade in that day, while the first trade
for each day takes on NaN as a placeholder 7 . By computing the returns for
each day separately, we have dealt with the over-night returns. The merging
is then achieved in the same manner as the prices and the result is shown in
figure 4.5.
The main difference between the bar data we created and the bar data ex-
tracted from Bloomberg is that Bloomberg’s bar data clocks at exact minutes,
whereas our bar data does not. This difference is due to the fact we wanted
a function that can create bar data for any dataset given. Therefore to avoid
data snooping the first opening price, we began the counter from the time of
the first trade. This was a pragmatic choice because unlike Bloomberg which
will always have a previous closing price to pull from, our finite dataset has
its limitations.
Algorithm 5 10 is presented for 1 asset, however the bar data for the analysis
is for multiple assets. Therefore to make the bar data for more than one asset,
the only point to note is that the T1 used in t∗j = T1 + jτ is computed as the
earliest trade of the day across all the assets across all the days considered 11 .
Then algorithm 5 is applied for each asset.
Figure 4.6 and 4.7 shows the result of algorithm 5 applied to two assets and
converting the closing price and VWAP price to returns respectively.
10 The implementation of algorithm 5 can be found in SynchronousData.R.
11 Forassets which do not have an opening trade the same time as T1 , the opening price is
set to NaN.
4.3. Creating Data Samples 33
F IGURE 4.6: BTI and NPN 10 Minute Closing Bar Return Sam-
ple
F IGURE 4.7: BTI and NPN 10 Minute VWAP Bar Return Sample
A point of detail to note about the creation of figure 4.6 and 4.7 is that the
OHLCV is computed for each asset, and for assets which do not have any
trades within a bar, that row of OHLCV is not computed and therefore skipped.
Returns are then computed for each assets closing and VWAP for each day,
then merged into a data frame in the same manner as the creation of asyn-
chronous returns 12 .
12 We initially made the error for figure 4.7 whereby we computed the OHLCV based on
returns, rather than computing the returns after obtaining the OHLCV for the prices.
34 Chapter 4. Data Engineering
Derman Framework
The first method we will use to aggregate TAQ data in intrinsic time is the
framework provided by Derman [14], where each stock has its own trading
frequency v j . The added benefit from this framework is that it is a natural
way to deal with the asynchrony from high-frequency data through the fact
that each stock has its own trading frequency, and more importantly it pro-
vides an elegant link between intrinsic time and calendar time. However,
this framework has its drawbacks (discussed in section 5.2).
To implement this method of aggregation, we first need the average trades
per day for each stock V̄j over the given data period considered (31/05/2019
- 07/06/2019).
∑i Si ∗ Vi
Pτ =
∑i Vi
end while
return P = { P1 , ..., PM } . M = τ at end of while loop
13 High Frequency Traders
4.3. Creating Data Samples 35
The first point to note about algorithm 6 14 is that it is for one trading day,
and thus the remaining trades at the end of each day which do not have
enough volume to form a bucket are discarded. This choice although devi-
ates from the framework, is justifiable. This is because even though intrinsic
time operates on a separate measurement of time, trading is still performed
on calendar time and at the end of each day the “silicon traders” stop trad-
ing. Furthermore, due to the overnight period, the opening auction can shift
the prices to a completely different level and thus combining the remaining
trades at the end of each day with the first few trades of the next day is not
coherent. Due to this choice, the samples created are not completely syn-
chronous as expected from the framework. This is because V̄j is computed as
the average trades per day over the given period while day to day volume
traded can be different, therefore some assets will have more (less) prices
than the Number of Buckets due to the volume traded in that day being more
(less resp.) than the average. Thus the non-trading times (in intrinsic time)
are filled in with NaNs. Algorithm 6 is computed for each trading day sepa-
rately, then combined afterwards. Finally, the overnight returns are removed
in the same manner as before, by computing the returns for each day sepa-
rately and combining it afterwards. The overnight returns are removed for
the reason that humans operate in calendar time and overnight information
can get priced into the opening auction, therefore changing the price level,
resulting in a return that is not consistent with the continuous trading pro-
cess.
Figure 4.8 shows the resulting intrinsic time return samples for the first trad-
ing day of multiple assets where the average trades per day are computed
over the period (31/05/2019 - 07/06/2019).
Lining Up Events
Due to the synchronicity of the Derman framework, the resulting correla-
tion estimates are very similar for both estimators. Thus it is not particularly
meaningful in the context of comparing our estimators. Therefore we employ
another method of aggregating TAQ data in intrinsic time which preserves
the asynchrony of events while retaining the benefit of gaussian returns.
j ∑ k Sk
Pτ =
v
j
Remove the first v Sk from A j
else
j
Pτ = NaN
end if
end for
end while
end for
j j
return P j = { P1 , ..., PM } . M = τ at end of the loops
the events based on the most liquid asset which provides a baseline “clock”
for which assets are lined up accordingly.
V̂ in algorithm 7 is computed the same way as V̂j - the average trades per day
over the period considered. The main difference between algorithm 7 is that
the prices need to be computed for all assets at the same time, whereas the
previous algorithms permitted prices for individual assets to be created then
combined. Due to the nature of this aggregation, computing the returns is not
as simple as before, as in we cannot simply use the function diff() anymore.
This is because the function computes x [(1 + lag) : n] − x [1 : (n − lag)], and
therefore if there are no successive prices, the returns will not be computed.
Thus to overcome this issue, we need to first extract the actual prices for
each asset, compute the returns then place them back into their respective
positions.
Removing the overnight returns follows the same process as for algorithm 6,
we apply algorithm 7 for each trading day, then combine them afterwards.
Furthermore, the remaining trades at the end of each day which cannot fill
up a bucket gets discarded - for the same reason we discarded them in the
Derman framework, to focus only on the continuous trading process. How-
ever, this poses an issue for the less liquid stocks when the Number of Buckets
are smaller. This is because the bucket sizes become very large and therefore
some of the less liquid stocks do not have enough trades to form two prices
and thus returns cannot be computed for that day. Due to this issue, we will
ignore the Calendar time equivalent of 1 hour bar samples and focus only on
a bucket frequency of 48 and 480.
Figure 4.9 below illustrates a data sample using algorithm 7 with a bucket
frequency of 48 and the basis ticker is FSR.
From the data samples in figure 4.8 and figure 4.9, we note that there is a
striking difference between these samples. Namely, in figure 4.8, the trades
are near synchronous while in figure 4.9, we have high levels of asynchrony
- allowing us to gain further insights into the two estimators and how they
compare.
39
Chapter 5
Data Science
Turning our attention to real financial data, we perform the novel application
by studying the Epps effect through various methods of aggregating Trade
and Quote (TAQ) data. Specifically, we compare calendar time based sam-
pling with volume time sampling methods.
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.2829 −0.5 AGL |ρij| = 0.2912 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
(b) MM 10 Min Close Price (f) HY 10 Min Close Price
ρ ρ
FSR FSR
1.0 1.0
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.2334 −0.5 AGL |ρij| = 0.2347 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.1384 −0.5 AGL |ρij| = 0.1466 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.0355 −0.5 AGL |ρij| = 0.1051 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
Epps effect persists with the MM estimator into the TAQ data, while the cor-
relation does not completely die out with the HY estimator as we go further
into the high-frequency spectrum - indicating that the HY is manufacturing
correlations through its multiple contributions. Further attesting to our ar-
gument that the HY estimate is biased for high-frequency event data.
The correlation structures in figure 5.2 is very similar to that of 5.1, the bank-
ing sectors are still strongly positively correlated. The main difference be-
tween the two correlation structures is that the VWAP aggregation seems to
accentuate the existing correlation structure in the Closing aggregation. This
is very interesting because the aggregation methods are quite different, the
VWAP incorporates more information within the given bar by means of aver-
aging while the closing prices are mere samples from the finite TAQ sample,
yet their correlation structures remained very similar. Additionally, the Epps
effect is once again present in this method of aggregation - once again sug-
gesting there seems to be a structural change in correlation that is dependent
on the sampling interval.
An interesting point to note in figures C.3 and C.4, is that we initially made
the error of computing the OHLCV based on returns, rather than computing
the returns after obtaining the OHLCV prices. Therefore, initially we had
the closing and VWAP returns computed on the TAQ data for the various
intervals, instead of computing the returns over the various intervals. The
interesting thing about this is that we still saw an Epps effect under these
circumstances, where the returns are computed from the highest available
sampling frequency, rather than dependent on the various sampling inter-
vals. Therefore the Epps effect was also inadvertently achieved by sampling
the TAQ returns at various sampling frequencies. This begs the question as
to what the Epps effect truly is. How and why did it still show up even when
returns are computed at the highest available sampling frequency?
The VWAP bars share the same issue as the closing bars; some of the less
liquid stocks will not have any trades within a given bar, thus the bar data is
not truly synchronous and the two estimators differ slightly. It must be noted
that although the VWAP incorporates more information from the stocks it
has its own issues; namely that it hides any jumps the price paths may have
into the average, therefore acting as a smoothing operator similar to that
of a Moving Average. An additional issue is that the aggregation between
the bars lacks consistency, this is because aggregating the data in calendar
time means that different bars will be averaged with different volume sizes.
Therefore a more suitable way to incorporate information from the price path
is to look at intrinsic time aggregation.
5.1. Calendar Time 43
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.3172 −0.5 AGL |ρij| = 0.3201 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
(b) MM 10 Min VWAP (f) HY 10 Min VWAP
ρ ρ
FSR FSR
1.0 1.0
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.256 −0.5 AGL |ρij| = 0.2441 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.1269 −0.5 AGL |ρij| = 0.145 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.0355 −0.5 AGL |ρij| = 0.1051 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
More importantly, he was able to show that the correlation in intrinsic time
πij is the same as the correlation in calendar time ρij [14]. This framework
provides a method to create synchronous price paths in intrinsic time which
will allow the recovery of the correlation in calendar time. However, there
is currently no framework that provides a method to create price paths in
intrinsic time while allowing for the sampling intervals (in intrinsic time) to
reduce down to each individual volumes. Thus we are unable to study the
equivalent of TAQ data in intrinsic time.
To study the Epps effect with this framework, we have to alter Derman’s
methodology slightly. Instead of assuming v j as the number of trades per cal-
endar second, we assume v j to be the number of trades per unit of sampling
interval considered. Although we altered his method slightly, the maths
showing that the correlations are dimensionless and independent of the var-
ious time measurements still holds.
Therefore to apply this sampling scheme, bucket sizes must be chosen for
each stock. This is determined by the rough equivalent bar length in calendar
time (i.e. to create the equivalent of 10 min calendar time bars in intrinsic
time, we divide the average volume per day by 48). Since the bucket sizes
are computed from the average volume per day, the price paths will not be
fully synchronous due to different volume amounts traded per day. Some
stocks will have more (less) volume buckets if the trades for the day are above
(below) the average for the stock (respectively).
5.2. Intrinsic Time 45
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.2209 −0.5 AGL |ρij| = 0.266 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
(b) MM 48 Volume Bucket (e) HY 48 Volume Bucket
ρ ρ
FSR FSR
1.0 1.0
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.0879 −0.5 AGL |ρij| = 0.0914 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.023 −0.5 AGL |ρij| = 0.0338 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
This highlights the first issue with the framework. The assumption that each
stocks’ intrinsic time scale is constant through time is a strong assumption
to make, where the validity is questionable. This is because the trading fre-
quency changes over time depending on factors such as time of day or rele-
vant news reports. For instance, if news comes out that a company is about
to undergo liquidation, traders will try to square their positions therefore in-
creasing the trading frequency. The second issue is that (5.2.1) is the key to
linking the correlation in intrinsic time to the correlation in calendar time, but
46 Chapter 5. Data Science
this assumption induces a continuity assumption from the calendar time into
the intrinsic time given the linear relationship which re-scales the time given
by standard continuous-time stochastic processes. It must therefore be noted
that it does not fully achieve the effect of converting stocks into intrinsic time
- where time ticks purely on the events. Elaborating further on why this does
not achieve the full conversion into intrinsic time is because a unit interval
in intrinsic time can be thought of as a stochastic interval in calendar time,
where the stopping rule is determined by the number of trades counted.
Using parts of algorithm A.1. from [30] in algorithm 6, we create the 1 hour,
10 minute and 1 minute calendar time equivalent data by using 8, 48 and 480
buckets per day respectively to create the intrinsic time samples.
From figure 5.3 3 (a) through to (c), we have the MM estimator applied to
the calendar time equivalent of 1 hour, 10 minute and 1 minute bar data
respectively using algorithm 2. From figure 5.3 (d) through to (f), we have
the HY estimator applied to the calendar time equivalent of 1 hour, 10 minute
and 1 minute bar data respectively using algorithm 3. It is clear that the Epps
effect still exists under this completely different method of aggregating TAQ
data.
This is interesting because this shows that the Epps effect does not only ex-
ist in the paradigm of calendar time, it is also present under the event time
paradigm. What is even more interesting is that the correlation structures
change depending on the sampling interval used, indicating that correlations
are not indeed dimensionless as suggested by Derman [14], and that the Epps
effect seems to be intrinsically linked to the sampling intervals chosen, there-
fore further attesting to the idea that the Epps effect cannot be fully explained
with asynchrony or lead-lags. In addition, the correlation structure in figure
5.3 is very different to that of figure 5.1 and 5.2, indicating that the correla-
tions are not preserved across these various measurements of time as Derman
proved. Finally, this method faces similar issues to that of the VWAP where
the jumps are hidden into the averages. Although we have highlighted a few
of the pitfalls regarding this framework, this is still the most seamless frame-
work provided in the literature which ties together the ideas from intrinsic
time to calendar time.
This however does not answer the main question as to which estimator is
the more efficient of the two; simply because the aggregation method creates
data which is very close to being synchronous, therefore the two estimators
behave extremely similarly as seen in figure 5.3. To this end, by employing
the ideas from the intrinsic time framework [14], we create our own method
of aggregating TAQ data, specifically focused on determining how the two
estimators differ.
3 Figure 5.3 can be reproduced using Derman.R.
5.2. Intrinsic Time 47
(a) MM 48 (c) HY 48
ρ ρ
FSR FSR
1.0 1.0
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0
SOL SOL 0.0
MNP MNP
AGL |ρij| = 0.0073 −0.5 AGL |ρij| = 0.4265 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.0046 −0.5 AGL |ρij| = 0.2996 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
Chapter 6
Concluding Remarks
and a Non-Uniform FFT (NUFFT) version for the more general asynchronous
case.
Additional extensions regarding the Monte Carlo experiments in section 3
include the multivariate Hawkes process [25] method of generating asyn-
chronous data and to study the effect of the correlation estimates by chang-
ing the various parameters pertaining to the Hawkes process calibration and
simulation. Another extension on the Monte Carlo side will be to recover the
results from [6] and firstly see if the MM estimator recovers the same esti-
mates as their Fourier method, and secondly use these results to decompose
the Epps effect into the component arising from asynchrony and the remain-
ing factors.
Finally, all the code listing used in this report can be found on Github [32] and
the steps outlining the recovery of the results can be found in the [Link]
document to ensure straightforward replication of the results.
51
Appendix A
Supporting Algorithms
12
1 Algorithm 8 can be found in ftcorr.R as an auxiliary function and was provided by [18].
2 Algorithm 9 can be found in ftcorr.R as an auxiliary function.
52 Appendix A. Supporting Algorithms
return (S)
Subject to the condition S(0) = start price and A is the Cholesky decomposi-
tion of Σ. Algorithm 10 is provided by [22] 3 .
Subject to the condition X (0) = ln(start price) and A is the Cholesky decom-
position of Σ. Algorithm 11 is provided by [22] 4 .
3 Algorithm 10 can be found in GBM.R.
4 Algorithm 11 can be found in Merton Model.R.
Appendix A. Supporting Algorithms 53
Subject to the condition X (0) = ln(start price), σ(0) = starting variance and
A∗ is the Cholesky decomposition of Σ∗ 5 .
Subject to the condition X (0) = start price and A is the Cholesky decompo-
sition of Σ. Algorithm 13 is provided by [22] 6 .
5 Algorithm 12 can be found in GarchAndersen.R, while the specification from [12] can be
found in GarchReno.R.
6 Algorithm 13 can be found in Variance Gamma.R.
54 Appendix A. Supporting Algorithms
Subject to the condition X (0) = ln(start price) and A is the Cholesky decom-
position of Σ 7 .
Appendix B
Appendix Derivation
This is acceptable because Malliavin and Mancino show that the contribution
for the drift term is zero [1]. Additionally Malherbe argues that ignoring the
drift term implies an efficient market [15].
We now introduce the Gaussian variables
E( Gk Gl ) = E( ak (dp) al (dp))
h 1 Z 2π Z 2π i (B.1.3)
=E 2 cos(kt)σ(t)dW cos(lt)σ (t)dW .
π 0 0
Z 2π
1
E( Gk Gl ) = 2 Σ(t) cos(kt) cos(lt)dt. (B.1.4)
π 0
1
cos(kt) cos(lt) = (cos(k − l )t + cos(k + l )t),
2
(B.1.4) becomes
1
Z 2π
E( Gk Gl ) = Σ(t) cos(kt) cos(lt)dt
π2 0
Z 2π
1
= Σ(t)[(cos(k − l )t + cos(k + l )t)]dt
2π 2 0
Z 2π Z 2π
1 1
= Σ ( t )( cos ( k − l ) tdt + Σ(t)(cos(k + l )tdt
2π 2 0 2π 2 0
1
= (a (Σ) + ak+l (Σ)).
2π |k−l |
(B.1.5)
The energy identity 1 is
Furthermore,
q
Now for q > 0 consider the random variable UN as the discrete convolution
of the Gaussian variables, where
N
1
∑ Gk Gk+q .
q
UN := (B.1.8)
N k =1
N
1
∑ E(Gk Gk+q )
q
E (U N ) =
N k =1
N
1 1
=
N ∑ 2π (a|k−k−q| (Σ) + ak+k+q (Σ))
k =1
N
1 1
=
N ∑ 2π (aq (Σ) + a2k+q (Σ)) (B.1.9)
k =1
N
1 1
aq (Σ) + ∑ a2k+q (Σ)
=
2π N k =1
N
1
∑ a2k+q (Σ)
q
2πE(UN ) = aq (Σ) +
N k =1
= aq (Σ) + R N .
1 N 1 N 2 1 N 2 1
Rn = | ∑ a2k+q (Σ)| ≤ ( ∑ 1 ) 2 ( ∑ a2k+q (Σ)) 2
N k =1 N k =1 k =1
N
1 1
= √ ( ∑ a22k+q (Σ)) 2 (B.1.10)
N k =1
1
≤ √ ||Σ|| L2 .
N
Therefore, R N → 0 as N → ∞ 2 .
q q
We now want to show that lim N →∞ UN = E(UN ) in L2 . We first compute
1
∑0
q
E[(UN )2 ] = E( Gk2 Gk20 +q ). (B.1.11)
N2 0≤k,k ≤ N
λi := E( Gi2 ), µ := E( G1 G2 ),
and define
µ
Z := G2 − G1 .
λ1
2
∑kN=1 a22k+q (Σ)) ≤ ∑k a2k (Σ)
58 Appendix B. Appendix Derivation
µ µ2
E( G12 G22 ) = E[ G12 ( Z2 + 2 G1 Z + 2 G12 )]
λ1 λ1
µ µ2
= E( G12 Z2 ) + 2 E( G13 Z ) + 2 E( G14 )
λ1 λ1
µ2
= E( G12 Z2 ) + E( G14 )
λ21
µ2
= E( G12 ) E( Z2 ) + E( G14 )
λ21
µ µ2 µ2
= E( G12 ) E( G22 − 2 G1 G2 + 2 E( G12 )) + 2 E( G14 )
λ1 λ1 λ1
µ µ2 µ2
= E( G12 ) E( G22 ) − 2 E( G12 ) E( G1 G2 ) + 2 E( G12 ) E( G12 ) + 2 E( G14 ).
λ1 λ1 λ1
(B.1.12)
Furthermore, since Gk is a Gaussian variable with mean 0. We know the
fourth uncentered moment is E( Gk4 ) = 3E( Gk2 )2 . Therefore, (B.1.12) becomes
µ µ2 µ2
E( G12 G22 ) = E( G12 ) E( G22 ) − 2 E( G12 ) E( G1 G2 ) + 2 E( G12 ) E( G12 ) + 2 E( G14 )
λ1 λ1 λ1
µ µ2
= E( G12 ) E( G22 ) − 2 E( G12 ) E( G1 G2 ) + 4 2 E( G12 ) E( G12 )
λ1 λ1
µ µ2
= E( G12 ) E( G22 ) − 2 λ1 µ + 4 2 λ1 λ1
λ1 λ1
= E( G12 ) E( G22 ) + 2µ2
= E( G12 ) E( G22 ) + 2E( G1 G2 )2 .
(B.1.13)
Putting this together, we get
3 E( G3 Z ) = 0 due to independence and that the third uncentered moment E( G13 ) = 0
1
B.1. Proof for Theorem 2.1.1 and 2.1.2 59
q q
E[(UN − E(UN ))2 ]
q q q q
= E[(UN )2 − 2UN E(UN ) + ( E(UN ))2 ]
q q
= E((UN )2 ) − [ E(UN )]2
1 1
= 2 ∑ E( Gk2 Gk20 +q ) − a q ( Σ )2
N 0≤k,k0 ≤ N (2π )2
1 1
=
N2 ∑0 [ E(2k ) E( Gk20 +q ) + 2( E( Gk Gk0 +q ))2 ] −
(2π )2
a q ( Σ )2
0≤k,k ≤ N
1 1 1
=
N2 ∑0 [ E(2k ) E( Gk20 +q ) +
2π 2
( a|k−k0 +q| (Σ) + ak+k0 +q (Σ))2 ] −
(2π )2
a q ( Σ )2
0≤k,k ≤ N
1 1 1
∑0
q
= ( E(UN ))2 + [ ( a|k−k0 +q| (Σ) + ak+k0 +q (Σ))2 ] − a q ( Σ )2
N2 0≤k,k ≤ N
2π 2 (2π )2
1 2 1 1 1
=
2π
aq (Σ) + 2
N ∑0 [
2π 2
( a|k−k0 +q| (Σ) + ak+k0 +q (Σ))2 ] −
(2π )2
a q ( Σ )2
0≤k,k ≤ N
1
=
2π 2 N 2 ∑0 ( a|k−k0 +q| (Σ) + ak+k0 +q (Σ))2
0≤k,k ≤ N
1
≤ ||Σ||2L2
N
(B.1.14)
As N → ∞, N || Σ || L2
1 2 → 0. Thus it follows that
q q
lim UN = E(UN ) in L2 .
N →∞
q
Coupled with the fact that 2πE(UN ) → aq (Σ) as N → ∞, we get
q q
2πUN → 2πE(UN ) → aq (Σ),
N
2π
∑ (as (dp)as+q (dp)),
q
aq (Σ) = lim 2πUN = lim ∀q > 0.
N →∞ N →∞ N
s =1
aq (Σ) has been proved. The remaining univariate and multivariate cases will
be less rigorous and more focused on achieving the correct scaling factors.
h 1 Z 2π Z 2π i
E(bs2 (dp)) =E 2 sin(st)σ(t)dW sin(st)σ(t)dW
π 0 0
Z 2π (B.1.15)
1
= 2 sin2 (st)Σ(t)dt.
π 0
1 2π
Z
E(bs2 (dp)) = 2 sin2 (st)Σ(t)dt
π 0
Z 2π Z 2π (B.1.16)
1 1
= Σ ( t ) dt − cos(2st)Σ(t)dt.
2π 2 0 2π 2 0
1 2π
Z
1 2π Z
E(bs2 (dp)) = Σ(t)dt − cos(2st)Σ(t)dt
2π 2 0 2π 2 0
Z 2π Z 2π Z 2π
1 1 1
= Σ(t)dt − cos (st)Σ(t)dt +
2
Σ(t)dt.
2π 2 0 π2 0 2π 2 0
(B.1.17)
2π
Using the fact that E( a2s (dp)) = π12 0 cos2 (st)Σ(t)dt, we get that
R
2
a0 (Σ) = E( a2s (dp)) + E(bs2 (dp)). (B.1.18)
π
1
Thus we get a scaling factor of 2 which is not present in [1].
h 1 Z 2π Z 2π i
E( as (dp)bs+q (dp)) = E cos ( st ) σ ( t ) dW sin ( s + q ) tσ ( t ) dW
π2 0 0
Z 2π
1
= 2 cos(st) sin(s + q)tΣ(t)dt.
π 0
(B.1.19)
1
Using the identity sin(lt) cos(st) = 2 [sin( l + s)t + sin(l − s)t, (B.1.19) be-
comes
B.1. Proof for Theorem 2.1.1 and 2.1.2 61
1 2π Z
1
Z 2π
E( as (dp)bs+q (dp)) = 2
sin(qt)Σ(t)dt + sin(2s + q)tΣ(t)dt
2π 0 2π 2 0
1
= (bq (Σ) + b2s+q (Σ)).
2π
(B.1.20)
The remaining steps remains the same as the derivation for aq (Σ).
1
hdp j , dpk it = hdp j + dpk it − hdp j it − hdpk it .
2
We first confirm that the polarization recovers the results we desire. We have
Z 2π
1
ak (dp j + dpk ) = cos(kt)(σ j (t) + σk (t))dW,
π 0
and
Z 2π
j k j 1 k
σ jj (t) + σkk (t) + 2σ jk (t) cos(kt) cos(lt)dt.
E[ ak (dp + dp ) al (dp + dp )] = 2
π 0
Therefore,
1h i
E[ ak (dp j + dpk ) al (dp j + dpk )] − E[ ak (dp j ) al (dp j )] − E[ ak (dpk ) al (dpk )]
2
Z 2π
1
= 2 σ jk (t) cos(kt) cos(lt)dt.
π 0
(B.1.21)
We note the linearity of Fourier transforms and thus ak (dp j + dpk ) = ak (dp j ) +
ak (dpk ), which means
1h j k j k j j k k
i
E[ ak (dp + dp ) al (dp + dp )] − E[ ak (dp ) al (dp )] − E[ ak (dp ) al (dp )]
2
1h j k k j
i
= E[ ak (dp ) al (dp )] + E[ ak (dp ) al (dp )]
2
Z 2π
1
= 2 σ jk (t) cos(kt) cos(lt)dt
π 0
1
= ( a|k−l | (Σ jk ) + ak+l (Σ jk )).
2π
(B.1.23)
The 2π in the last equation of (B.1.23) is the 2π in the numerator of aq (Σi,j )
which was left out in [1].
1h 2 j k 2 j k 2 j 2 j 2 k 2 k
i
E[ as (dp + dp ) + bs (dp + dp )] − E[ as (dp ) + bs (dp )] − E[ as (dp ) + bs (dp )] .
2
(B.1.24)
Using the linearity of Fourier transforms, the first expectation in (B.1.24) be-
comes
1
2E[ as (dp j ) as (dpk ) + bs (dp j )bs (dpk )]. (B.1.26)
2
Therefore the scaling factors for a0 (Σ) and a0 (Σi,j ) are the same.
Z 2π
1
ak (dp j + dpk ) = cos(kt)(σ j (t) + σk (t))dW,
π 0
B.2. Proof for Theorem 2.2.1 63
Z 2π
j k 1
bl (dp + dp ) = sin(lt)(σ j (t) + σk (t))dW,
π 0
and
Z 2π
j k j 1k
σ jj (t) + σkk (t) + 2σ jk (t) cos(kt) sin(lt)dt.
E[ ak (dp + dp )bl (dp + dp )] = 2
π 0
Therefore
1h j k j k j j k k
i
E[ ak (dp + dp )bl (dp + dp )] − E[ ak (dp )bl (dp )] − E[ ak (dp )bl (dp )]
2
Z 2π
1
= 2 σ jk (t) cos(kt) sin(lt)dt.
π 0
(B.1.27)
Using the linearity of Fourier transforms, we can simplify (B.1.27) to
1h i 1 2π
Z
E[ ak (dp j )bl (dpk )] + E[ ak (dpk )bl (dp j )] = 2 σ jk (t) cos(kt) sin(lt)dt
2 π 0
1
= (b (Σ jk ) + bk+l (Σ jk )).
2π |k−l |
(B.1.28)
We note that the scaling factors we recovered are the same scaling factors
recovered by [16].
Furthermore, we can assume that the drift term has no contribution which is
proven in [2]. Therefore the price process is given by
Further define
64 Appendix B. Appendix Derivation
Z 2π
1
ck (dp) = e−ikt dp(t).
2π 0
1 h Z 2π Z 2π i
−ilt −ikt
E(cl ck ) = E e dp ( t ) e dp ( t )
(2π )2 0 0
1 h Z 2π Z 2π i
−ilt −ikt
= E e σ ( t ) e σ ( t )
(2π )2 0 0
(B.2.3)
Z 2π
1 h
−i ( l + k ) t
i
= E e Σ(t)dt
(2π )2 0
1
= c ( Σ ).
2π l +k
q
For q ∈ Z, define the Random Variable UN as the discrete convolution of the
Fourier coefficients for the price process.
N
1
∑ ck ck−q .
q
UN := (B.2.4)
2N + 1 s=− N
N
1
∑
q
E UN = E ck ck−q
2N + 1 s=− N
(B.2.5)
1 1
= ∑
2N + 1 |k|≤ N 2π
c q ( Σ ),
and thus
q
2πE UN = cq (Σ). (B.2.6)
Gk := ck (dp),
kΣk2L2 = ∑ ck (Σ) .
2
k
h
q 2
i 1 h i 1
∑0
q
E UN − E (U N ) = E(c2k ) E(c2q−k0 ) + 2E(ck cq−k0 )2 − c q ( Σ )2
(2N + 1)2 k,k
(2π ) 2
q 2 1 1 1
= E UN +
(2N + 1)2 ∑0 2π ck+q+k0 (Σ) − (2π )2 cq (Σ)2
k,k
1
≤ kΣk2L2 .
2N + 1
(B.2.7)
By combining (B.2.6) and (B.2.7), we complete the theorem as
N
1 1
c (Σ) = lim
2π k ∑ cs (dp)ck−s (dp),
N →∞ 2N + 1 s=− N
(B.2.8)
these identities hold due to the fact that I i and J j are the partitions over (0, T ].
Finally, for each measurable set I on [0, ∞), define
Z T
k
∆P ( I ) := 1 I (t)σk dW k , k = 1, 2.
0
66 Appendix B. Appendix Derivation
" # " #
o n
E [Un ] = E ∑ E ∆Pl I i ∆P2 J j |Π Kij = E ∑ v I i ∩ J j Kij = θ.
i,j i,j
Remark B.3.1 We note that the inner expectation is for notation indicating that we
know Π and that the outer expectation can be brought in due to linearity. This is
to allow later parts of the derivation become more simple. The reason why we say
the inner expectation is for notation is because we can recover θ with just the outer
expectation:
" #
E[Un ] = E ∑ ∆Pl I i ∆P2 J j Kij
i,j
T Z T
Z
= ∑E 1 I i (t)σ dW 1 1 2 2
1 J j (t)σ dW Kij
i,j 0 0
T
Z
= ∑E 12
1 I i ∩ J j (t)σ dt Kij (B.3.1)
i,j 0
Z
= ∑E 1 2
σ σ ρdt Kij
i,j Ii ∩ J j
" #
=E ∑v I i ∩ J j Kij = θ.
i,j
The third equation follows from the second in (B.3.1) using Itô’s Isometry. For the
remainder of the proof we adopt inner expectation used by [3] to make things simpler.
We now want to show that E Un2 = θ 2 + o (1). This would mean that
" #
h i n 0 0 o
E Un2 =E ∑ i j i j
E ∆P I ∆P J ∆P I ∆P J |Π Kij Ki0 j0 ,
2 ll 2
i,j,i0 ,j0
∑ = ∑ + ∑ + ∑ + ∑ =: D1 + D2 + D3 + D4 .
i,j,i0 ,j0 0 0 0 0 0 0 0 0
i, j, i , j : i, j, i , j : i, j, i , j : i, j, i , j :
i0 = i, j0 = j i0 = i, j0 6= j i0 6= i, j0 = j i0 6= i, j0 6= j
We will use this decomposition to calculate the expectation using four cases.
B.3. Proof for Theorem 2.3.1 67
2 2 2 2
i j
E ∆P I l
∆P J
2
|Π = E ∆P ( L2 ) + ∆P ( L1 )
1 1
∆P ( L3 ) + ∆P ( L1 ) |Π
2 2
n o n o
2 2 2 2
= E ∆P ( L2 ) ∆P ( L1 ) |Π + E ∆P ( L1 ) ∆P ( L1 ) |Π
1 2 1 2
n o n o
+E ∆P1 ( L1 )2 ∆P2 ( L3 )2 |Π + E ∆P1 ( L2 )2 ∆P2 ( L3 )2 |Π
= v1 ( L2 ) v2 ( L1 ) + 2v ( L1 )2 + v1 ( L1 ) v2 ( L1 )
+ v1 ( L1 ) v2 ( L3 ) + v1 ( L2 ) v2 ( L3 )
= [v1 ( L2 ) + v1 ( L1 )]v2 ( L1 ) + [v1 ( L1 ) + v1 ( L2 )]v2 ( L3 ) + 2v( L1 )2
= [v1 ( L1 ) + v1 ( L2 )][v2 ( L1 ) + v2 ( L3 )] + 2v( L1 )2
= v1 ( I i )v2 ( J j ) + 2v( I i ∩ J j )2 .
2
D1 = ∑ v I v J Kij + 2 ∑ v I ∩ J
i12 j i j
Kij . (B.3.2)
i,j i,j
Now looking at the first term on the right hand side of (B.3.2) and noting that
the σk are bounded, we get
Z 2 Z 2
∑ I i v2 J j Kij =
v 1
∑ Ii
σ 1
dt
Jj
σ 2
dt Kij
i,j i,j
2 2
≤ sup σ 1
sup σ 2
∑ | I i || J j |Kij .
0≤ t ≤ T 0≤ t ≤ T i,j
E ∑ | I i || J j |Kij = o (1).
i,j
To do so, we decompose
hence,
By symmetry, we have
E ∑ | I i || J j |Kij ≤ 3E ∑ | I i |2 + 3E ∑ | J j |2 . (B.3.3)
i,j i j
We see that (B.3.3) is o (1) under Condition (A-IV) (ii), (C(ii) in remark 3.1 of
[3]). Similarly, we can ascertain that for any random partition ( Ĩ i ) of (0, T ]
satisfying (A-IV) (ii),
2
E ∑ v Ĩ i = o (1). (B.3.4)
i
Thus the second term on the right hand side of (B.3.2) can be shown to be
of o P (1) by choosing ( I i ∩ J j ) as the partition. Hence it follows that E[ D1 ] =
o (1).
Case 2: i = i0 , j 6= j0 . This yields
2 0
D2 = ∑ E ∆P I il
∆P J ∆P J j |Π Kij Kij0 .
2 j 2
i,j0 :j6= j0
0
Let L1 := I i ∩ J j , L2 := I i ∩ J j , and L3 := I i \ ( L1 ∪ L2 ). Then using the
independence of increments,
B.3. Proof for Theorem 2.3.1 69
2 0
i
E ∆P I l
∆P J ∆P J j |Π
2 j 2
2
i
= E ∆P I ∆P ( L1 ) ∆P ( L2 ) |Π
l 2 2
2
=E ∆P ( L1 ) + ∆P ( L3 ) + ∆P ( L2 ) ∆P ( L1 ) ∆P ( L2 ) |Π
1 1 1 2 2
n o n o
= 2E ∆P1 ( L1 ) ∆P2 ( L1 ) |Π E ∆Pl ( L2 ) ∆P2 ( L2 ) |Π
i j i j0
= 2v ( L1 ) v ( L2 ) = 2v I ∩ J v I ∩ J .
The third equation follows because when we expand the second equation,
all the non-overlapping increments reduces to 0 using the independence of
increments and that for any (deterministic) interval I, ∆P1 ( I ) and ∆P2 ( I ) are
jointly normal with respective mean and variance 0 and vk ( I ), k = 1, 2, and
with covariance v( I ).
Hence,
j0
D2 = 2 ∑ i i j
v I ∩ J v I ∩ J Kij Kij0
i,j,j0 :j0 6= j
( !)
j0
= 2∑ ∑v I i ∩ J j Kij ∑0 v Ii ∩ J Kij0 − v I i ∩ J j
i j j
2 2
= 2 ∑ v I i − 2 ∑ ∑ v I i ∩ J j Kij ,
i i j
see that E[ D2 ] = o (1) by using (B.3.4) and the fact that ( I i ∩ J j ) partitions
]0, T ].
Case 3: i 6= i0 , j = j0 . The same argument in case 2 applies here by symmetry,
thus we can obtain E[ D3 ] = o (1).
0 0
Case 4: i 6= i0 , j 6= j0 . Let L1 := I i ∩ J j , L2 := I i ∩ J j . Note that for i, i0 , j, j0
such that i 6= i0 , j 6= j0 and Kij Ki0 j0 = 1 means that Ki0 j Kij0 = 0. Furthermore,
due to the identity
1 − Ki 0 j 1 − Kij0 + Ki0 j + Kij0 ≡ 1,
n 0 0
o
we can decompose the event {Kij Ki0 j0 = 1} further into three subcases, ∩ = ∅, Ii Jj Ii ∩ Jj =∅ ,
n 0 0
o n 0 0
o
I i ∩ J j 6= ∅, I i ∩ J j = ∅ and I i ∩ J j = ∅, I i ∩ J j 6= ∅ each of which re-
n o n o n o
spectively corresponds to 1 − Ki0 j 1 − Kij0 = 1 , Ki0 j = 1 and Kij0 = 1 .
n 0 0
o
Case 4(a): I i ∩ J j = ∅, I i ∩ J j = ∅ . We have by analogy with case 2
70 Appendix B. Appendix Derivation
n 0 0 o
∑ E ∆P1 I i ∆P2 J j ∆P1 I i ∆P2 J j |Π Kij Ki0 j0 1 − Ki0 j 1 − Kij0
i,j,i0 ,j0 :i 6=i0 ,j6= j0
n o
= ∑ E ∆P ( L1 ) ∆P ( L1 ) ∆P ( L2 ) ∆P ( L2 ) |Π Kij Ki0 j0 1 − Ki0 j
1 2 1 2
1 − Kij0
i,j,i0 ,j0 :i 6=i0 ,j6= j0
= ∑ v( L1 )v( L2 )Kij Ki0 j0 1 − Ki0 j 1 − Kij0
i,j,i0 ,j0 :i 6=i0 ,j6= j0
n 0 0
o 0
Case 4(b): I i ∩ J j 6= ∅, I i ∩ J j = ∅ . Let L3 := I i ∩ J j , L4 := J j \ ( L1 ∪ L3 )
0
and L5 := I i \ ( L2 ∪ L3 ),
Therefore,
n 0 0 o
∑ E ∆P1 I i ∆P2 J j ∆P1 I i ∆P2 J j |Π Kij Ki0 j0 Ki0 j
i,j,i0 ,j0 :i 6=i0 ,j6= j0
n 0 0
o
Case 4(c): ∩ = ∅, Ii Jj Ii ∩ Jj 6= ∅ . By symmetry, we can obtain using the
same technique as 4(b):
h ih i
D4 = ∑ v ( L1 ) v ( L2 ) Kij Ki0 j0 1 − Ki 0 j 1 − Kij0 + Kij0 + Kij0
i,j,i0 ,j0 :i 6=i0 ,j6= j0
0 0
= ∑0 v I i ∩ J j v( I i ∩ J j )Kij Ki0 j0
i,j,i0 ,j :i 6=i ,j6= j0
0
i0 j0
= ∑v I ∩ J i j
Kij ∑ v ( I ∩ J ) Ki 0 j 0 .
i,j i0 ,j0 :i0 6=i,j0 6= j
0 0
∑ v ( I i ∩ J j ) Ki 0 j 0
i0 ,j0 :i 6=i,j0 6= j
0
0 0
0
0
= ∑ v I i ∩ J j Ki 0 j 0 − v I i ∩ J j − ∑ v I i ∩ J j Kij0 − ∑ v I i ∩ J j Ki 0 j
i0 ,j0 j0 :j0 6= j ii :i0 6=i
0 0
= ∑ v I i ∩ J j Ki 0 j 0 − v I i ∩ J j − v ( I i ) − v ( J j ),
i0 ,j0
have
0 2
j0
D4 = ∑ v I i
∩ J j
K ij ∑ v I i
∩ J K 0
ij 0 − ∑ v I i
∩ J j
Kij
i,j i0 ,j0 i,j
− ∑ v I i ∩ J j Kij v( I i ) − ∑ v I i ∩ J j Kij v( J j )
i,j i,j
2
= v(]0, T ])2 − ∑ v I i ∩ J j Kij − ∑ v( I i )2 − ∑ v( J j )2 .
i,j i j
B0 := ∑ ∆M I ∆M J j Kij ,
i 2 1
B1 := ∑ ∆A I ∆M J j Kij ;
i 2 1
i,j i,j
B2 := ∑ ∆M1 I i ∆A2 J j Kij , B3 := ∑ ∆A 1
I i
∆A 2
J j Kij .
i,j i,j
Note that
Z Z
! Z Z
| B1 | = ∑ Ii
µ1 dt ∑ Jj
σ2 dW 2 Kij ≤∑
Ii
µ1 dt ∑ Jj
σ2 dW 2 Kij
i j i j
t
Z
1 2 2 i j
≤ T sup µ · max sup σ dW |t − s| ≤ I + 2 max J , s, t ∈ [0, T ]
0≤ t ≤ T i s j
Z t
1 2 2 i j
≤ T sup µ · sup σ dW |t − s| ≤ max I + 2 max J , s, t ∈ [0, T ] ,
0≤ t ≤ T s i j
(B.3.5)
72 Appendix B. Appendix Derivation
Appendix C
Miscellaneous
HY HY
MM Complex MM Complex
MM Trig MM Trig
From figure C.1 2 , we see that for both the synchronous case and the asyn-
chronous case, the HY algorithm is order of magnitudes longer than the MM
algorithms. This is due to the Kanatani Weight matrix using a double for-
loop to check for overlapping intervals. Furthermore, we notice that algo-
rithm 2 is faster than algorithm 1, this is because algorithm 2 has been sup-
plemented with Rcpp and RcppArmadillo code to improve the computation
time.
We started experimenting with C++ code because memory issues started oc-
curring with base R when computing the empirical data. This was because all
the Fourier coefficients are computed with one matrix multiplication for com-
putation efficiency; however, due to the large nature of empirical data, along
with the fact that we computed Fourier coefficients based on the Nyquist
frequency for the highest available sampling frequency present in the data -
computing one pair of stock for one day of data required an matrix of dimen-
sions [15,000 x 1,500,000] to be initialised.
Upon further investigation, we found that R uses 8 bytes of memory to store a
double precision float, therefore a matrix with dimensions [15,000 x 1,500,000]
uses 167.6Gb of memory to store the object - meaning that packages such as
bigmemory which allows the data structure to be allocated to shared mem-
ory was not going to be particularly helpful due to physical constraints of
our hardware. Thus the only solution left was to remove the vectorisation
and compute each Fourier coefficients using a single for-loop.
It must be noted, even though the vectorisation was removed from algorithm
2, it took 4 days to compute the correlation matrix for 1 week of data of the
10 assets considered, while algorithm 3 took 7 days. Furthermore, it must be
noted that algorithm 3 will have memory issues that are not easily solvable as
the Kanatani weight matrix becomes larger when considering longer periods
such as the correlation for a month of data.
These problems are non-trivial computer science problems which severely
impact the real-time implementation of these two estimators. Fixing these
problems either requires very efficient parallelisation [5] or more efficient al-
gorithms are needed. More effective algorithms for 2 include a Fast Fourier
Transform (FFT) for the synchronous case and a Non-Uniform FFT (NUFFT)
for the more practical asynchronous case.
Remark C.1.1 One important point to notice is that we did not use algorithm 1
to compute any correlation results. This is because the algorithm is producing the
wrong correlation estimates for the asynchronous cases. The exact reason for this
error has not yet been figured out. We know that it is algorithm 1 which is wrong
rather than algorithm 2 because for the asynchronous case, the integrated variance
should be the same as the HY estimate (since the variance is synchronous) - however
it is not.
2 Figure C.1 can be reproduced using Compute Time.R
C.2. Supporting plots 75
101.5 102
Price (P)
Price (P)
101.0 0.0025
101
100.5 0.002
Sample (Merton)
Sample (GBM)
100.0 100
0 100 200 300 400 500 0 100 200 300 400 500
Time Time 0.0000
0.000
0.004
0.0025
Return(log∆P)
Return(log∆P)
0.002
0.0000 −0.0025
0.000 −0.002
−0.002 −0.0025
0 100 200 300 400 500 −2 0 2 0 100 200 300 400 500 −2 0 2
Time Theoretical N(0,1) Time Theoretical N(0,1)
100 100
Price (P)
Price (P)
98 98
0.005 0.005
96 96
Sample (Garch(1,1))
Sample (Garch(1,1))
0 100 200 300 400 500 0 100 200 300 400 500
Time 0.000 Time 0.000
0.005 0.005
Return(log∆P)
Return(log∆P)
−0.005 −0.005
0.000 0.000
−0.005 −0.005
0 100 200 300 400 500 −2 0 2 0 100 200 300 400 500 −2 0 2
Time Theoretical N(0,1) Time Theoretical N(0,1)
Price (P)
100.0 100.005
100.000
Sample (Ornstein Uhlenbeck)
2e−05
Sample (Variance Gamma)
99.5 0.002
99.995
99.0 99.990
0 100 200 300 400 500 0 100 200 300 400 500
Time Time
0.000 0e+00
0.004 4e−05
Return(log∆P)
Return(log∆P)
0.002 2e−05
−0.002 −2e−05
0 100 200 300 400 500 −2 0 2 0 100 200 300 400 500 −2 0 2
Time Theoretical N(0,1) Time Theoretical N(0,1)
F IGURE C.2: Price paths, returns and QQ-plot for the various
SDEs.
Figure C.2 highlights the resulting price paths generated using the Algo-
rithms from appendix A, and further shows the returns and QQ-plots as-
sociated with the various SDEs considered in this paper.
76 Appendix C. Miscellaneous
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.1411 −0.5 AGL |ρij| = 0.1413 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
(b) MM 10 Min Close Price (f) HY 10 Min Close Price
ρ ρ
FSR FSR
1.0 1.0
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.0734 −0.5 AGL |ρij| = 0.08 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.0379 −0.5 AGL |ρij| = 0.0469 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.0355 −0.5 AGL |ρij| = 0.1051 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.1418 −0.5 AGL |ρij| = 0.1449 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
(b) MM 10 Min VWAP (f) HY 10 Min VWAP
ρ ρ
FSR FSR
1.0 1.0
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.097 −0.5 AGL |ρij| = 0.0961 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.0627 −0.5 AGL |ρij| = 0.0784 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
SHP SHP
ABG ABG
0.5 0.5
NED NED
SBK SBK
0.0 0.0
SOL SOL
MNP MNP
AGL |ρij| = 0.0355 −0.5 AGL |ρij| = 0.1051 −0.5
NPN NPN
BTI BTI
−1.0 −1.0
MNP
ABG
MNP
ABG
NPN
SBK
NED
NPN
SBK
NED
AGL
SOL
SHP
AGL
SOL
SHP
FSR
FSR
BTI
BTI
Figures C.3 and C.4 show the initial mistake we made with figures 5.1 and
5.2 respectively. The mistake was computing the returns before computing
the OHCLV prices using algorithm 5, therefore we initially inputted the re-
turns computed on the TAQ data into algorithm 5. Therefore the bar data in
figure C.3 is rather the TAQ return samples sampled every 1 hour, 10 minute
and 1 minute respectively while the bar data in figure C.4 is the VWAP algo-
rithm applied to the TAQ return samples for 1 hour, 10 minute and 1 minute
intervals respectively.
What is interesting about this mistake is that it still shows the existence of
the Epps effect even though all the returns are computed based on the high-
est available sampling frequency rather than ranging sampling intervals. The
only commonality with the samples in figures C.3, C.4 and 5.1, 5.2 is that the
number of samples decrease as the sampling intervals decrease. This begs the
question regarding the relationship between the Epps effect and the number
of samples considered. Additionally, are there any factors other than asyn-
chrony, lead-lag and smaller sampling intervals which contribute towards
the Epps effect? Unfortunately, we have not been able to answer these ques-
tions.
79
Bibliography
Stochastic-Modelling-Probability/dp/0387004513/ref=pd_sim_b_
68?ie=UTF8&refRID=1AN8JXSDGMEV2RPHFC2A.
[23] T. G. Andersen and T. Bollerslev, “Answering the skeptics: Yes, stan-
dard volatility models do provide accurate forecasts”, International Eco-
nomic Review, vol. 39, no. 4, pp. 885–905, 1998, ISSN: 00206598, 14682354.
[Online]. Available: [Link]
[24] T. G. Andersen and T. Teräsvirta, “Realized volatility”, in Handbook
of Financial Time Series, T. Mikosch, J.-P. Kreiß, R. A. Davis, and T. G.
Andersen, Eds. Berlin, Heidelberg: Springer Berlin Heidelberg, 2009,
pp. 555–575, ISBN: 978-3-540-71297-8. DOI: 10.1007/978-3-540-71297-
8_24. [Online]. Available: [Link] 3- 540-
71297-8_24.
[25] A. G. Hawkes, “Spectra of some self-exciting and mutually exciting
point processes”, Biometrika, vol. 58, no. 1, pp. 83–90, 1971, ISSN: 00063444.
[Online]. Available: [Link]
[26] R. Arbi, “A reproducible approach to equity backtesting”, Master’s the-
sis, University of Cape Town, 2019.
[27] Volume 00e-trading and information overview, Johannesburg Stock Ex-
change, Sandown, Johannesburg, South Africa, 2019.
[28] D. Easley, R. F. Engle, M. O’Hara, and L. Wu, “Time-Varying Arrival
Rates of Informed and Uninformed Trades”, Journal of Financial Econo-
metrics, vol. 6, no. 2, pp. 171–207, Feb. 2008, ISSN: 1479-8409. DOI: 10.
1093 / jjfinec / nbn003. eprint: http : / / oup . prod . sis . lan / jfec /
article - pdf / 6 / 2 / 171 / 2594496 / nbn003 . pdf. [Online]. Available:
[Link]
[29] D. Easley, M. M. López de Prado, and M. O’Hara, “The volume clock:
Insights into the high-frequency paradigm”, The Journal of Portfolio Man-
agement, vol. 39, no. 1, pp. 19–29, 2012, ISSN: 0095-4918. DOI: 10.3905/
jpm.2012.39.1.019. eprint: [Link]
39/1/[Link]. [Online]. Available: [Link]
com/content/39/1/19.
[30] D. Easley, M. Lopez de Prado, and M. O’Hara, “Flow toxicity and liq-
uidity in a high frequency world”, Review of Financial Studies, vol. 25,
Feb. 2012. DOI: 10.2139/ssrn.1695596.
[31] T. Gebbie, D. Wilcox, C. Malherbe, and D. Hendricks, Fftcorrgpu.m,
2005.
[32] P. Chang, R. Bukuru, and T. Gebbie, 2019. [Online]. Available: https:
//[Link]/rogerbukuru/Honours-Project.
[33] B. Oksendal, Stochastic Differential Equations (3rd Ed.): An Introduction
with Applications. Berlin, Heidelberg: Springer-Verlag, 1992, ISBN: 3-387-
53335-4.