{'fraction_non_alphanumeric': 0.052632550583370255, 'fraction_numerical': 0.019439521488701816, 'mean_word_length': 4.244868319132456, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Model-Free Approaches to Discern Non-Stationary Microstructure Noise and Time-Varying Liquidity in High-Frequency Data

In this paper, we provide non-parametric statistical tools to test stationarity of microstructure noise in general hidden Ito semimartingales, and discuss how to measure liquidity risk using high frequency financial data. In particular, we investigate the impact of non-stationary microstructure noise on some volatility estimators, and design three complementary tests by exploiting edge effects, information aggregation of local estimates and high-frequency asymptotic approximation. The asymptotic distributions of these tests are available under both stationary and non-stationary assumptions, thereby enable us to conservatively control type-I errors and meanwhile ensure the proposed tests enjoy the asymptotically optimal statistical power. Besides it also enables us to empirically measure aggregate liquidity risks by these test statistics. As byproducts, functional dependence and endogenous microstructure noise are briefly discussed. Simulation with a realistic configuration corroborates our theoretical results, and our empirical study indicates the prevalence of non-stationary microstructure noise in New York Stock Exchange.


Introduction
The introduction of high-tech trading mechanisms into markets, for example, electronic communication networks (ECNs) and other electronic trading platforms, provides an opportunity for speculators and market makers to take advantage of speed in trading and market making, and this technological innovation also brings new regulatory challenges. The subsequent high-frequency trading results in a huge amount of high-frequency transaction and quotation data, which in particular opens two potential gates for research in theoretical and empirical asset pricing: one is estimation methodology using high-frequency data, since practitioners and researchers can get access to the big data and estimate variables of interest with greater accuracy; the other is a "frog eyes' view" on market microstructure, since low-latency data offers a valuable chance to investigate trading behaviors with a higher resolution than ever before.
Correspondingly, this paper's contributions to the literature are twofold: i) one is stationarity test of microstructure noise, we study the estimation problem when using highfrequency data with non-stationary noises, and then test non-stationarity in microstructure noise via several complementary model-free approaches; ii) the other one is on empirical market microstructure, since the microstructure noise can capture some information about market quality and liquidity, we estimate noise levels as measures of time-varying bid-ask spreads, risk aversions of market participants etc., and detect short-term liquidity variations.

Literature review
The high-frequency finance practice motivates two clearly distinct and closely related researches: One is more accurate estimation in financial econometrics, to name a few but not all, the estimation of integrated volatilities, quadratic covariances, the activities of jumps, the leverage effects, the volatility of volatility, the lead-lag effect. This stream of research started from Jacod [1994], Jacod and Protter [1998] from the perspective of stochastic calculus, and Foster and Nelson [1996], Engle [2000], Zhang [2001], Andersen et al. [2001], Barndorff-Nielsen and Shephard [2002] in the context of econometrics. Now the high-frequency financial econometrics has already developed into a considerably influential research field with numerous prominent scholars and there are already monographs on this area: Jacod and Shiryaev [2003], Jacod and Protter [2012] developed probabilistic tools for high-frequency financial data analysis, Aït-Sahalia and Jacod [2014] provided an excellent overview in econometric literature, Hautsch [2012] is a good account from a financial standpoint. There are also academic chapters concisely reviewing high-frequency financial econometrics: Russell and Engle [2010], Mykland and Zhang [2012], Jacod [2012].
The other one is the study of market microstructure. Low-latency data allows financial practioners and researchers to look at the financial markets at a higher resolution level, for example, one can know the bid/ask dynamics within each second, one can also know the order flow through the limit order book. The market microstructure theory studies how the latent demand and latent supply of market participants are ultimately translated into prices by studying the specific market structure in detail. The cornerstone papers include Glosten and Milgrom [1985], Kyle [1985], both of them are using (pesudo) 1 game-theoretical argument in information economics. More comprehensive books include O'Hara [1995], Hasbrouck [2007]. However, when looking closely at the transaction or quotation prices, one can find that the price is no longer an Itô semimartingale, not even random walk. For this reason, according to market microstructure theory [O'Hara, 2003], the semimartingale model in classical asset pricing theory [Harrison andPliska, 1981, Delbaen andSchachermayer, 1994] is not a photographic depiction of the real prices of financial assets, yet it is still a fairly good approximation to asset prices when the sampling frequency is relatively low, and that is the reason the literature suggests using at most 5-minute subsampling.
Some estimation methods for integrated volatility using noisy high-frequnecy financial data have already been well established: i) Zhang et al. [2005] found the first consistent estimator (two-time scale realized volatility) using subsampling and averaging in the presence of i.i.d. market microstructure noise and Zhang [2006] gave a multi-scale version with the optimal rate of convergence n 1 4 , Li and Mykland [2007] discussed the robustness of TSRV to noise assumptions in general, Kalnina and Linton [2008] generalized the TSRV to the model with endogeneous and diurnal noise and put forward a modified version of TSRV which we shall use in this paper. Later Aït-Sahalia et al. [2011] generalized the model to allowing correlated noises under stationary and strong-mixing conditions; ii) Barndorff-Nielsen et al. [2008] provided a kernel-based estimator under the model in which the noise process is temporarily dependent and stationary and possibly linearly correlated with the latent Itô process, their inference is also robust to endogeneous spacing; iii) Jacod et al. [2009] designed a generalized version of the pre-averaging approach , under a Markovian noise model which allows arbitrary fashion of noise but without correlation between noise and the latent process; iv) Motivated by the likelihood method from Aït-Sahalia et al. [2005], Xiu [2010] established quasi-maximum likelihood method (QMLE) in the estimation of integrated volatility; v) Bibinger et al. [2014] developed the local generalized method of moments to estimate quadratic covariation using noisy high-frequency data.
Many estimators of integrated volatilities using high-frequency noisy data were developed under the assumption that the microstructure noise is stationary. However, literature in empirical finance, such as Admati and Pfleiderer [1988], Hasbrouck [1993], Andersen and Bollerslev [1997], Gouriéroux et al. [1999], has already shown in 1990s that markets exhibit systematic intra-day patterns. Therefore, allowing heteroskedasticity and non-stationary in microstructure noise in integrated volatility estimation is of particular importance in applica-1 To say it "pseudo" because in the model considered in Kyle [1985], the market maker does not aim to maximize their utility, instead his or her objective is only to guarantee market clearing. tion. Particularly, Kalnina and Linton [2008] used a parametric model to describe the diurnal pattern in microstructure noise. Aït-Sahalia and Yu [2009] used the estimates of noise variance in high-frequency data to measure the market liquidity from June 1996-December 2005 There is other related research in the literature, Awartani et al. [2009] studied the changes in microstructure noise due to sampling frequency, Bandi et al. [2013] derived the optimal sampling frequency in terms of finite-sample forecast mean squared error in linear forecast model with non-stationary microstructure noise.

Structure of this paper
Section 2 describes our model and assumptions; after showing non-stationarity effect on the two scale estimator, complementary statistical tests are designed to detect microstructure noise stationarity based on high-frequency asymptotics, the asymptotic distributions under both null and alternative hypotheses and their implications for testing are shown in section 3, 4, 5; section 6 introduces an aggregate measure of liquidity risk and studies its estimation problem; relation between volatility and variance of microstructure noise, as well as endogenous microstructure noise are discussed in section 7; section 8 and 9 contain our simulation and empirical analysis; section 10 concludes. Some proofs are given in the Appendix.
, P (0) on which a latent Itô semimartingale {X t } t≥0 is adapted, and can be described by where {b t } t≥0 is the drift, σ 2 t is the spot volatility in financial terminology (for example, its dynamics can be described by Heston model [Heston, 1993]); {W t } t≥0 is a 1-dimensional Wiener process; J t is a jump process which is described in subsection 2.3. Secondly, we have another filtered probability space , P (1) on which the observable process {Y t } t≥0 is adapted. Then we can define the market microstructure noise process {e t } t≥0 2 , as the difference between the latent and observable processes: we call {Z t } t≥0 the "estimable latent process" because we can indeed estimate it from the actual observations via, for example, pre-averaging , Jacod et al., 2009, 2010, Mykland and Zhang, 2016. It is natural to assume the process {Z t } t≥0 is an Itô semimartingale, for example, if we assume Z t = f (X t ) for some f (·) ∈ C 2 (R) [Li and Mykland, 2007] then {Z t } t≥0 is an Itô semimartingale 3 . Based upon {Z t } t≥0 , we can define a noise process { t } t≥0 of another form, which is not necessarily the difference between the observable process {Y t } t≥0 and the latent process {X t } t≥0 , instead defined theoretically via: we call { t } t≥0 the "distinguishable noise", which can be disentangled from the estimable latent process {Z t } t≥0 [Bandi and Russell, 2006a]. Thirdly, we have a Markov kernel to provide a connection between the processes {X t } t≥0 and {Y t } t≥0 , namely Q t (ω (0) , dy) : (Ω (0) , F (0) ) × (R, B(R)) −→ [0, 1], i.e., conditional on the whole latent process X, there exists a probability measure on the space (R, B(R)).
Thus, all the relevant process, either latent or observable, can be defined on the extended filtered probability space ( i.e., g t i = E( 2 t i |F (0) ). By this definition, {g t } t≥0 is also a stochastic process. Note that g t could depend on more than one latent random variables, i.e., it is possible that g t (ω (0) ) = g t (X t (ω (0) ), Z t (ω (0) ), σ 2 t (ω (0) ), · · · ) for each t. In Section 4 and Section 6 regarding some behaviors in presence of non-stationary microstructure noise, we pose specific restrictions on the process {g t } t≥0 , and let it be an Itô diffusion, and use asymptotic properties to show asymptotically optimal power and measure liquidity in high-frequency data.

Observational notation
This subsection can be skipped at the first reading. Please be adviced to go back to this subsection when encounter the observational notation in later sections.
Suppose we focus on a finite interval [0, T ] on which ultra-high frequency data is recorded. Define G to be the finest time grid whence all the observations were obtained. Suppose we have n observations after the reference starting point 0, then G can be written as We sometimes do sparse sampling, typically start from the k-th observation and take one sample from every K observations. Formally, we define sub-grids G (K,k) 's indexed by k = 0, · · · , K − 1 for each K ∈ N + : To analyze the edge effect 5 and the modified TSRV, we need more observational notation: sometimes, we will also denote by H i the i-th time point in a given grid H, for example, G In order to define some of our tests in Section 4, we need to introduce some shrinking moving windows and local sampling grids. Later, we will partition the fixed time interval [0, T ] (in application, T could be 5 business days or some longer periods) into r n (depends on n and r n → ∞) sub-intervals (T i , T i+1 ]'s, such that each (T i−1 , T i ] contains K n observations, i.e. T i = t iKn , 0 = T 0 ≤ T 1 ≤ T 2 ≤ · · · ≤ T rn and r n = n/K n . We also let S i denote the shrinking sampling grid

Assumptions
Beyond the model setup in subsection 2.1, we have to make the following identification assumption in order to achieve identifiablity and estimability: The edge effect is a pervasive phenomenon in non-parametric high-frequency econometrics. Verbally stated, edge effect is "information phasing in and phasing out at the edges of time intervals", which is caused by inhomogeneous usage of data. Although undesirable, this feature is inevitable in estimation. 6 The time grids defined in (7) and (8) depend on the tunning parameter K which should be more properly written as Kn, however, the dependence on n will be suppressed in the observational notation, for the sake of readability and notational ease. Nonetheless, it is important to keep this implicit dependence on n in mind.
otherwise all the estimation methods will break down [Jacod et al., 2009]. Note that under the identification assumption (9), we have {e t } t≥0 and { t } t≥0 are identical, and there is no correlation between noise and the latent process. As a sum-up, the following assumptions will be needed for various results: Assumption 1. Diffusion part of Itô semimartingale. The underlying model is (1), {b t } t≥0 , {σ t } t≥0 and {W t } t≥0 are adapted, {b t } t≥0 and {σ t } t≥0 are càdlàg processes and locally bounded.
with µ being a Poisson random measure on R + × R and ν being the predictable compensator of µ in the sense that (µ − ν)((0, t], A) is a local martingale for ∀t > 0, ∀A ∈ B(R). One could write ν(dt, dx) = dt ⊗ λ(dx) where λ is a σ-finite measure (for example, Lebesgue measure) on R.
Assumption 5. Conditional independence. Conditional on the latent variable(s), the observations Y t i 's at different times are independent, i.e., Y t i |= Y t j for i = j. This assumption simplifies the proof substantially 7 .
Assumption 6. Locally boundedness of microstructure effect. ∀l > 0, ∀δ 0 > 0 and ∀α > 0, ∃M (α+δ 0 ,l) , such that E | t i | α+δ 0 |F (0) ≤ M (α+δ 0 ,l) , when X t i ∈ [−l, l], σ 2 t i ∈ (0, l]. Assumption 7. Possibly irregular observational grid with shrinking mesh. The sampling times can be irregular, but independent of the latent process. The Mesh of the grid G goes to zero, more specifically, max 1≤i≤n ∆t i = O p 1 n . Based on some of these assumptions, we provide results involving various modes of stochastic convergences. It is necessary to clarify our notation for these convergence modes: 3 Testing stationarity/non-stationarity: the first test In this article we are considering testing the null hypothesis that the market microstructure noise is stationary: An interpretation of this assumption is that the market microstructure effects occurred at different time are independent if the market participants know the latent efficient prices. 8 The concept " stable convergence in law" may appear unfamiliar for some readers, please refer to Mykland and Zhang [2012] or chapter 2 in Jacod and Protter [2012] for definition. and we concern the following questions: • Could we find any non-parametric test to tell the stationarity of microstructure noise?
• Is any stationarity test valid in terms of controlling type-I error?
• Is it asymptotically optimal in that its statistical power is the largest in asymptotics?

Prelude: non-stationarity and its remedy in estimation
In this subsection, we divert our focus to the estimation of integrated volatility (or continuous quadratic variation in the terminology of stochastic calculus) using high-frequency data contaminated by (possibly non-stationary) market microstructure noise. Our first test statistic was inspired by this. Two-time scale realized volatility estimator (TSRV) [Zhang et al., 2005] is the first consistent estimator of integrated volatility using noisy high frequency financial data. In this article we define [Y, Y ] H as the realized variance of process {Y t } computed on a given sampling grid H. The TSRV is defined as follows: where, according to the notation introduced in subsection 2.2, The optimal choice for the tunning parameter is K n = O(n should be more closer to X, X T ; the second term [Y, Y ] G is a good proxy to the noise variance, hence it is to offset the bias due to the noise in [Y, Y ] (avg,Kn) T . The TSRV was originally designed under the setting where microstructure noises are stationary, however, under non-stationary microstructure noises, TSRV has a bias term produced by edge effect due to the following lemma: Lemma 1. Under the Assumption 1, 3, 4, 5, 6, 7, we have: (avg,K) T due to non-stationary noise +o p (1) 9 A caveat in application is to choose Kn such that n − n/Kn K is sufficient small, in order to reduce the edge effect.
From Lemma 1, we can see the noise in each time point does not contribute equally to the bias in the averaged realized variance [Y, Y ] (avg,Kn) T . In the first and last K n sample points, the conditional second moments of noises are multiplied by the factor 1 Kn , in contrast, the conditional second moments of noises in the middle of the sample points are multiplied by the factor 2 Kn . However, the noise correction term [Y, Y ] G in (10) acts as if g t i 's all have the same contribution to the noise component in [Z, Z] (avg,Kn) T . The modification to the TSRV and the first two tests are motivated by the inhomogeneity of utilization of information at the two edges of the time interval [0, T ].
To the best of our knowledge, Kalnina and Linton [2008] is the first study which considered the edge effect in TSRV due to the non-stationary microstructure noise, and they redefined the TSRV by [Y, Y ] under a parametric model which incorporates the diurnal and endogenous measurement error. 10 In the following, we used this design to attack the non-stationarity problem under the general hidden Itô semimartingale model given in Section 2.
In this paper, we call the new TSRV consisting of the modified version of realized variance in Kalnina and Linton [2008] as "sample-weighted TSRV", which is defined as The sample-weighted TSRV enjoys the following asymptotic property under the general model in Section 2: Theorem 1. Suppose there are n observations in the finite time interval [0, T ]. When we take K n = cn 2/3 for some constant c, under the Assumption 1, 3, 4, 5, 6, 7, we have The theorem tells us the sample-weighted TSRV in non-stationary noise setting enjoys the same asymptotic property as those of traditional TSRV in stationary noise setting [Zhang et al., 2005, Li and Mykland, 2007, Aït-Sahalia et al., 2011, in that the asymptotic distribution as well as the convergence rate remain unchanged, in other word, the asymptotic property of the sample-weighted TSRV is invariant with respect to non-stationary market microstructure noise. 10 The model upon which Kalnina and Linton [2008] was based is Assuming H 0 is true, both of the asymptotic distributions of the original TSRV and the sample-weighted TSRV are mixed normals. So, the asymptotic distribution of the difference between two different versions (after proper scaling) is also a mixed normal. Therefore, we can test the null H 0 based on the asymptotic behavior of their difference.
is the sample quarticity based on the observation Y t i 's. Our first test statistic has the following asymptotic property: Theorem 2. If the noise process is stationary, under the Assumption 1, 2, 5, 6, 7, as long as We use this result to test the stationarity of the market microstructure noise in subsection 9.2 ( Figure 9).
The denominator of the test statistic (14), is actually an estimator of 2E( 4 |F (0) ). This is formally introduced in (16) below, which is not only used in the first test statistic but also used in the second test statistic in subsection 4.2. It is interesting in its own right, hence we here give the result: Lemma 2. If we define the process h t (ω (0) ) ≡ E( 4 t |F (0) )(ω (0) ), then under the Assumption 1, 2, 5, 6, 7, we have Remark 2. We now investigate the behavior of our first test statistic when microstructure noise is non-stationary.
Since we assume local boundedness of noise variance, D T is finite almost surely, regardless of noise stationarity. From the proof in subsection 11.3, we know Since K n = O n 2/3 in our setup, N (Y, K n ) T explodes when the noise is not stationary. Thus, the type-II error of this test is asymptotically negligible.
Followed from Theorem 2 and Remark 2, we have Corollary 1. Assume {g t } t≥0 and {h t } t≥0 are càdlàg processes 11 on [0, T ] with 0, T being continuity points almost surly, additional we have the Assumption 1, 2, 5, 6, 7, when the noise process is non-stationary, Remark 3. The test statistic N (Y, K n ) n T can disclose potential non-stationarity in the market microstructure noise via two edges of the mesh G (min) , G (max) and the middle of the mesh G/(G (min) ∪ G (max) ). We can show there are, in latter subsections, schemes which are able not only to reflect the heterogeneity between two edges and the middle, but also to capture almost all of the information about the non-stationarity in the data, however, inevitably with more computational cost. We will discuss these schemes in Section 4.

The second and third tests 4.1 The general idea
The second and third tests are designed as an attempt to effectively utilize all the information relevant to noise stationarity contained in the data, in contrast to the first test N (Y, K n ) n (see Remark 3). The basic idea of the second and third tests is to conduct local tests on sub-intervals and then combine evidences from all the local tests.
To straighten the idea, recall the observational notation in subsection 2.2, we partition the fixed time interval [0, T ] into r n sub-intervals (T i , T i+1 ]'s, such that each (T i−1 , T i ] contains K n observations. Similar to the definition of the first test statistic, but instead of the whole interval [0, T ], the second test uses local test statistic defined on sub-intervals of the form where X, X (T SRV,Kn) are TSRV and sample-weighted TSRV estimators built upon the data in the time interval Then we use the overlapping window to calculate the quantity U (Y, K n , u) n T , which depends on the processs Y , the stage of statistical experiment n, tunning parameter K n and s n < n Kn , and a number u > 0: Similarly, we also define a quantity based on non-overlapping windows: We have the following result in regard to the asymptotic property of V (Y, K n , 2) n T : Theorem 3. (V (Y, K n , s n , 2) n T under the null) Under the Assumption 1, 2, 5, 6, 7, assume the noise process is stationary, and choose the tunning parameters such that K n /n → 0, K n /n 1/3 → ∞, s n → ∞, s n . Then the test statistic V (Y, K n , 2) n T has the following asymptotic property: We use this result to test the stationarity of the market microstructure noise in subsection 9.2 ( Figure 10).
We can also define another quantity V (Y, K n , s n , 2) n T based on non-overlapping intervals Following from Theorem 3, the asymptotic property of V (Y, K n , s n , 2) n T can be derived.
Corollary 2. Under the same conditions as in Theorem 3, and assume the noise is stationary: Remark 4. It is a little bit surprising when we compare Corollary 2 with Theorem 3, since the limiting mixed normals of U (Y, K n , s n , 2) n T and U (Y, K n , s n , 2) n T have the same asymptotic variance which can be consistently estimated by η, though the convergence rate of the former is lower. However, the results only demonstrate the limiting behaviors. V (Y, K n , s n , 2) n T required less computation, while V (Y, K n , s n , 2) n T is more accurate in terms of asymptotic approximation because of its higher rate of convergence.

The third test
There is a moderate edge effect in the second test statistic (24) (coming from the first s n K n and the last s n K n observations). Motivated by Remark 3 regarding the first test statistic (13), we can design a complementary test statistic V (Y, K n , 2) n (defined by (29) below) with the same asymptotic property with V (Y, K n , s n , 2) n when the noise is stationary, yet has a smaller edge effect in finite sample. However, we should keep V (Y, K n , s n , 2) n in our toolbox -although V (Y, K n , 2) n offers better approximation when noise is stationary, we will see V (Y, K n , s n , 2) n has more statistical power as indicated in Figure 1.
The key component of the third test statistic is where each S i denotes the shrinking sampling grid {t (i−1)Kn , · · · , t iKn } over [T i−1 , T i ] (recall the observational notation in subsection 2.2), and [Y, Y ] S i is the realized variance of process Y on the grid S i . Our third test statistic is defined as where η was defined in (25).
Theorem 4. (V (Y, K n , 2) n T under the null) Under the Assumption 1, 2, 5, 6, 7, assume the noise process is stationary, suppose K n → ∞, K n /n → 0 then the test statistic V (Y, K n , 2) n T has the following asymptotic property:

Optimal statistical powers
How V (Y, K n , s n , 2) n and V (Y, K n , 2) n behave when the noise is non-stationary determine their statistical powers. If the test statistics tend to be large when the microstructure noise is non-stationary, they can easily detect non-stationarity. The behaviors of U (Y, K n , s n , 2) n and U (Y, K n , 2) n largely indicate the behaviors of V (Y, K n , s n , 2) n and V (Y, K n , 2) n . We investigate in this subsection the asymptotic behaviors of U (Y, K n , s n , 2) n and U (Y, K n , 2) n when microstructure noise is non-stationary under a slightly strengthened setting, we need 2 more assumptions on top of those assumptions in subsection 2.3: Assumption 9. Noise variance process is Itô. {g t } t≥0 is an Itô diffusion (in time): t } t≥0 is locally bounded, optional and càdlàg, {B t } t≥0 is a standard Brownian motion, {σ (g) t } t≥0 is a locally bounded Itô diffusion. As described in subsection 2.2, we partition the whole time interval into r n disjoint subintervals (T i−1 , T i ] for i = 1, 2, · · · , r n such that in each sub-interval we have K n observations, particularly we have T 0 = 0 and T − T rn = o(1), r n K n /n → 1. Since Assumption 8 is assumed, we let ∆T = T i − T i−1 , ∀i = 1, 2, · · · , r n .
On the other hand, Theorem 5 and 6 reveal asymptotic behaviors of V (Y, K n , s n , 2) n and V (Y, K n , 2) n under the alternative hypothesis by respectively analyzing U (Y, K n , s n , 2) n and U (Y, K n , 2) n . Since the moments of noise are locally bounded, 1 G and η are always finite. Following Theorem 5, 6, we have the following corollary: Corollary 3. Assume Assumption 1, 2, 5, 6, 7 as well as Assumption 8, 9. Adopt the choice of tunning parameters in Theorem 5, 6, we have Recall the choices of tuning parameter, K n → ∞ for N (Y, K n ) n , K n /n 1/2 → ∞ for V (Y, K n , s n , 2) 2 and V (Y, K n , 2) 2 , their asymptotic powers attain the optimal. As in finite samples, V (Y, K n , 2) n has more statistical power than N (Y, K n ) n by a factor of magnitude K n /n 1/2 ; V (Y, K n , s n , 2) n is more powerful than V (Y, K n , 2) n by a factor of magnitude s n .

A user's guide of stationarity tests
We currently have 3 complementary tests, namely N (Y, K n ) n , V (Y, K n , s n , 2) n and V (Y, K n , 2) n , each test has its own advantages as well as disadvantages. In this subsection, we are going to discuss their strength and weakness, and how to choose the optimal test for different circumstances. They are estimated from our simulation whose configuration is fairly realistic (subsection 8.1).
(1) The first test N (Y, K n ) n divides the sample into 3 periods and compares the noise level in the middle with those on the edges. If we are interested in possible daily diurnal noise patterns, for example, let's test whether the noise level is higher in opening and closing trading hours, the best choice is to apply N (Y, K) n on 1-day high-frequency data. However, N (Y, K n ) n is not sensitive to local changes, for example, in case of a periodic change and the data sample covers several cycles, N (Y, K n ) n will likely misjudge the non-stationarity fact; (2) The second test uses moving local windows each containing s n K n observation, and compares noise levels in the edges and the middle of each local window; the third test also uses local windows but compares the noise level in one local widow with those in neighboring windows. Because they conduct test locally and aggregate local evidences, V (Y, K n , s n , 2) n and V (Y, K n , 2) n are more powerful in detecting local noise changes which N (Y, K n ) n could probably ignore. However, if the noise transition goes very smoothly but there is a systematic paradigm shift on a global scale, V (Y, K n , s n , 2) n and V (Y, K n , 2) n might lead to false stationarity conclusion; (3) As said in subsection 4.3, V (Y, K n , s n , 2) n has a smaller edge effect than V (Y, K n , 2) n hence V (Y, K n , 2) n is more a accurate test under the null hypothesis; whereas V (Y, K n , 2) n enjoys larger statistical power (the lower right panel in Figure 1). The intuition is that by construction the focus of V (Y, K n , 2) n is too local although it results in the smaller edge effect, which turns into its disadvantage when the noise is non-stationary.
As a simulation comparison, Figure 1 shows averaged p-values computed from simulated 1day/multi-day data with stationary/non-stationary noises. Figure 2 shows their ROC curves. The simulation configuration is described in subsection 8.1, and each p-values shown is the average of 3000 Monte Carlo samples.
As a summary, we list different considerations about the optimal choice of these tests in Table 1. These plots show some properties of the tests we proposed: 1. For type-I error, all the tests can control their type-I errors pretty well regardless of the time span of the data, in that N (Y, K) n can very accurately control its type-I error in finite samples, V (Y, K, s, 2) n and V (Y, K, 2) n are more conservative in the sense that their effective type-I error is smaller than specified; 2. For type-II error or statistical power, only N (Y, K) n performs satisfactorily on 1-day data, meanwhile, V (Y, K, s, 2) and V (Y, K, 2) n are much better when applied to multi-day data in terms of their larger statistical powers and faster convergence rates. Consistent with Corollary 3, V (Y, Kn, sn, 2) n has a better statistical power in finite sample.

Figure 2: ROC Curves
ROC curves shows how type-II changes as type-I error varies. Once again, the ROC curves indicates that when microstructure noise exhibits a daily diurnal pattern, N (Y, Kn) n is optimal for 1-day data, V (Y, Kn, sn, 2) n is optimal for multi-day data.
6 Measuring aggregate liquidity risks 6.1 A notion of "aggregate liquidity risk" On one hand, [g, g] as the quadratic variation of {g t } t≥0 over (0, T ] is a reasonable measure of the "aggregate" variation of the process {g t } t≥0 . On the other hand, microstructure noise variance g t i is a measure of market quality [Hasbrouck, 1993], or more specifically, market liquidity [Aït-Sahalia and Yu, 2009]. Hence it should not be utterly unreasonable to interpret [g, g] T as "aggregate liquidity risks". In this section, we are going to define a notion of "aggregate liquidity risks" and provide an estimator with an associated CLT.

Estimating aggregated liquidity risk [g, g]
Recall Theorem 6 and note that n However, We can rewrite (33) as depending the relation between the number of blocks and the number of observations within each block, we have different second-order properties. If we let Kn n 3/5 → ∞, we have an unbiased central limit theorem for estimating [g, g]. Otherwise, in case K n n 3/5 (or K n /n 3/5 → 0), we have a CLT with a finite (or diverging) bias.
Corollary 4. 12 Assume Assumption 1, 2, 5, 6, 7 as well as Assumption 8, 9. Let Kn n 3/5 → ∞, Kn n 2/3 → 0, then we have Remark 5. Toward a better finite-sample performance, for example, to get a more accurate confidence interval for the aggregate liquidity risk, we suggest to use the estimate of as the approximation to the finite-sample variance, in order to avoid the situation in which we underestimate the finite-sample variance and become overoptimistic about the accuracy of our estimate. The 95% confidence interval for our measure "aggregated liquidity risk" is where S i and l n n/K n .
12 Corollary 4 in some sense is an extension of the "integral-to-spot device" in Mykland and , then under some regularity conditions (to guarantee standard stable convergence plus additional restriction on edge effects), as q → ∞ and q∆T → 0, Under some regularity conditions, according to the "integralto-spot device" in Mykland and Zhang [2016] 3 2(∆T ) 2 However, we do not know the true values of Gi's in application, after swapping Gi for Gi, Note that n Gi − Gi−1 2 , Corollary 4 reveals the possible additional terms and provide the central limit theorem associated with (35). Upon choosing Kn appropriately, the additional terms on the right side of (35) is zero and we have an unbiased central limit theorem.

Noise functional dependency and model extension
The law of microstructure noise is represented via a Markov kernel Q t (ω (0) , dy) for each time t, through which the second moment of the noise evolves according to a random function in time g t (ω (0) ) = E( 2 t |F (0) )(ω (0) ) = R |y − Z t (ω (0) )| 2 Q t (ω (0) , dy) on the probability space (Ω (0) , F (0) , {F (0) t } t≥0 , P (0) ). The random function g t (ω (0) ) could depend on various latent variables, and more generally the form of Q t (ω (0) , dω (1) ) allows a wide range of correlation structures between the efficient price process and the microstructure noise. In this section, we discuss an elementary empirical evidence about the dependence of g t (ω (0) ) on σ 2 t (ω (0) ) and the implication of the violation of our identification assumption i.e. Assumption 4.

Regression: market microstructure noises and spot volatilities
In this subsection, we go beyond the recognition that the second moment of microstructure noise is evolving over time, document the dependence of g t on volatility σ 2 t . In doing so, we conduct time series linear regression of g t i 's on the latent variables σ 2 t i 's 13 . We assume that the latent market microstructure noise variance and the latent volatility are correlated: Assumption 10. With probability 1, we have ∀t ≥ 0, where ζ t |= σ 2 t .
Since both g t and σ 2 t are unobservable, we need some preliminary estimates for both variables. Here, we use scaled sample-weighted TSRV and realized variance calculated from local samples to estimate spot volatilities σ 2 t i 's and local noise levels respectively, i.e., σ 2 , |H i | is the cardinality of H i . Then we can conduct linear regression on these pairs of volatilitynoise estimates ( g τ i , σ 2 τ i )'s by ordinary least squares: where m is the number of observation in the small time interval (τ i , τ i+1 ], and η  13 Aït-Sahalia and Saglam [2016] provides a theoretical underpinning for the negative correlation between volatility and liquidity, equivalently, positive correlation between σ 2 t and gt: a higher volatility indicates a higher risk that arbitrageurs might take advantage of market makers' previous orders to act against market makers, hence it reduce the activities of liquidity provision. Lemma 3. Suppose Assumption 1, 3, 4, 5, 6, 7 ae well as Assumption 10 hold, let min |H i | → ∞ and max |H i |/n → 0, then By lemma 3, if there is a linear relationship between the noise variance and the spot volatility, the regression (39) provides consistent estimates of linear coefficients. Figure  The time series regression and empirical analysis here are preliminary. One can investigate the statistical properties of this type of linear regression in more detail. Perhaps there are non-linear relations. These issues will be addressed in our future research.

Model extension: endogenous noise
In our model, we allow arbitrary fashion of the noise process up to the time-varying Markov kernel Q t (·, ·) plus the identification assumption (Assumption 4). As documented in Jacod et al. [2009], the identification assumption is restrictively strong. If one is interested in the stationarity of { t } t≥0 , our methods are valid regardless the identification assumption holds or not. However, if one is concerned about {e t } t≥0 our methods will break down when the identification assumption is violated. Nevertheless, this extension is indispensable for empirically compatible modeling and it allows endogenous microstructure noise (noise which is correlated with the efficient price [Hansen and Lunde, 2006]).
Note that in subsection 2.1, conditioning on all latent variables, t is a mean-zero random variable, i.e., R (y − Z t (ω (0) )) Q t (ω (0) , dy) = 0 since R y Q t (ω (0) , dy) = Z t (ω (0) ). However, the conditional mean of e t is not necessarily 0 since E(e t |F (0) This observation enables us to, non-parametrically, introduce endogenous noise into our model. We can allow instantaneous/realized correlation between the latent process {X t } t≥0 and the noise process {e t } t≥0 . Although E(e t |F (0) ) is not necessarily 0, we assume the unconditional mean E P (e t ) is zero, then calculation shows [Jacod et al., 2009] assumed Z t = X t , so there is no endogenous noise in their model. However, as long as E P (0) [X t Z t ] = E P (0) [X 2 t ], there is correlation between the latent process {X} t≥0 defined by (1) and the noise process {e t } t≥0 defined by (2). An intuitive interpretation is that e t encodes some relevant information about the processes defined on the latent probability space if it is correlated with the latent random variables X t and Z t . In contrast, t is a pure noise and conveys no useful information about the latent processes, the correlation between t and any latent random variable is zero. For this reason we call e t "endogeneous microstructure noise", and call t "exogenous microstructure noise".
Remark 6. When one tries to estimate the integrated volatility, the quantity which is actually estimated is Z, Z T , not necessarily the usaully desired target X, X T . This is discussed by [Li and Mykland, 2007]. In contrast to [Jacod et al., 2009], we do not assume R y Q t (ω (0) , dy) = X t (ω (0) ). In other words, in the case where Z t = X t , the integrated volatility X, X T is not identifiable; however, if we are satisfied with estimating Z, Z T , then we are able to introduce some conditional correlation between the efficient price and the microstructure noise.
One conceptual finding from the model extension is the informational content in microstructure noise {e t } t≥0 with respect to the efficient price in financial term (or latent process in statistical term) which is modeled as an Itô semimartingale. The interpretation comes from market microstructure theory [O'Hara, 1995[O'Hara, , 2003. As in the classical asset pricing theory, we take the price as given and exogenous, and conduct trading and hedging strategies, portfolio allocation and risk management. But the price discovery and price formation depend on the behaviors of market participants, no price will be produced without investment activities of various market participants. It is the balance between demand and supply from investors, it is the psychology of people in the market, it is the synthesis of microscopic effects of beliefs and behaviors of market participants, that determine the prices. Thus the efficient price should be an endogenous process in the financial market. It is one of striking difference between asset pricing and market microstructure theory: the classical asset pricing theory assumes frictionless and competitive market in which people do not have to worry about the price impact and liquidity constraint. While, in market microstructure theory, the modelers need to look inside the "black box" of the trading processes, and take market making, price discovery, liquidity formation, inventory control, asymmetric information into account.
Since we consider the price as endogenous, which, for example, affected by transaction costs (like bid-ask spread), inventory control, discrete adjustment of price, lagged incorporation of new information, insider trading and adverse selection brought by asymmetric information, lack of liquidity caused by one or several of the factors mentioned above, the Itô process is merely an approximation to the efficient price observed at high-frequency, at which market microstructure effects manifest itself to such extent that the accumulated noise swamps the integrated volatility of the latent Itô process and the variation in microstructure noise dominates the total variance. Therefore, it is reasonable (even indispensable) to extend our model to allow endogenous microstructure noise, at least from the viewpoint of microstructure theory, and for sake of realistic modeling at low-latency and millisecond level. This topic is not the focus of this paper, in-depth discussion and treatment on endogenous microstructure noise the will be addressed in our future research.

Simulation scenario
The configuration of our simulation design is where E(dW t · dB t ) = ρ dt, N X and N V are Poisson processes |= W, B with parameters λ X and λ V respectively, the jump sizes satisfy J X ∼ N (θ X , ν X ) J V t = e z with Z ∼ N (θ V , ν V ). The stationary microstructure noise behaves as where u ∈ (−0.5, 0.5) and n is the number of high-frequency observations in 1 business day. In (43) the noise variance of { (ns) t i } i changes according to a U-curve, which means the noise is of relatively higher levels around opening and closed hours. The U-curve is chosen such that the averaged noise variance within a day is ω 2 . The noise conforms to the empirical feature that the variance of microstructure noise increases with the level of volatility [Bandi and Russell, 2006b]. The parameters are chosen so that they are consistent with Aït-Sahalia and Yu [2009]: 0.16 0.5 12 -5 0.8 noise parameters a 0 a 1 α M u 5 × 10 −3 1.54 × 10 −4 1 × 10 −5 10 0.3 Furthermore, σ 2 0 is sampled from the stationary distribution of Cox-Ingersoll-Ross process [Cox et al., 1985], i.e., Gamma 2κσ 2 δ 2 , δ 2 2κ so the unconditional mean of the volatility isσ 2 . a 1 is chosen such that Var( (s) ) = Var( (ns) ) in average. We also adopted a random sampling scheme according to an inhomogeneous Poisson process Poisson(λ t × ∆) where ∆ is averaged sampling duration and the trading intensity evolves periodically λ t = 1 + 0.5 × cos(2πt/T ) with T being the length of 1 business day.

Simulation results
In Figure 4, 5 and 6, we show the simulation results of N (Y, K n ) n T , V (Y, K n , s n , 2) n T and V (Y, K n , 2) n T where T is taken to be 1 business day (left panel in each figure) and 5 business days (right panel in each figure). For each test and each time span, the simulation is conducted in 2 different circumstances: stationary noise (upper picture in each column), U-shape noise (43) (lower picture in each column). The plots show various empirical densities function of our proposed tests against the density of N (0, 1). Each group of tests were computed from 3000 sample paths with averaged sampling interval 1 second. 9 Empirical studies 9.1 Empirical evidence of non-stationary microstructure noise

Empirical tests
In this subsection, we apply our tests onto high-frequency financial transaction data of stocks.  These plots show the empirical densities of N (Y, Kn) n when it applies to 1-day/5-day data with stationary/non-stationary noises. Compared the simulation of other tests, we can see N (Y, Kn) n converges faster to N (0, 1) when microstructure noise is stationary. On the other hand, if the microstructure noise is non-stationary and exhibits daily diurnal patter, N (Y, Kn) n is the best for 1-day data. These plots show the empirical densities of V (Y, Kn, sn, 2) n when it applies to 1-day/5-day data with stationary/non-stationary noises. Compared the simulation of other tests, we can see V (Y, Kn, sn, 2) n is more conservative due to its relatively large edge effect when microstructure noise is stationary. On the other hand, if the microstructure noise is non-stationary and exhibits daily diurnal patter, V (Y, Kn, sn, 2) n is the best for multi-day data and enjoys the largest statistical power. Figure 6: Empirical Density of V (Y, K n , 2) n These plots show the empirical densities of V (Y, Kn, 2) n when it applies to 5-day/10-day data with stationary/non-stationary noises. Compared the simulation of other tests, we can see V (Y, Kn, 2) n controls type-I error more accurately than V (Y, Kn, sn, 2) n does when microstructure noise is stationary. On the other hand, if the microstructure noise is non-stationary and exhibits daily diurnal patter, N (Y, Kn) is better for multi-day data.  Test Statistics N (Y, K n ) T for DJIA Components (T is 1 business day)

DJIA Components
Dates The six time series of the first test statistic N (Y, K n ) n computed daily using intra-day ultrahigh frequency financial data. The black horizontal lines around zero are .025% and .975% quantiles of the standard normal distribution. Figure 10: The six time series of the second test statistic V (Y, K n , s n , 2) n computed daily using intra-day ultrahigh frequency financial data. The black horizontal lines around zero are .025% and .975% quantile of the standard normal distribution.

31
In this paper, we mainly concern hypothesis testing of microstructure noise stationarity in a hidden Itô semimartingale model. The null hypothesis is that microstructure noise is stationary, the alternative hypothesis is that microstructure noise is non-stationary with arbitrage dynamics up to a Markov kernel. Our tests work in fairly general settings where the latent Itô semimartingale may have jumps with any degree of activity, the microstructure allows white noise and rounding error, and the observation times can be irregularly spaced.
The first test is motivated by the behavior of the two-scaled estimator (TSRV) under contamination of non-stationary noise, whose negative impact can be eliminated by a modification of TSRV [Kalnina and Linton, 2008] under our general model. Based on the remedy for non-stationary microstructure noise, the first test N (Y, K n ) n is designed as a functional of volatility estimators, its type-I error can be controlled by associated central limit theorem under the null hypothesis. We also demonstrated that N (Y, K n ) n explodes in high-frequency asymptotics when microstructure noise is non-stationary.
Besides, we have other complementary tests, namely V (Y, K n , s n , 2) n T and V (Y, K n , 2) n . They are defined as functionals of N (Y, K n ) n 's and realized variances respectively which are computed in different local time windows. V (Y, K n , s n , 2) n and V (Y, K n , 2) n are asymptotically equivalent and share the same convergence rate under the null hypothesis. Asymptotic approximation to V (Y, K n , 2) n in finite sample is more accurate than that of V (Y, K n , s n , 2) n under the null hypothesis, however, V (Y, K n , s n , 2) n has more advantage under the alternative hypothesis in that it has a larger statistical power. Compare to N (Y, K n ) n which is more suited for 1-day data, V (Y, K n , s n , 2) n T and V (Y, K n , 2) n are more suited for multi-day data. How to choose these complementary tests are discussed in details.
Since microstructure noise could be a measure of the market quality (market liquidity, market depth etc.) [Hasbrouck, 1993, O'Hara, 2003, Aït-Sahalia and Yu, 2009], our test statistics can be measures of liquidity risk. Particularly, assuming microstructure noise variance evolves like an Itô diffusion, not only the asymptotic distributions of the test statistics under the alternative hypothesis are available, but also a notation of "aggregate liquidity risk" and a consistent estimator with an associated central limit theorem.
Some high-frequency financial data from NYSE are analyzed using the tests. As some DJIA components from 2006-2013 shows, variances of microstructure noise indeed changed both daily and intra-daily, which agrees with the empirical literature. Moreover, we find that the timing of the sudden increase in noise variance in Sep. 2008 coincided with the beginning of the global financial catastrophe triggered by the mortgage subprime crisis. The time series of our test statistics reveals a pattern which indicates increases in daily and weekly transaction costs during the financial turmoil.

Appendix
All the calculations are conditional on F (0) . Assuming the Proposition 1 and Lemma 4, 5 which can also be found in Zhang et al. [2005], Li and Mykland [2007]: Lemma 4. Under the model (1), (3) and (4), and the assumptions in Section 2.3, we have: (avg,K) T Besides, define G (min) K+1 as the right immediate neighbor of max G (min) in the full grid G, and define G (max) 0 as the left immediate neighbor of min G (max) in the full grid G. In order to describe the edge effect and the behaviors of some test statistics below, we need to introduce some random variables: and denote h t (ω (0) ) ≡ E( 4 t |F (0) )(ω (0) ). Note that M (1) are asymptotically conditionally independent mixed normals, they have conditional variances 1

Robustness to jumps in noise inference
In proving the testing theorems, namely, Theorem 2, Theorem 3, Corollary 2 and Theorem 4, we can assume the J t = 0, ∀t > 0 in (1) without loss of generality, as long as the noise is uncorrelated with neither the continuous part nor the jump part. Under Assumptions 1, 2, there are 3 components in the realized variance: (1) finite quadratic variation of the discontinuous Itô semimartingale [X, X] T = X, X T + t≤T |∆X t | 2 , where ∆X t = X t − lim s t X s (a well-known result in stochastic calculus); (2) variation due to noise, which is of order O p (n); (3) asymptotically negligible terms, which are cross terms between noise, continuous martingale and jumps.
Under Assumption 5, by a similar argument to those in the proof of lemma 1 in Li and Mykland [2007] 14 , we have a result similar to Lemma 4: which suggests that normalized realized variance of the fastest time scale 1 2n [Y, Y ] G is a consistent estimator of E( 2 |F (0) ) provided the noise is stationary even if there exist jumps, i.e., Lemma 4 still holds. For this reason, the asymptotic distributions remain the same for the test statistics, even if jump is present.

Proof of Lemma 1
Proof. By our assumptions, we can write By the conditional Lyapunov condition, and Lemma 5

Proof of Theorem 1
Proof. Asymptotically 15 , the new version of realized variance in Kalnina and Linton [2008] can be written as: By assumption, the noises are mutually independent conditioning on the whole path of latent process X, thus by Proposition 1 and P (0) {τ l > T } −→ 1 as l −→ ∞, we know [Z, ] G = O p (1). So the following relation holds: The caveat is G and G (min) K k=1 G (k) G (max) might not equal, the difference is t n/K ·K+1 , · · · , tn . Whereas, upon an appropriate choice of K, this difference is asymptotically negligible.
By our assumption we have the following Define the following quantities: Similarly to (49), Combine Lemma 4 with these results, the difference between sample-weighted TSRV and the averaged realized variance of the theoretical process Z is: The remaining argument discussing the error term due to discretization [Z, Z] (avg) T − Z, Z T to which an identical technique in Appendix A.3 in Zhang et al. [2005] applies, whence we get the claim of Theorem 1.

Proof of Theorem 2
Proof. Recall the definition (50), by (51) and the asymptotic behavior of the original TSRV [Aït-Sahalia et al., 2005, Li andMykland, 2007], under the null H 0 we have i.e., when H 0 holds we have N (Y, K) n T = m (1) To prove the limiting distribution is normal, again, we will use martingale limit central by exploiting the discrete predictable quadratic variations of those in (50).
By the same calculation, we know m (1) Since G (min) −→ 0 is a shrinking sub-grid, so 1 by Proposition 1 and the fact that P (τ l > T ) P −→ 1 as l −→ ∞, we know 1 Similarly, m (2) , m (2) T −→ g 2 T . By martingale central limit theorem, we know m (1) T are asymptotically mixed normal. because G (min) and G (max) are disjoint sets of observation times, so m by Proposition 1 and the fact that P{τ l > T } −→ 1 as l −→ ∞, we know m (1) , m (2) T and m (2) T are asymptotically independent and mixed normals, and m (1) (1) T + 6L (2) where L (1) We can show that L (1) T , L T and L T are mixed normals. Observe that then (15) follows.

Proof of Theorem 5 and 6
Proof. In this proof, we write K and r without the subscript n in order to avoid clustered notation. We give the proof for Theorem 6 first, and dictate how to modified the proof to prove Theorem 5.

[(I) + (II) + (III)]
Op √ rK n =Op 1 √ r + O p r K error due to noises note that the error due to noises (of the stochastic order O p r K ) approximately equals to 2r T K T 0 h t dt by the proof of Theorem 3. Hence, The order of (E1) will be analyzed later; (E2) comes from negligible remaining of microstructure noise and its order is obtained from the proof of Theorem 3: Moreover, Consider the normalized error process,