# Price predictability at ultra-high frequency: Entropy-based randomness test

Andrey Shternshis1,2, Stefano Marmi1

1\. Scuola Normale Superiore, Piazza dei Cavalieri 7, Pisa, Italy, 56126
2\. Uppsala University, Lägerhyddsvägen 1, Uppsala, Sweden, 75105

###### Abstract

We use the statistical properties of Shannon entropy estimator and Neyman-
Pearson statistics to study the predictability of ultra-high frequency
financial data. We develop a statistical test for the predictability of a
sequence based on empirical frequencies. We study stylized facts that cause
price predictability such as persistence of order signs, autocorrelation of
returns, and volatility clustering. We show that the degree of randomness
grows with the increase of aggregation level in transaction time. We also find
that predictable days are usually characterized by high trading activity,
i.e., days with unusually high trading volumes and the number of price
changes. We find a group of stocks for which predictability is caused by a
frequent change of price direction. We perform multiple testing for sub-
intervals of days to identify whether there is predictability at a specific
time period during the day.

Keywords test for predictability, limit order book, ultra-high frequency,
entropy, empirical frequencies, Efficient market hypothesis

##  1 Introduction

One of the fundamental questions in finance is the predictability of asset
prices. Currently, there is a set of tools designed to predict prices in the
markets. For instance, traders rely on technical analysis of stocks to make a
profit. The prediction power of technical analysis has been the object of many
investigations, starting with the pioneering work [1]. We refer to [2] for a
review of academic studies on this subject until 2007. For example, it has
been found to generate excess profits in currency markets [3] including
cryptocurrencies [4]. Profitable trading strategies can be constructed with
the usage of forecasting methods such as neural networks [5]. Various trading
methods can be developed in order to increase profits starting from prediction
of future prices which are even only slightly more accurate than a martingale.
For instance, an automatic trading method proposed in [6] outperforms a range
of alternative approaches111According to [7], abnormal returns based on price
behavior in the market decline after academic publications about the
profitable strategies associated with this behavior. It is indeed natural that
the degree of market efficiency can change with time and is related to
environmental factors characterizing “market ecology”, such as the number of
competitors in the market, profit opportunities, and how the market
participants adapt to changing environments. Under the adaptive market
hypothesis [8], much of what behavioral finance cites as counterexamples to
economic rationality is consistent with the evolutionary principles of
financial interactions: competition, adaptation and natural selection; see [9,
p. 7]..

Randomness of financial data aggregated to daily frequency was investigated in
the literature [10, 11, 12]. Studies analyzing the predictability of intraday
prices were conducted using hourly [13, 14] and minute [15, 16] frequencies.
Prices at millisecond and second frequencies were analyzed in [17]. This
research progresses further toward a microscopic examination of financial time
series. Ultra-high frequency data is defined as the full record of
transactions and their associated characteristics. This research is dedicated
to the predictability of ultra-high frequency data.

Long memory of price returns at ultra-high frequency is a stylized fact that
incorporates predictability into the time series. Lillo and Farmer [18]
conducted a statistical test, concluding that both the signs of market orders
and executed limit orders exhibit long-memory processes. They attributed this
long memory of order signs to news arrivals and order splitting, which is
offset by fluctuations in market liquidity. Therefore, the long memory does
not contradict efficiency of markets when prices incorporate all available
information about future values [19]. Moreover, the high speed of occurrence
of new orders makes it difficult to predict the next price before it appears
in such a short period of time. Without taking into account transaction costs,
we can not ensure that predictability at ultra-high frequency indicates the
presence of profitable trading strategies. However, we investigate the level
of predictability as a function of the length of steps in transaction time.
Then, we examine the periods in which the predictability of prices is
presented. We explore what price characteristics distinguish days with
predictability from others. For instance, we show that the autocorrelation of
price returns is statistically significant during predictable days. Moreover,
for most stocks, we observe a high probability of consecutive price directions
across several transactions, aligning with the long-memory characteristics of
price return signs.

We devise a test for randomness of data starting from the estimation of
Shannon entropy. Entropy is defined as an averaged measure of uncertainty
about a symbol appearing in a sequence generated by a random source [20].
Maximum uncertainty arises when all symbols from a finite alphabet are
independently generated with equal probabilities. A common method for entropy
estimation is calculating empirical frequencies of blocks of symbols [21].
Previous instances where Shannon entropy served as a measure for assessing
randomness in financial time series include [10, 12, 16]. The entropy of price
returns of assets traded on the Moscow Stock Exchange was studied in [22]. The
time-varying entropy of meme stocks, which experienced sudden price surges
driven by social media communities, was investigated in [23]. In case of
independent and identically distributed symbols, the difference between
entropy estimation and its maximum follows $\chi^{2}$-distribution [24]. Using
quantiles of the asymptotic $\chi^{2}$-distribution, we can determine
significantly low values of entropy fast. We make a step forward and use a
modification of entropy estimation that allows us to test uncertainty for a
symbolic sequence in case when probabilities of symbols may be not equal. The
test statistics is based on all overlapping blocks of symbols and takes into
account their dependence. Calculating the statistic is straightforward,
requiring only the estimation of frequencies for preselected block lengths.

In a recent work [25], randomness of financial prices at daily frequency was
tested using conditional probabilities. The authors tested if probabilities of
price increase and decrease are the same conditionally on price history. We
provide the test that considers that probabilities that a price moves up or
down can be different but do not depend on previous history. We test if past
price changes are helpful in predicting future price movement. To estimate
Shannon entropy, we utilize discretization that distinguishes between positive
and negative returns. A test for independence related to permutation entropy
of price increments was introduced in [26]. Considering blocks of $k$ prices,
frequencies of $k!$ events need to be calculated. In contrast, our statistic
requires the calculation of only $2^{k}$ frequencies. Approximate entropy was
used in [27, 28] to measure irregularity of financial time series. The authors
fixed the length of blocks $k=3$. We use a larger length for the analysis
based on a given sequence length. Entropy of a singular value decomposition
was applied to test market efficiency in [29]. Monte Carlo simulations were
employed by the authors to establish confidence intervals for low entropy
values. In our test, we evaluate whether new outputs remain independent of the
sequence history, leveraging statistics with known asymptotic distributions.
Applying the test based on empirical frequencies of price directions, we get
rid of Monte-Carlo simulations.

This article introduces four key contributions. First, we propose the test for
randomness of a symbolic sequence. It can be applied with varying numbers of
distinct symbols, presuming the sequence length is sufficiently large.
Additionally, the individual probabilities associated with each symbol’s
appearance need not be equal. Second, we investigate the predictability of
tick-by-tick data. We show that the degree of predictability decreases when we
aggregate simulated and real data by a number of transactions. Third, we
investigate the empirical properties of price returns and the difference in
the properties of returns for not predictable and predictable time series.
Some of the properties are stylized facts of price returns such as fat tails,
autocorrelation of returns, and price jumps. We reveal that the probability of
consecutive returns displaying the same sign (persistence) serves as a
defining feature characterizing predictable sequences. For a group of stocks,
this probability is significantly higher during predictable days. However, we
also observe that the probability of repeating symbols is statistically low
for predictable days in some stocks. For most stocks, we also find a high
autocorrelation value inherent in predictable days. Other properties
indicative of predictable days encompass heightened daily trading volumes and
a substantial number of price changes.

Finally, we localize intervals that we call predictable and find the duration
of periods of predictability. We employ the Šidák correction [30] to conduct
multiple tests to assess price predictability within a single trading day. We
detect intervals with different degrees of predictability inside a group of
predictable trading days. Our analysis involves examining the duration of
predictability periods in transaction time. We demonstrate that typically
there exists a single predictable interval within a predictable day. It’s
observed that two predictable intervals generally do not occur consecutively.
In other words, following an interval with detected predictability, the
subsequent interval doesn’t display a significant level of predictability.
However, considering all transactions of the SNAP stock (Snap Inc.), we are
able to detect several predictable time intervals going in a row.

In Section 2, we propose a statistical test for investigating the
predictability of symbols of a sequence. Significance of values of entropy
estimation and the Neyman-Pearson statistics are defined by
$\chi^{2}$-distributions with suitable degrees of freedom. In Section 3, we
present a chosen group of assets with a set of characteristics such as mean
price, daily trading volumes, and number of transactions. Section 4.1 is
dedicated to applying the predictability test to prices based on models
involving long memory of order flows. In Section 4.2, we test the
predictability of real data. We measure the predictability of daily time
intervals while considering diverse block lengths, aggregation levels, and
months. Section 4.3 explores the distinguishing factors between predictable
and non-predictable sequences across various stocks and trading days. Section
4.4 investigates the predictability of pairs of price changes. For predictable
days, we localize the presence of predictability inside predictable days in
Section 4.5. Section 5 concludes the paper.

##  2 Statistical tests for randomness of symbolic sequence

We introduce a statistical test designed to evaluate the predictability of a
sequence. The input for a statistical test is a realization $X$ of a
stationary random process $\mathcal{X}$ with symbols from a finite alphabet
$A=\\{0,1,\cdots,s-1\\}$. Symbols of an alphabet with size $s$ can be denoted
by integers from 0 to $s-1$ without loss of generality.

$X=\\{x_{1},x_{2},\dots,x_{n}\\}$

The goal of the test presented in this section is to verify if symbols of the
sequence are independently distributed. Our null and alternative hypotheses
are the following.

$\mathcal{H}_{0}$: The occurrence of a new symbol in sequence $X$ is
independent of the sequence’s prior history.

$\mathcal{H}_{a}$: Appearance of a new symbol depends on past observations of
the sequence $X$.

The test is based on empirical frequencies of blocks of symbols introduced by
Marton and Shields [21]. These empirical frequencies serve to estimate Shannon
entropy, which is utilized as a measure of uncertainty. First, we divide a
sequence by non-overlapping blocks with length $1<k<n$.

$\hat{X}={\hat{x}_{1},\hat{x}_{2},\dots,\hat{x}_{n_{b}}}$

where $\hat{x}_{t}=\\{x_{(t-1)k+1},x_{(t-1)k+2},\dots,x_{tk}\\}$,
$n_{b}=\lfloor\frac{n}{k}\rfloor$. $\hat{x}_{t}$ represents a number from $0$
to $s^{k}-1$ in the numerical system with base $s$. We calculate $s^{k}$
empirical frequencies $\hat{f}_{j}$ of blocks from $\hat{X}$.

$\hat{f}_{j}=\sum_{t=1}^{n_{b}}I(\hat{x}_{t}=a_{j}),a_{j}\in A^{k}$

Here and further $I$ is an indicator function and $a_{j}\neq a_{l}$ when
$j\neq l$. Then, entropy estimation is defined as

$\hat{H}=-\sum_{j=0}^{s^{k}-1}\frac{\hat{f}_{j}}{n_{b}}\ln{\frac{\hat{f}_{j}}{n_{b}}}$

where $\ln()$ is the natural logarithm with the convention $0\ln{0}=0$.
According to [24] the entropy bias defined below (scaled distance from the
maximum of entropy) follows $\chi^{2}$-distribution with $s^{k}-1$ degrees of
freedom if the probabilities of all blocks of symbols, $\hat{x}_{t}$, are
equal.

$B=2n_{b}(k\ln{s}-\hat{H})$ (1)

When all probabilities of blocks of symbols are equal, the process is fully
unpredictable and the entropy attains its maximum, $k\ln{s}$. We can test
unpredictability of a sequence using the entropy bias and the distribution
under the null hypothesis $\chi^{2}_{s^{k}-1}$. If the probabilities of
appearing symbols (blocks with length 1) are not equal, then entropy
estimation $\hat{H}$ has asymptotically normal distribution [24]. The mean and
standard deviation of the normal distribution depend on the entropy value and
probabilities of blocks, see [31, 32].

Now, we propose a statistics with overlapping blocks of symbols that we apply
for testing predictability. For the test, we use the Neyman-Pearson criterion
[33] that contains the likelihood of the sequence under the hypothesis of
unpredictability. We use all blocks with length $0<k-1<n-1$.

$\bar{X}={\bar{x}_{1},\bar{x}_{2},\dots,\bar{x}_{n-k+2}}$

where $\bar{x}_{t}=\\{x_{t},x_{t+1},\dots,x_{t+k-2}\\}$.

We construct statistics in Eq. 2 which has $\chi^{2}$-distribution under
$\mathcal{H}_{0}$. The similar test statistics for Markov chains was
considered by Billingsley [34].

$D=2\sum_{ij}f_{ij}\ln{\frac{(n-k+1)f_{ij}}{f_{\cdot j}f_{i\cdot}}}$ (2)

where $f_{ij}$ is the frequency of the event when a block with the last symbol
$j\in A$ follows by the block numbered by $i$ in the sequence $\bar{X}$ and
$f_{\cdot j}=\sum_{i}f_{ij}$, $f_{i\cdot}=\sum_{j}f_{ij}$; $0\leq i\leq M-1$,
where $M=s^{k-1}$ is the amount of blocks of $k-1$ symbols. We note that
$f_{ij}$ are also empirical frequencies of blocks of $k$ symbols. The
convention is $0\ln{0}=0$ and $0\ln{(0/0)}=0$. The asymptotic distribution of
the statistics $D$ is described in the Lemma provided below.

######  Lemma 1 (Asymptotic distribution of the NP-statistics).

Let’s consider a stationary process with symbols from a finite alphabet
$A=\\{0,1,\cdots,s-1\\}$ and its realization $\\{x_{t}\\}_{t=1}^{n}$. The
empirical frequencies of the k-blocks of the realization are as follows.

$f_{ij}=\sum_{t=1}^{n-k+1}I\left(\bar{x}_{t}=a_{i}\right)I\left(x_{t+k-1}=a_{j}\right),a_{i}\in
A^{k-1},a_{j}\in A$

If the hypothesis of unpredictability, $\mathcal{H}_{0}$, holds true, then the
Neyman-Pearson (NP) statistics (Eq. 2) converges in distribution to $\chi^{2}$
with $(s^{k-1}-1)(s-1)$ degrees of freedom, i.e.,

$2\sum_{ij}f_{ij}\ln{\frac{(n-k+1)f_{ij}}{f_{\cdot
j}f_{i\cdot}}}\xrightarrow[n\to\infty]{d}\chi^{2}\left((s^{k-1}-1)(s-1)\right)$

We take $k=\left[0.5\log_{s}{n}\right]$ as the length of blocks that is proved
to be admissible and suggested to use for estimating empirical frequencies in
[35]222See Sections 2.3.d and 3.2 or [21]. We provide the sketch of proof for
the distribution of $D$ from Eq. 2 and subsequently verify it using Q-Q plots
in Appendix Section A. We show that the proposed test statistics is valid even
if the probabilities of appearing symbols are not equal. It is possible
because of the denominator in Eq. 2 that mitigates differences in the
probabilities of symbols inside the logarithm.

We calculate p-values associated with values of $B$ and $D$ and degrees of
freedom of $\chi^{2}$-distribution. If a p-value is less than $0.01$, we
conclude that the sequence does not exhibit significant predictability with
the significance level $\alpha=0.01$. We reject $\mathcal{H}_{0}$ when
p-value$<0.01$. We call intervals where $\mathcal{H}_{0}$ is rejected
predictable.

The NP-statistics $D$ is similar to the Kullback–Leibler divergence [36]
between empirical probabilities of blocks of symbols and the probabilities
obtained under $\mathcal{H}_{0}$.

$\begin{split}&KL\left(\frac{f_{ij}}{(n-k+1)},\frac{f_{\cdot
j}f_{i\cdot}}{(n-k+1)}\right)=\sum_{ij}\frac{f_{ij}}{n-k+1}\ln{\frac{(n-k+1)f_{ij}}{(n-k+1)f_{\cdot
j}f_{i\cdot}}}\\\
&=\frac{1}{(n-k+1)}\sum_{ij}f_{ij}\ln{\frac{(n-k+1)f_{ij}}{f_{\cdot
j}f_{i\cdot}}}+\sum_{ij}\frac{f_{ij}}{n-k+1}\ln{(n-k+1)}\\\
&=\frac{D}{2(n-k+1)}+\ln{(n-k+1)}\end{split}$

##  3 Dataset

Table 1: Assets and characteristics of prices Asset |  Ticker |  Mean price |  Standard deviation of price |  Daily trading volume |  Daily number of transactions |  Average time between transactions
---|---|---|---|---|---|---
Apple Inc. |  AAPL |  153.47 |  0.93 |  12,184,032 |  136,136 |  0.165
Microsoft Corporation |  MSFT |  251.78 |  1.37 |  4,529,093 |  84,342 |  0.269
Tesla Inc. |  TSLA |  388.02 |  3.81 |  8,686,354 |  178,704 |  0.127
Intel Corporation |  INTC |  30.15 |  0.20 |  7,055,642 |  38,255 |  0.595
Eli Lilly and Company |  LLY |  327.33 |  1.73 |  370,050 |  11,404 |  2.086
Snap Inc. |  SNAP |  10.67 |  0.14 |  4,967,779 |  18,521 |  1.358
Ford Motor Company |  F |  13.93 |  0.10 |  4,468,175 |  12,954 |  1.815
Carnival Corporation & plc |  CCL |  9.24 |  0.12 |  5,874,376 |  15,372 |  1.518
SPDR S&P 500 ETF |  SPY |  390.52 |  1.56 |  9,136,137 |  95,181 |  0.246
Mean price, its standard deviation, trading volume, number of transactions,
and average time between transactions are calculated for each day and then are
averaged over 80 days. Trading volume is summed up for each day. Average time
is given in seconds.

We explore limit order book data [37] downloaded from LOBSTER
(www.lobsterdata.com). We consider the executions of visible and hidden orders
of a group of assets. The chosen stocks represent diverse industries,
differing in characteristics such as average price, volatility, number of
transactions, waiting times between transactions, and trading volumes.
Additionally, the analysis includes the ETF SPY, designed to track the S&P 500
Index. The timeframe under consideration spans from 01.08.2022 to 21.11.2022,
encompassing a total of 80 trading days. Table 1 presents the tickers of all
selected assets along with their respective properties. For each day, the
considered daily time interval is from 9:30 to 16:00, that is 390 minutes in
total. Times of transactions are recorded with the precision of one
nanosecond.

Considering each occurred transaction, we work with data in transaction time
[38]. Discretization is made by distinguishing between positive and negative
returns: $0$ corresponds to price decreasing, $1$ corresponds to price
increasing. Thus, alphabet $A$ is $\\{0,1\\}$ and a symbolic sequence is
obtained according to binary discretization from Eq. 3.

$\begin{split}s^{(2)}_{t}=\begin{cases}0,r_{t}<0,\\\
1,r_{t}>0\end{cases}\end{split}$ (3)

where $r_{t}=\ln{\left(\frac{P_{t}}{P_{t-1}}\right)}$ are price returns and
$P_{t}$ is the price at time $t$. All 0-returns are removed.

##  4 Predictability of limit order book

###  4.1 Modeling ultra-high frequency data

We first apply the proposed method for testing predictability on simulated
data. Executed orders and trade signs are generated using models that
replicate order splitting, herd or chartist behavior, and mean-reverting
process [39, 40, 41]. Positive autocorrelation in order flow was previously
observed in [18] and [39], where authors demonstrated that autocorrelation
diminishes with increasing aggregation by the number of orders. The $\lambda$
model proposed in [40] reproduces the property of the positive autocorrelation
decreasing with the larger time lags. The $\lambda$ model introduces a
fluctuating number of hidden orders that are divided into equal pieces and
submitted gradually. We simulate 80 sequences of signs according to the
$\lambda$ model with the length $10^{5}$ and parameters calibrated in the
paper333The number of hidden orders is $N=21$, the parameter of Pareto
distribution describing volumes is $\alpha=1.63$, and the probability of a new
hidden order is $\lambda=0.38$.. We present the fraction of predictable
sequences for time lags from 1 to 50 in Figure 1(a) for the $\lambda$ model
and two models described below. For small time lags, all sequences are
predictable, then the fraction decreases but not monotonically.

Another explanation of the persistence of the signs is herd behavior [42] when
traders execute their orders according to the price trend, sometimes against
their private information. The model of herd behavior is presented in [43].
The parameters of the calibrated model of this behavior suggest that the
information obtained by the traders are noisy, which creates uncertainty about
the events that occurred. The order driven (OD) model where traders rely on
both a fundamental price value and the history of trades is proposed in [41].
The predictability for order signs (buy/sell orders) of the OD model444The
parameters are taken from the article [44]. These parameters decrease the
impact of noisy traders on the deviations of a price from its fundamental
value. The authors of [44] introduced a modified order flow model
incorporating traders’ learning and adaptation. It was demonstrated by these
authors that price changes within their model display the characteristic of
long memory. drops significantly for time lags larger than 1. However, the
predictability of price directions is quite persistent for increasing
aggregation level in the amount of transactions as shown in Figure 1(b). An
aggregation level is a number of transactions taken as one time step. All 80
sequences generated by the OD model are predictable for aggregation levels
from 1 to 50 due to the high probability that the price changes the direction
in the next time step.

Lastly, we consider the trade superposition (TS) model proposed in [39]. This
model posits that each price change results from previous trades, with a
specific trade’s impact defined by a propagator that diminishes over
time555The model’s parameters, sourced from the paper, specify the propagator
as $\frac{2.8\times 10^{-3}}{(l+20)^{0.42}}$. The logarithm of volumes follows
a normal distribution $N(5.5,1.8)$ and the noise terms have a standard
deviation of $0.01$.. Figures 1(a) and 1(b) display the fractions of
predictable sequences for order signs and price returns, respectively, based
on the TS model.

(a)

(b)

Figure 1: Fraction of predictable days for the $\lambda$, OD, TS model from
[40, 41, 39]. The x-axis for (a) is the time lag, which signifies the
transaction time between order signs. The x-axis for (b) is the aggregation
level, denoting the number of transactions considered as one step to compute
price returns.

###  4.2 Analysis of real data

Our analysis of real data commences by examining the limit order book of the
AAPL stock. We focus on August 1 and August 2 of the year 2022 to demonstrate
the behavior of the NP-statistics $D$ and entropy bias $B$ concerning various
block lengths. Figure 2 illustrates the duration in seconds before each
transaction for these two specific days.

(a)

(b)

Figure 2: Time in seconds between each transaction during two trading days,
01-02.08.2022

Figure 3 illustrates the NP-statistics with 99% confidence bounds associated
with $\mathcal{H}_{0}$. The mean value of the $\chi^{2}$-distribution of the
NP-statistics under $\mathcal{H}_{0}$ represents the degrees of freedom. In
Figure 4, entropy bias with corresponding confidence intervals is given. For
all values of $k$, sequences are predictable according to the statistics $B$
and $D$. On August 1, the most frequent block with length $2\leq k\leq 5$ is a
sequence of 0s. However, for $k=6,7$ the most frequent block is a repetition
of 1. On August 2, the most frequent blocks for corresponding values of $k$
are 00 and 000. When $4\leq k\leq 8$ the most frequent event is the repetition
of $1$ $k$ times. This observation aligns with the well-documented long memory
associated with return signs.

(a)

(b)

Figure 3: NP-statistics for different $k$ for AAPL stock

(a)

(b)

Figure 4: Entropy bias for different $k$ for AAPL stock

Our interest lies in identifying additional factors contributing to
predictability beyond symbol repetition due to long memory. Consequently, we
proceed by analyzing aggregated high-frequency data. We use transaction time,
that is, we aggregate by a number of transactions. We record the last
available price for each time step. We examine the predictability of assets
over several months and with different aggregation levels. We plot the
fraction of days which is classified as predictable for the four months under
consideration in Fig. 5.

(a)

(b)

Figure 5: Fraction of predictable days for different months and aggregation
levels according to (a) NP-statistics and (b) entropy bias

There is a noticeable amount of days without predictable patterns even without
data aggregation for a group of stocks (INTC, SNAP, F, CCL). As the
aggregation level increases, there’s a decrease in the fraction of predictable
days, although not in a strictly monotonous manner. We couldn’t establish a
clear correlation between the predictability of assets and the trading months.
For instance, a higher level of aggregation is required in August to diminish
the predictability of SNAP price. That is, August displays a greater number of
days with significant predictability in price returns compared to the autumn
months. October stands out as the month with the highest number of predictable
days for TSLA. The results obtained from the NP-statistics and entropy bias
suggest that the largest fraction of predictable days for INTC and CCL is
observed in November.

With a given precision of nanoseconds, some transactions happen at the same
time. These simultaneous events might represent scenarios where the volume of
a market order surpasses the volume of the best buy or sell limit order.
Another scenario involves automatic execution of market orders from different
traders at a specific price. To mitigate the impact of such events on the
analysis, we aggregate volumes and consider the final available price for each
nanosecond showcasing trading activity.

Figure 6 presents the fraction of predictable days for two statistics and two
datasets: full record of transactions and with aggregated transactions in each
nanosecond. The exclusion of simultaneous transactions leads to a reduction in
the predictability of price return signs.

The empirical findings from Figures 5 and 6 indicate a noticeable decrease in
the degree of predictability as the aggregation level of transactions
increases. The decay of predictability over aggregation level fits with
results obtained for the simulated data by the TS model by Bouchaud et al.
[39].

Figure 6: Fraction of predictable days for different assets with and without
simultaneous transactions

###  4.3 Statistics of predictable time intervals

Bouchaud et al. [45] investigated statistical properties of the limit order
books of several stocks. In particular, the authors stated that the
distribution of changes in limit order prices exhibits a power-law tail. Engle
and Russell [46] noted that the longest duration between transactions appeared
in the middle of trading days. According to the authors, clustering of
transactions appears because of the size of bid-ask spread and gathering of
informed traders. U-shapes of frequencies of large trades, small trades, and
market orders were also discovered in [47]. In another paper by Engle [48], he
showed that intraday volatility has the similar pattern and attains its
minimum in the middle of a trading day. Moreover, significant coefficients of
ARMA(1,1) model were detected. Highly dependent microstructure noise was
stated by [49]. According to [50], changes in stock prices between
transactions are associated with trading volumes. Some stylized facts
including fat tails of price returns, volatility clustering, and leverage
effect were discussed in [51]. For a more comprehensive understanding and
detailed discussions regarding market and limit orders, we refer to works [37,
47, 52].

We show that some assets exhibit unpredictable prices for a part of days. Now,
we consider different parameters of price returns time series and check if
there is a dependence between them and predictability. The list of parameters
follows.

  * •

First, we calculate the amount of non-zero returns that is the length of the
symbolized sequence and the fraction of 0-returns.

  * •

Then, we record lengths of blocks, $k$. The amount of price returns used as
past observations to test the independence is $k-1$.

  * •

We compute empirical probabilities of observing blocks with the same symbols
$(\hat{p}(0\dots 0)+\hat{p}(1\dots 1))$ to determine if predictability appears
because the price moves in the same direction. We multiply the sum of two
empirical probabilities by $2^{k}$ to vanish the difference for different
values of $k$.

  * •

We calculate $|\hat{p}(1)-\hat{p}(0)|$ to check if predictability is caused by
the difference in the amount of price increases and decreases during a trading
day. We also write down the magnitude of daily changes in a price to determine
if predictability appears when the price significantly changes. For the same
purpose, we record the mean value of price returns.

  * •

We are interested in autocorrelation of non-zero returns as well as in
autocorrelation of their magnitude values. The autocorrelation of magnitudes
is a proxy for volatility clustering.

  * •

Then, we consider the distribution of price returns. We fit empirical price
returns distribution666Here, we use scipy.stats.t.fit in Python. and record
the degrees of freedom $\nu$, scale, and shift parameters. The smaller value
of $\nu$, the fatter tails of price returns.

  * •

We are interested in whether there is a significant difference in trading
volumes.

  * •

We also compare the fraction of jumps detected among all price returns. For
the detection of jumps, we use the method described by [53]. To employ this
test at ultra-high frequency data, we average price returns as suggested by
[54].777We use the square root of the amount of price returns as the window
size used in the method [53]. The method [54] requires pre-averaging of price
returns. We use the same number of transactions for aggregation and pre-
averaging. Jumps are defined with the significance level of $1\%$.

We conduct a statistical test to examine the differences in mean values
between predictable and unpredictable days. A p-value below 0.05 indicates a
significant difference with a 95% confidence level. In the case of AAPL stock,
all 80 days are determined as predictable using the NP-statistics, while 79
predictable days are detected via entropy estimation. To collect days where
the hypothesis of unpredictability can not be rejected, we aggregate price
returns. We start from the aggregation level $a=15$. Mean values of the
specified parameters for AAPL stock are presented in Table 2, while Table 3
displays the parameter comparison between predictable and unpredictable days
for all assets.

Table 2: Statistics for predictable and not predictable days of AAPL with $a=15$. parameter |  mean for predictable days |  mean for not predictable days |  p-value
---|---|---|---
Sample size (number of days) |  35 |  45 |
number of non-zero returns |  5225 |  4370 |  0.009**
fraction of 0-returns |  0.142 |  0.138 |  0.320
$k$ |  6 |  5.889 |  0.118
$(\hat{p}(0\dots 0)+\hat{p}(1\dots 1))2^{k}$ |  3.084 |  2.635 |  3.152$\times 10^{-5}$**
$|\hat{p}(1)-\hat{p}(0)|$ |  0.051 |  0.050 |  0.874
magnitude of daily log-price increment |  0.017 |  0.012 |  0.093
mean price returns |  2.185$\times 10^{-7}$ |  -6.673$\times 10^{-7}$ |  0.315
magnitude of autocorrelation of non-zero returns |  0.044 |  0.027 |  0.002**
magnitude of autocorrelation of absolute values |  0.115 |  0.088 |  0.007**
$\nu$ of t-distribution |  2.220 |  2.694 |  0.31
scale of t-distribution |  1.367$\times 10^{-4}$ |  1.464$\times 10^{-4}$ |  0.195
magnitude of shift of t-distribution |  9.082$\times 10^{-6}$ |  9.991$\times 10^{-6}$ |  0.519
daily volume |  13,367,901 |  11,257,199 |  0.026*
fraction of jumps |  1.934$\times 10^{-4}$ |  1.367$\times 10^{-4}$ |  0.262
In the last column, * is rejection of equal means with 0.05 significance and ** stands for 0.01 significance. Table 3: Statistics for predictable and not predictable days parameter | AAPL |  | MSFT | TSLA | INTC | LLY | SNAP | F | CCL | SPY
---|---|---|---|---|---|---|---|---|---|---
aggregation level | 10 | 30 | 10 | 25 | 2 | 5 | 1 | 1 | 1 | 5
number of predictable days | 35 | 3 | 26 | 35 | 44 | 44 | 53 | 41 | 38 | 29
number of non-zero returns |  $>$** |  |  $>$** |  $>$* |  $>$** |  $>$** |  $>$** |  $>$** |  $>$* |  $>$*
fraction of 0-returns |  |  |  |  |  |  |  $>$* |  $>$** |  $>$** |
$k$ |  |  $>$** |  |  |  |  $>$* |  |  $>$** |  $>$* |
$(\hat{p}(0\dots 0)+\hat{p}(1\dots 1))2^{k}$ |  $>$** |  |  $>$** |  $>$** |  $>$** |  $>$** |  |  |  |  $>$**
magnitude of daily log-price increment |  |  |  |  |  |  |  |  $>$** |  |
mean price returns |  |  |  |  |  |  |  $>$* |  |  $>$* |
magnitude of autocorrelation of non-zero returns |  $>$** |  |  |  $>$** |  $>$** |  $>$** |  $>$** |  $>$** |  $>$** |  $>$**
magnitude of autocorrelation of absolute values |  $>$** |  $<$** |  |  |  |  |  $>$** |  $>$* |  $>$** |
$\nu$ of t-distribution |  |  $<$* |  |  |  |  |  |  $>$* |  $>$** |  $<$*
scale of t-distribution |  |  $<$* |  |  |  |  $<$* |  $<$* |  |  |
daily volume |  $>$* |  |  $>$** |  |  $>$* |  $>$** |  $>$** |  $>$** |  $>$** |  $>$*
fraction of jumps |  |  $<$** |  |  |  |  |  |  |  $>$* |
* is rejection of equal means with 0.05 significance and ** stands for 0.01 significance, $>$ stands for larger mean for predictable days, $<$ stands for larger mean for not predictable days. There is no significant difference found for parameters $|\hat{p}(1)-\hat{p}(0)|$ and magnitude of shift of t-distribution. For AAPL stock, the results for two aggregation levels are shown.

Predictable days exhibit significantly higher amounts of price movement and
trading volumes. Additionally, autocorrelation values for non-zero returns and
their magnitudes are notably higher on predictable days. Moreover, the
probability of repeating the same symbol is significantly elevated during days
with predictable price returns. To mitigate predictability resulting from the
persistence of signs, we increase the aggregation level. With an aggregation
level of $a=30$ only three days (02.08, 20.09, 05.10) are identified as
predictable.

Then, we divide days into two groups after aggregating by $a=30$ using the
test-statistics $B$ derived from entropy estimation from Eq. 1. There are 14
predictable days, the results are given in Table 5 in Appendix Section B. Even
after aggregation by $30$ transactions, the predictable days have a higher
probability of repeating the direction of the price. They are also
characterized by the larger difference in frequencies of increasing and
decreasing of price. To mitigate the difference, the median of price returns
could be used instead of zero during the discretization process by Eq. 3.
Further, we use NP-statistics $D$ that takes into consideration the difference
between frequencies of symbols by design.

For the Microsoft stock, we discover 26 predictable days after aggregating
data by $a=10$ transactions. According to the test for the difference in mean
value of $(\hat{p}(0\dots 0)+\hat{p}(1\dots 1))2^{k}$, the price direction is
more persistent for predictable days. With a slightly larger aggregation level
of $a=15$, this difference is eliminated and only four predictable days
remain. These days are listed in Table 8 in Appendix Section B.

For the stock TSLA, we identify 35 predictable days with aggregation $a=25$.
On these days, we observe a higher number of price changes, a stronger
autocorrelation of non-zero returns, and increased probabilities of blocks
repeating a symbol. Increasing the aggregation level by 5, we observe that the
probability of repeating a symbol is significantly high even when $a=60$.
However, by further increasing the aggregation level to $a=65$, only 4
predictable days remained (05.08, 14.09, 15.09, 08.11), and the previously
significant differences disappeared. Regarding the influence of news on price
predictability, it’s worth noting that on August 5, Tesla shareholders
approved a 3-1 stock split. On September 14, Tesla faced a lawsuit for false
advertising of its autopilot technology. Additionally, on November 8, Tesla
recalled over 40 thousand cars888The news are taken from edition.cnn.com and
reuters.com.. These instances of significant events or news might be
associated with predictable price behavior at high frequencies. Traders tend
to react more actively to new information, leading to increased trading
activity reflected in price changes and higher trading volumes. In general,
high trading activity observed during predictable days across all considered
assets suggests a possible connection between predictability and the arrival
of news or significant events. For a more in-depth exploration of how prices
react to news, we refer to review [55].

For the stock INTC, we identify 44 predictable days using the aggregation
level of $a=2$ transactions. These days notably differ in terms of daily
changes and autocorrelation of returns. However, as we increase the
aggregation level to $a=7$ transactions, only 8 predictable days remained,
characterized by significantly higher amounts of non-zero returns. At an
aggregation level of $a=10$, the only predictable day is October 13. For the
stock LLY, the set of different characteristics is similar to the case of INTC
when $a=5$. At a higher aggregation level of $a=10$ transactions, only three
predictable days (03.08, 29.09, 28.10) are found with significantly high
probability of repeating symbols.

For the stock of Snapchat, we find 53 predictable days without employing
aggregation. These predictable days do not exhibit a large probability of
repeating symbols. The distinguishing features of predictable days are a
larger fraction of 0-returns, an increased mean return, a high autocorrelation
of returns and their absolute values, and a smaller scale of fitted
t-distribution. The case of the stock CCL is the only one where the percentage
of price jumps is significant and higher for predictable days. We present the
results for the stock CCL in Table 6 in Appendix Section B. Last, we consider
the price of the ETF SPY with $a=5$ in Table 7 in Appendix Section B. We
discover that price returns of predictable days have fatter tails than returns
of unpredictable days. Using the aggregation level $a=10$, we remain with 9
predictable days presented in Table 8 with no significant difference in
probabilities of repeating symbols.

###  4.4 Predictability of pairs of signs

For the majority of considered assets, we find that predictability is
associated with a high frequency of blocks with the same price direction.
However, for three stocks, SNAP, F, CCL, we fail to detect the high frequency
of blocks $0\dots 0$ and $1\dots 1$ without aggregation of prices. Here, we
consider the three stocks to test if a price direction depends on the previous
recorded decrease or increase. In other words, we test $\mathcal{H}_{0}$
setting $k=2$ and estimate $p(00)+p(11)$ for predictable and not predictable
days. A summary table is Table 4. For all three stocks we detect a significant
difference in $\hat{p}(00)+\hat{p}(11)$ for the two groups of days. However,
the sum of two probabilities is less than $0.5$ for predictable days. That is,
the probability of changing price direction is significantly high for
predictable days. Therefore, predictable days are more likely to have a
pattern of changing symbols indicating an increase or decrease in price.

Table 4: Probabilities of repeating symbols for predictable and not predictable days Stock |  N. of predictable days |  $\hat{p}(00)+\hat{p}(11)$ for predictable days |  $\hat{p}(00)+\hat{p}(11)$ for unpredictable days |  p-value for difference in mean values
---|---|---|---|---
SNAP |  36 |  0.469 |  0.501 |  0.0014
F |  25 |  0.460 |  0.493 |  2.671$\times 10^{-10}$
CCL |  27 |  0.478 |  0.5 |  0.044

The number of predictable days is fewer when considering $k=2$ compared to the
value of $k=\left[0.5\log_{s}{n}\right]$, where $n$ represents the length of a
symbolic sequence. As the number of symbols used to test dependence on past
history increases, more days exhibit predictability. The probability of
repeating the same symbol is approximately 0.5 for unpredictable days, whereas
it is notably smaller for predictable days. However, this characteristic of
predictable days for the three stocks diminishes as $k$ increases to around 5
or 6 as indicated in Table 6. That is, a pattern of switching direction with
each price movement tends to last for less than 5 price changes on average.

###  4.5 Localization of predictable intervals

In this section, we consider the length of the interval used to detect
predictability. In previous sections, we investigate daily time intervals. The
key question here is whether there exists a smaller time interval within a
predictable day where significant predictability can be identified. The
motivation for searching for the smaller interval is to localize the period
when price predictability occurs. Additionally, using a smaller time interval
necessitates less historical data for computing entropy-based estimations.
Therefore, employing a smaller rolling window enables quicker detection of
price predictability.

Since rolling window inside a trading day implies multiple tests, the Šidák
correction [30] of the significance level is used. Moreover, to ensure
independence among the conducted tests, non-overlapping intervals within a
trading day are considered. The maximum value of considered partitions is
$S_{max}=\lfloor(n-k+1)/1000\rfloor$, so that $1000$ is the minimum length of
intervals. For each trading day, we aim to detect predictability for at least
1 from $S$ partitions with significance level $1-0.99^{1/S}$. We record the
maximum value of such $S\leq S_{max}$. Smaller intervals require a smaller $k$
for analysis. We present the results in Table 8 in Appendix Section B.

There are three days for AAPL stock where predictability is detected when the
data is aggregated. For all three days predictability is detected only for
daily time intervals ($S=1$). For the MSFT stock, there are three days where
predictability is detected only for the part of the day ($S>1$). Regularity
patterns are detected at the end of the day for August 3 and October 26. For
August 5, predictability is presented for the first half of the day. It
disappears at the next subsequent non-overlapping interval. Regarding TSLA
stock, detectable predictability was identified in both halves of the day on
August 5, indicating the potential to reduce the sequence length for
predictability analysis by half and still observe significant patterns
throughout the day. For the stock SNAP, we detect days when predictable time
intervals occur several times during a day. We notice that some predictable
intervals cluster together and highlight such intervals in the Table 8. For
instance, we observe 7 predictable intervals going in a row on October 21 and
24. For 13 out of 30 days where $S_{max}>1$ for the Ford stock, the
predictability can be found in the second half of a day. Similarly, there are
14 days in the sample of 31 days with $S_{max}>1$ where the predictability is
detected only in the second part of a trading day for CCL. For each
predictable day of the ETF SPY, there is only one from $S$ intervals where
predictability is found. Predictability disappears from the time interval to
the next subsequent non-overlapping interval. For instance, predictability was
noticeable in the middle of the trading day on August 17.

##  5 Discussion and Conclusions

We have applied a statistical test for the randomness of a symbolized
sequence. A short summary of the method for detecting predictability is given
below.

  * •

First, we estimate the Shannon entropy using empirical frequencies of blocks
of symbols as suggested in [21]. Using empirical frequencies obtained by
rolling a window with a certain length, we the calculate the NP-statistics.

  * •

The NP-statistics has $\chi^{2}$-distribution according to [34] and [56]. We
have found degrees of freedom of the $\chi^{2}$-distribution that depends on
the length of blocks and the size of the alphabet.

  * •

The statistics is scaled and shifted KL-divergence [36] that measures
difference between empirical probabilities and theoretical probabilities under
the null hypothesis of unpredictability.

  * •

The method is computationally fast since it requires only the empirical
frequencies of blocks of symbols.

We have studied the predictability of asset prices at ultra-high frequency.
Considering signs of price changes, we construct binary sequences for all
recorded executed transactions. The signs of trades have a long memory in such
a microscopic view of transaction data [18, 39]. We have shown that the degree
of predictability decreases with the increase of aggregation level. We apply
aggregation by the number of transactions and work with transaction time.
Transaction times have an uneven time intervals in seconds, which has been
empirically shown by [46, 47]. We have shown that the significant
predictability level decreasing with larger aggregation level can be explained
by splitting hidden orders into pieces as modeled by [40] or by mean reverting
as modeled in [39]. According to [18, 39], such type of predictability does
not lead to arbitrage opportunities because it is compensated by fluctuations
in transaction costs and liquidity and by interaction between market makers
and informed traders. We have also demonstrated that transactions appearing
simultaneously with the precision of a nanosecond contribute to a larger
predictability level.

We apply the correction proposed in [30] to make multiple tests for
predictability for short intervals during predictable days. In most cases, a
single predictable interval is identifiable by partitioning a day into uniform
intervals based on transaction time. In such a way, we determine both the
position of this interval relative to the time of day and its duration. For
the stock SNAP, we have found several groups of such predictable intervals
following each other.

Applying the test, we distinguish predictable days from not predictable days.
We have shown that the probability that the price of an asset has several
subsequent movements in the same direction is one of the factors affecting the
predictability of the prices. For a group of assets, predictable days are
characterized by repeating signs of price returns. Except LLY, trades on these
assets appear at extremely high frequencies, i.e., less than one second on
average. The repetition of price direction is explained by the appearance of
news, the reaction to them, and the splitting of one order into parts [57,
58]. Conversely, another group of stocks (SNAP, F, CCL) demonstrated a lower
percentage of predictable days before aggregation. In these cases, days
featuring predictable time intervals were characterized by a significantly
reduced probability of price moving in the same direction twice. This group
differs by relatively low prices and their standard deviations. The pattern of
changing price direction can be explained by a bid-ask bounce and fluctuations
of the price around a low mean value. We presume that the occurrence of this
behavior depends on the frequency of transactions.

For 8 out of 9 assets under consideration, non-zero price returns during
predictable days have high autocorrelation. Highly significant coefficients of
an AR model for tick-by-tick data were empirically investigated by [48] and
[49]. Some stylized facts of price returns at ultra-high frequency data
including fat tails of return distribution and volatility clustering were
discussed in [51]. To explore fat tails of price returns, we estimate degrees
of freedom of the fitted t-distribution of the price returns. For the ETF SPY,
we discover that price returns of predictable days have fatter tails than
returns recorded during not predictable days. However, we have the opposite
result for the stocks of Ford and Carnival Corporation, where not predictable
days are described by price returns with fatter tails. We check volatility
clustering by measuring the autocorrelation of the absolute values of returns.
The autocorrelation is significantly greater during predictable days for the
stocks AAPL, SNAP, F, and CCL.

We notice that predictable days of AAPL, MSFT, INTC, LLY, F, CCL, and SPY are
characterized by larger trading volumes and the larger amount of non-zero
price changes in comparison with not predictable days. This distinction in
characteristics suggests a correlation between predictability and trading
activity, particularly in response to market news events. This assumption
aligns with existing research demonstrating the influence of news on stock
prices. Stock prices react to announcements about stock dividends and splits
[59]. Weekly price returns react to attention to news and their tone [60].
Public news affect monthly price returns [61].

We have presented the approach for testing predictability of financial data.
Using this approach, we find days with a statistically significant level of
predictability. Aggregating the data so that the time between the transactions
under consideration increases, we allocate a smaller group of days with
predictability. Various methods exist for aggregating data, including calendar
time, transaction time, and tick time. Alternative approaches involve counting
volumes traded and price changes by a certain amount. A direction for future
exploration involves comparing the predictability observed in data aggregated
through diverse methodologies.

##  Appendix A Asymptotic distribution of the Neyman-Pearson statistics

Figure 7: QQ plot for entropy bias when probabilities of symbols are equal

We outline the proof of Lemma 1. The lemma gives the asymptotic distribution
of the statistics $D$ in Eq. 2 based on empirical frequencies of blocks of
symbols of a sequence. If symbols of sequence $X=\\{x_{t}\\}_{t=1}^{n}$ are
independently distributed, then the sequence $\bar{X}$ of blocks
$\bar{x}_{t}=\\{x_{t},x_{t+1},\dots,x_{t+k-2}\\}$ follows the first order
Markov process. The transition matrix of the Markov chain has dimension
$M\times M$, where $M=s^{k-1}$. However, there are only $s$ non-zero
probabilities whose sum is equal to one in each row of the matrix. Thus, the
transition matrix can be converted into $M\times s$ matrix with only positive
entries. This transformation is feasible since an output $\bar{x}_{t}$ in
sequence $\bar{X}$ differs from $\bar{x}_{t-1}$ solely by a single new symbol
$x_{t+k-2}\in A$.

We denote by $p_{ij}$ transition probability from the block of symbols
$i\in\\{0,1,\dots,M-1\\}$ to the block with the last symbol $j\in A$. The null
hypothesis $\mathcal{H}_{0}$ can be restated as $p_{ij}=p_{j}$, indicating
that the probability of obtaining a new symbol does not rely on the previous
$k-1$ symbols. Thus, the hypothesis $\mathcal{H}_{0}$ assumes the transition
matrix with the following structure.

$T=\begin{bmatrix}p_{0}&p_{1}&\dots&p_{s-1}\\\ p_{0}&p_{1}&\dots&p_{s-1}\\\
\vdots&\vdots&\ddots&\vdots\\\ p_{0}&p_{1}&\dots&p_{s-1}\end{bmatrix}$

The asymptotic distribution of the Neyman-Pearson statistics (Eq. 2) is
$\chi^{2}$-distribution that can be shown using a characteristic function
[56]. There are $s$ probabilities with the sum of 1 in each of $M$ rows in the
matrix $T$ and it contains $s$ parameters with one constraint. Therefore, the
degrees of freedom of the NP-statistics are $M(s-1)-(s-1)=(M-1)(s-1)$
according to Theorem 4.1 of [34].

Then, we empirically show that the entropy bias (Eq.1) and the NP-statistics
(Eq.2) follow $\chi^{2}$-distribution with $s^{k}-1$ and $(s^{k-1}-1)(s-1)$,
respectively. As defined in the main text, $s$ is the size of the alphabet and
$k$ is the length of blocks. We consider alphabets with 2,3,4 symbols and take
sequences with three different lengths, $\log_{10}n=2,3,4$. The length of
blocks depends on the sequence length, $k=\left[0.5\log_{s}{n}\right]$. For
each plot we simulate $N=10^{5}$ sequences. We provide the QQ-plot for entropy
bias in Figure 7.

The next two Figures show the QQ plots for calculated NP-statistics. For
Figure 8, sequences have equal probabilities of appearing symbols. In
contrast, Figure 9 displays the scenario where the probability of symbol 0 is
twice as great as the probabilities of other symbols. These figures
demonstrate the convergence of the empirical distribution of $D$ to the
theoretical $\chi^{2}$-distribution.

Figure 8: QQ plot for NP-statistics when probabilities of symbols are equal
Figure 9: QQ plot for NP-statistics when probability of symbol 0 is twice that
of another symbol

##  Appendix B Statistics and partitions of predictable days

This section comprises results pertaining to statistics derived from
predictable and not predictable days. The results for the stock AAPL using
entropy bias are in Table 5. Detailed results for the stock CCL and ETF SPY
are provided in Tables 6 and 7, respectively. Finally, Table 8 shows
partitions based on the test of randomness conducted for intervals of
predictable days.

Table 5: Statistics for predictable and not predictable days of AAPL determined by entropy bias with $a=30$. parameter |  mean for predictable days |  mean for not predictable days |  p-value
---|---|---|---
Sample size (number of days) |  14 |  66 |
number of non-zero returns |  2685 |  2454 |  0.177
fraction of 0-returns |  0.100 |  0.094 |  0.143
$k$ |  6 |  5.758 |  7.594 $\times 10^{-5}$**
$(\hat{p}(0\dots 0)+\hat{p}(1\dots 1))2^{k}$ |  3.033 |  2.462 |  0.013*
$|\hat{p}(1)-\hat{p}(0)|$ |  0.068 |  0.039 |  0.003**
magnitude of daily log-price increment |  0.015 |  0.014 |  0.952
mean price returns |  -3.124$\times 10^{-7}$ |  -6.043$\times 10^{-7}$ |  0.874
magnitude of autocorrelation of non-zero returns |  0.0299 |  0.0297 |  0.966
magnitude of autocorrelation of absolute values |  0.079 |  0.093 |  0.208
$\nu$ of t-distribution |  2.656 |  3.426 |  0.435
scale of t-distribution |  1.843$\times 10^{-4}$ |  2.156$\times 10^{-4}$ |  0.04*
magnitude of shift of t-distribution |  1.609$\times 10^{-5}$ |  1.204$\times 10^{-5}$ |  0.11
daily volume |  12,788,633 |  12,048,587 |  0.438
fraction of jumps |  2.093$\times 10^{-4}$ |  1.685$\times 10^{-4}$ |  0.682
In the last column, * is rejection of equal means with 0.05 significance and ** stands for 0.01 significance. Table 6: Statistics for predictable and not predictable days of CCL with $a=1$. parameter |  mean for predictable days |  mean for not predictable days |  p-value
---|---|---|---
Sample size (number of days) |  38 |  42 |
number of non-zero returns |  2626 |  2195 |  0.018*
fraction of 0-returns |  0.695 |  0.660 |  0.0007**
$k$ |  5.816 |  5.595 |  0.04*
$(\hat{p}(0\dots 0)+\hat{p}(1\dots 1))2^{k}$ |  2.5 |  2.25 |  0.118
$|\hat{p}(1)-\hat{p}(0)|$ |  0.0205 |  0.0203 |  0.956
magnitude of daily log-price increment |  0.037 |  0.027 |  0.1
mean price returns |  1.735$\times 10^{-6}$ |  -1.491$\times 10^{-6}$ |  0.016*
magnitude of autocorrelation of non-zero returns |  0.132 |  0.081 |  0.001**
magnitude of autocorrelation of absolute values |  0.286 |  0.234 |  0.001**
$\nu$ of t-distribution |  1.816 |  1.356 |  0.002**
scale of t-distribution |  1.281$\times 10^{-5}$ |  2.868$\times 10^{-5}$ |  0.226
magnitude of shift of t-distribution |  1.672$\times 10^{-7}$ |  4.625$\times 10^{-7}$ |  0.194
daily volume |  7,087,714 |  4,776,277 |  0.0001**
fraction of jumps |  0.018 |  0.016 |  0.049*
In the last column, * is rejection of equal means with 0.05 significance and ** stands for 0.01 significance. Table 7: Statistics for predictable and not predictable days of SPY with $a=5$. parameter |  mean for predictable days |  mean for not predictable days |  p-value
---|---|---|---
Sample size (number of days) |  29 |  51 |
number of non-zero returns |  12764 |  10778 |  0.04*
fraction of 0-returns |  0.170 |  0.168 |  0.669
$k$ |  6.862 |  6.745 |  0.217
$(\hat{p}(0\dots 0)+\hat{p}(1\dots 1))2^{k}$ |  2.881 |  2.539 |  8.075$\times 10^{-5}$**
$|\hat{p}(1)-\hat{p}(0)|$ |  0.015 |  0.013 |  0.417
magnitude of daily log-price increment |  0.011 |  0.008 |  0.214
mean price returns |  -1.464$\times 10^{-7}$ |  1.080$\times 10^{-7}$ |  0.196
magnitude of autocorrelation of non-zero returns |  0.026 |  0.018 |  0.009**
magnitude of autocorrelation of absolute values |  0.086 |  0.089 |  0.76
$\nu$ of t-distribution |  1.988 |  2.245 |  0.031*
scale of t-distribution |  5.531$\times 10^{-5}$ |  5.467$\times 10^{-5}$ |  0.792
magnitude of shift of t-distribution |  9.444$\times 10^{-7}$ |  8.551$\times 10^{-7}$ |  0.544
daily volume |  10,155,452 |  8,554,678 |  0.037*
fraction of jumps |  4.187$\times 10^{-4}$ |  5.052$\times 10^{-4}$ |  0.147
In the last column, * is rejection of equal means with 0.05 significance and ** stands for 0.01 significance. Table 8: Partition of predictable days stock | day | $S_{max}$ | $S$ |  N. $\in[1,S]$
---|---|---|---|---
AAPL($a=30$) | 02.08, 05.10 | 2 | 1 | 1
20.09 | 3 | 1 | 1
MSFT($a=15$) | 03.08 | 4 | 4 | 4
05.08 | 3 | 2 | 1
26.10 | 8 | 2 | 2
28.10 | 4 | 1 | 1
TSLA($a=65$) | 05.08 | 2 | 2 | 1,2
14.09,15.09, 08.11 | 1 | 1 | 1
SNAP($a=1$) | 23.09,26.09,27.09,03.11 | 2 | 1 | 1
15.09,08.11 | 2 | 2 | 1
03.08,05.08,08.08,12.08,22.08, 14.09,03.10,12.10,28.10,14.11 | 2 | 2 | 1,2
01.08,04.08,09.08,10.08,19.08, 12.09,28.09,17.10,31.10 | 2 | 2 | 2
09.09,15.11 | 3 | 1 | 1
21.09 | 3 | 3 | 1
06.09 | 3 | 3 | 1,2
16.08,10.11,11.11 | 3 | 3 | 1,3
18.08 | 3 | 3 | 2,3
02.08,27.10 | 3 | 3 | 1,2,3
15.08,06.10 | 3 | 3 | 3
11.08 | 4 | 2 | 1
17.08 | 4 | 3 | 2
01.11 | 4 | 4 | 3,4
07.09,26.10 | 4 | 4 | 4
08.09 | 5 | 5 | 2
20.10 | 5 | 5 | 2,3,4,5
25.10 | 5 | 5 | 3,5
01.09 | 5 | 5 | 4,5
21.10,24.10 | 7 | 7 | 1,2,3,4,5,6,7
31.08 | 10 | 10 |  1,4,5,10
SPY($a=10$) | 17.08 | 5 | 5 | 3
30.08 | 6 | 1 | 1
26.08,18.10 | 7 | 1 | 1
01.09,02.09 | 7 | 2 | 2
29.09 | 8 | 1 | 1
10.11 | 9 | 1 | 1
13.10 | 14 | 10 | 10
Consecutive intervals for one day are in bold. For the stock SNAP, the results
where days with $S_{max}=1$ are omitted.

## References

  * [1] Andrew W Lo, Harry Mamaysky, and Jiang Wang.  Foundations of technical analysis: Computational algorithms, statistical inference, and empirical implementation.  The journal of finance, 55(4):1705–1765, 2000.
  * [2] Cheol-Ho Park and Scott H Irwin.  What do we know about the profitability of technical analysis?  Journal of Economic surveys, 21(4):786–826, 2007.
  * [3] Po-Hsuan Hsu, Mark P. Taylor, and Zigan Wang.  Technical trading: Is it still beating the foreign exchange market?  Journal of International Economics, 102:188–208, 2016.
  * [4] Robert Hudson and Andrew Urquhart.  Technical trading and cryptocurrencies.  Annals of Operations Research, 297(1):191–220, 2021.
  * [5] Erdinc Akyildirim, Aurelio F Bariviera, Duc Khuong Nguyen, and Ahmet Sensoy.  Forecasting high-frequency stock returns: A comparison of alternative methods.  Annals of Operations Research, 313(2):639–690, 2022.
  * [6] Rodrigo C. Brasileiro, Victor L.F. Souza, and Adriano L.I. Oliveira.  Automatic trading method based on piecewise aggregate approximation and multi-swarm of improved self-adaptive particle swarm optimization with validation.  Decision Support Systems, 104:79–91, 2017.
  * [7] R. David Mclean and Jeffrey Pontiff.  Does academic research destroy stock return predictability?  The Journal of Finance, 71(1):5–32, 2016.
  * [8] Andrew W Lo.  The adaptive markets hypothesis: Market efficiency from an evolutionary perspective.  Journal of Portfolio Management, Forthcoming, 2004.
  * [9] Xin Guo, Tze Leung Lai, Howard Shek, and Samuel Po-Shing Wong.  Quantitative trading: algorithms, analytics, data, models, optimization.  CRC Press, 2017.
  * [10] L. Molgedey and W. Ebeling.  Local order, entropy and predictability of financial time series.  European Physical Journal B, 15:733–737, 2000.
  * [11] A. Dionisio, R. Menezes, and D Mendes.  An econophysics approach to analyse uncertainty in financial markets: an application to the portuguese stock market.  The European Physical Journal B, 50:161–164, 2006.
  * [12] K. Ahn, D. Lee, S. Sohn, and B. Yang.  Stock market uncertainty and economic fundamentals: an entropy-based approach.  Quantitative Finance, 19(7):1151–1163, 2019.
  * [13] Jeffrey Chu, Yuanyuan Zhang, and Stephen Chan.  The adaptive market hypothesis in the high frequency cryptocurrency market.  International Review of Financial Analysis, 64:221–231, 2019.
  * [14] Yuanyuan Zhang, Stephen Chan, Jeffrey Chu, and Hana Sulieman.  On the market efficiency and liquidity of high-frequency cryptocurrencies in a bull and bear market.  Journal of Risk and Financial Management, 13(1), 2020.
  * [15] Dominik M. Rösch, Avanidhar Subrahmanyam, and Mathijs A. van Dijk.  The Dynamics of Market Efficiency.  The Review of Financial Studies, 30(4):1151–1187, 10 2016.
  * [16] L.M. Calcagnile, F. Corsi, and S. Marmi.  Entropy and efficiency of the etf market.  Computational Economics, 55:143–184, 2020.
  * [17] Vitor Leone and Frank Kwabi.  High frequency trading, price discovery and market efficiency in the ftse100.  Economics Letters, 181:174–177, 2019.
  * [18] Fabrizio Lillo and J. Doyne Farmer.  The long memory of the efficient market.  Studies in Nonlinear Dynamics & Econometrics, 8(3), 2004.
  * [19] Eugene F. Fama.  Efficient capital markets: A review of theory and empirical work.  The Journal of Finance, 25(2):383–417, 1970.
  * [20] C. E. Shannon.  A mathematical theory of communication.  The Bell System Technical Journal, 27(3):379–423, 1948.
  * [21] Katalin Marton and Paul C. Shields.  Entropy and the Consistent Estimation of Joint Distributions.  The Annals of Probability, 22(2):960 – 977, 1994.
  * [22] Andrey Shternshis, Piero Mazzarisi, and Stefano Marmi.  Efficiency of the moscow stock exchange before 2022.  Entropy, 24(9):1184, 2022.
  * [23] Andrey Shternshis and Piero Mazzarisi.  Variance of entropy for testing time-varying regimes with an application to meme stocks.  arXiv preprint arXiv:2211.05415, 2022.
  * [24] A. M. Zubkov.  Limit distributions for a statistical estimate of the entropy.  Theory of Probability & Its Applications, 18(3):611–618, 1974\.
  * [25] Xavier Brouty and Matthieu Garcin.  A statistical test of market efficiency based on information theory.  Quantitative Finance, 23(6):1003–1018, 2023.
  * [26] Mariano Matilla-García.  A non-parametric test for independence based on symbolic dynamics.  J Econ Dyn Control, 31(12):3889–3903, 2007.
  * [27] Steve Pincus and Rudolf Kalman.  Irregularity, volatility, risk, and financial market time series.  Proceedings of the National Academy of Sciences of the United States of America, 101:13709–14, 2004.
  * [28] Gabjin Oh, Seunghwan Kim, and Cheoljun Eom.  Market efficiency in foreign exchange markets.  Physica A: Statistical Mechanics and its Applications, 382(1):209–212, 2007.
  * [29] Jose Alvarez-Ramirez and Eduardo Rodriguez.  A singular value decomposition entropy approach for testing stock market efficiency.  Physica A, 583:126337, 2021.
  * [30] Zbyněk Šidák.  Rectangular confidence regions for the means of multivariate normal distributions.  Journal of the American Statistical Association, 62(318):626–633, 1967.
  * [31] Thomas Schürmann and Peter Grassberger.  Entropy estimation of symbol sequences.  Chaos: An Interdisciplinary Journal of Nonlinear Science, 6(3):414–427, 1996.
  * [32] G. P. Basharin.  On a statistical estimate for the entropy of a sequence of independent random variables.  Theory of Probability & Its Applications, 4:333–336, 1959.
  * [33] J. Neyman and E. S. Pearson.  On the use and interpretation of certain test criteria for purposes of statistical inference.  Biometrika, 20A(1-2):175–240, 12 1928.
  * [34] Patrick Billingsley.  Statistical methods in markov chains.  The Annals of Mathematical Statistics, 32(1):12–40, 1961.
  * [35] Paul C. Shields.  The Ergodic Theory of Discrete Sample Paths.  American Mathematical Society, 1996.
  * [36] S. Kullback and R. A. Leibler.  On information and sufficiency.  Annals of Mathematical Statistics, 22:79–86, 1951.
  * [37] Martin D. Gould, Mason A. Porter, Stacy Williams, Mark McDonald, Daniel J. Fenn, and Sam D. Howison.  Limit order books.  Quantitative Finance, 13(11):1709–1742, 2013.
  * [38] Roel C. A Oomen.  Properties of realized variance under alternative sampling schemes.  Journal of Business & Economic Statistics, 24(2):219–237, 2006\.
  * [39] Jean-Philippe Bouchaud, Yuval Gefen, Marc Potters, and Matthieu Wyart.  Fluctuations and response in financial markets: the subtle nature of ‘random’ price changes.  Quantitative Finance, 4(2):176, 2003.
  * [40] Fabrizio Lillo, Szabolcs Mike, and J Doyne Farmer.  Theory for long memory in supply and demand.  Physical review e, 71(6):066122, 2005.
  * [41] Carl Chiarella and Giulia Iori.  A simulation analysis of the microstructure of double auction markets.  Quantitative finance, 2(5):346, 2002.
  * [42] Josef Lakonishok, Andrei Shleifer, and Robert W Vishny.  The impact of institutional trading on stock prices.  Journal of financial economics, 32(1):23–43, 1992.
  * [43] Marco Cipriani and Antonio Guarino.  Estimating a structural model of herd behavior in financial markets.  The American Economic Review, 104(1):224–251, 2014.
  * [44] Blake LeBaron and Ryuichi Yamamoto.  Long-memory in an order-driven market.  Physica A: Statistical mechanics and its Applications, 383(1):85–89, 2007.
  * [45] Jean-Philippe Bouchaud, Marc Mézard, and Marc Potters.  Statistical properties of stock order books: empirical results and models.  Quantitative finance, 2(4):251, 2002.
  * [46] Robert F. Engle and Jeffrey R. Russell.  Autoregressive conditional duration: A new model for irregularly spaced transaction data.  Econometrica, 66(5):1127–1162, 1998.
  * [47] Bruno Biais, Pierre Hillion, and Chester Spatt.  An empirical analysis of the limit order book and the order flow in the paris bourse.  The Journal of Finance, 50(5):1655–1689, 1995.
  * [48] Robert F. Engle.  The econometrics of ultra-high-frequency data.  Econometrica, 68(1):1–22, 2000.
  * [49] Christian Y. Robert and Mathieu Rosenbaum.  A New Approach for the Dynamics of Ultra-High-Frequency Data: The Model with Uncertainty Zones.  Journal of Financial Econometrics, 9(2):344–366, 2010.
  * [50] Thomas W. Epps and Mary Lee Epps.  The stochastic dependence of security price changes and transaction volumes: Implications for the mixture-of-distributions hypothesis.  Econometrica, 44(2):305–321, 1976.
  * [51] Jean-Philippe Bouchaud.  The subtle nature of financial random walks.  Chaos: An Interdisciplinary Journal of Nonlinear Science, 15(2):026104, 2005.
  * [52] Thierry Foucault, Marco Pagano, and Ailsa Röell.  Limit Order Book Markets.  In Market Liquidity: Theory, Evidence, and Policy. Oxford University Press, 2013.
  * [53] Suzanne S. Lee and Per A. Mykland.  Jumps in Financial Markets: A New Nonparametric Test and Jump Dynamics.  The Review of Financial Studies, 21(6):2535–2563, 2007.
  * [54] Kim Christensen, Roel C.A. Oomen, and Mark Podolskij.  Fact or friction: Jumps at ultra high frequency.  Journal of Financial Economics, 114(3):576–599, 2014.
  * [55] Charles J. Corrado.  Event studies: A methodology review.  Accounting & Finance, 51(1):207–234, 2011.
  * [56] S. S. Wilks.  The likelihood test of independence in contingency tables.  The Annals of Mathematical Statistics, 6(4):190–196, 1935.
  * [57] Jeffrey A. Busse and T. Clifton Green.  Market efficiency in real time.  Journal of Financial Economics, 65(3):415–437, 2002.
  * [58] Louis K. C. Chan and Josef Lakonishok.  The behavior of stock prices around institutional trades.  The Journal of Finance, 50(4):1147–1174, 1995.
  * [59] Mark S. Grinblatt, Ronald W. Masulis, and Sheridan Titman.  The valuation effects of stock splits and stock dividends.  Journal of Financial Economics, 13(4):461–490, 1984.
  * [60] Thanh D. Huynh and Daniel R. Smith.  Stock price reaction to news: The joint effect of tone and attention on momentum.  Journal of Behavioral Finance, 18(3):304–328, 2017.
  * [61] Wesley S. Chan.  Stock price reaction to news and no-news: drift and reversal after headlines.  Journal of Financial Economics, 70(2):223–260, 2003.