Keywords

JEL Classification

1 Introduction

There is a growing interest in high-frequency trading (HFT) due to technological developments and the increasing use of technologies in financial markets. Felker et al. (2014) define HFT, a subset of algorithmic trading (Muthuswamy et al., 2010), as any consistent trading activity with a significantly brief time span, and a high number of daily discrete round turns (completed trades) and messages. Zhang (2010) describes HFT as fully automated trading strategies with very high trading volume and extremely short holding periods ranging from milliseconds to minutes and possibly hours. The United States Securities Exchange Commission (2014) defines five characteristics of HFT:

  1. 1.

    Use of extraordinarily high speed and sophisticated programs for generating, routing, and executing orders;

  2. 2.

    Use of co-location services and individual data feeds offered by exchanges and others to minimize network and other latencies;

  3. 3.

    Very short time-frames for establishing and liquidating positions;

  4. 4.

    Submission of numerous orders that are canceled shortly after submission and;

  5. 5.

    Ending the trading day in as close to a flat position as possible (that is, not carrying significant, unhedged positions overnight).

Companies today are spending tens of millions of dollars on extremely large and/or complex datasets (“big data”) as well as HFT infrastructure and technology, because “[m]illiseconds are millions” (Fang & Zhang, 2016). Using big data is a popular choice in today's financial community as it allows traders to make better investment choices and receive continuous feedback on their actions. The reasoning is that big data entails using large data samples, which increases confidence when making decisions. Despite the inherent volatility in financial markets, big data allows investors to quickly get a picture of the actual situation. Previously, online investing in the stock market involved making decisions based solely on market trends and calculating known risks. Today, these calculations are executed more efficiently by a computer program that can come to smarter conclusions with more information. Therefore, big data plays a primary role in decision-making for online trading, and, accordingly, we have seen an increase in resources allocated to big data in recent years.

HFT developed thanks to big data, which has, in turn, made it possible to place several hundred buy and sell orders in seconds, or even milliseconds, while optimizing risks. The development of HFT allowed investors to buy and resell stocks in a short enough period of time to avoid potentially negative market movement during the transaction.

In this study, we examine the impact of HFT on the market efficiency of the Moroccan Stock Exchange. Market efficiency implies that stock market variations are unpredictable as stock prices reflect the available information (Fama, 1995). This study, the first to use HFT in Africa, relates to one of the most developed African stock markets. Indeed, the Moroccan stock market, also known as the Casablanca Stock Exchange or the CSE, is the third oldest stock market in Africa and the third-largest by market capitalization. The small number of studies on HFT is due to the unavailability of data. This chapter offers two important contributions. First, this chapter builds on existing literature on HFT by analyzing a developing African exchange. Second, this chapter contributes to the analysis of the market efficiency of HFT. Previous studies on the Moroccan Stock Exchange, using daily data, rejected the random walk hypothesis and revealed evidence of behavioral biases such as herding behavior (Ferrouhi, 2021) and calendar anomalies (Ferrouhi et al., 2021).

Moreover, our results have policy implications concerning the accessibility to HFT. Privileged traders that have access to this data can, in theory, beat the market if markets are indeed inefficient. In the next section, we present a brief literature review of existing studies conducted on HFT and market efficiency. Next, in Sect. 3, we present our data and methodology, while in Sect. 4, we present our results. Section 5 serves as a conclusion to the chapter.

2 Literature Review

Several authors find that HFT played a positive role in improving market efficiency (Carrion, 2013; Manahov & Hudson, 2014; Martinez & Rosu, 2013), decreasing volatility (Brogaard, 2011; Hagstrӧmer & Nordѐn, 2013; Hansbrouck & Saar, 2013), and contributing to market stability (Hendershott & Riodran, 2011). However, other studies reveal the negative role of HFT in market volatility (Foucault et al., 2016; Leone & Kwabi, 2019; Zhang, 2010), price instability (Leone & Kwabi, 2019), and market efficiency (Jones, 2013). HFT's lack of availability disadvantages several market actors (Brogaard, 2011; Jones, 2013). For instance, the Australian Securities and Investments Commission (ASIC) report published in 2013 demonstrates that HFT negatively impacts the market.

The extant literature contains few studies that examine the role of HFT in price discovery and price efficiency. Thus, Brogaard et al. (2014) use data at millisecond frequencies from the NASDAQ and the New York Stock Exchange and find that HFT predicts price changes over horizons of less than three to four seconds. Meanwhile, Leone and Kwabi (2019) investigate the weak efficiency form in the FTSE100 and reject the hypothesis of a random walk at both millisecond and second frequencies, while the authors accept this hypothesis at 10, 15, 30, 60, 120, and 240-minute frequencies. Other studies that have investigated the market efficiency of HFT are concerned with stock indices in the United States (e.g. Carrion, 2013; Shafi et al., 2019; Zhang, 2010), in the United Kingdom (e.g. Leone & Kwabi, 2019); in Europe (e.g. Ammar & Hellara, 2021; Haferkom, 2017); currencies (e.g. Manahov et al., 2014), and cryptocurrencies (e.g. Aslan & Sensoy, 2020; Sensoy, 2019), among other things. Virgilio (2019) presents a literature review on the effect of HFT on volatility, transaction costs, liquidity, price discovery, and flash crashes. This chapter will test the market efficiency in HFT and thus fill a gap in the literature.

3 Methodology and Data

This chapter aims to study the impact of high-frequency trading on market efficiency in the Moroccan Stock Exchange. The existence of market efficiency suggests that investors cannot beat the market, while a rejection of market efficiency implies that investors may be able to realize returns higher than the market by using HFT. Fama (1970) defines three forms of market efficiency:

  1. (a)

    Weak form: prices include all the historical data,

  2. (b)

    Semi-strong form: prices include all publicly available data, and

  3. (c)

    Strong form: prices include both the public and private data.

The hypothesis we test in this paper is that HFT improves the market efficiency of the Moroccan Stock Exchange (at the millisecond, 1-second, 30-second, 1-minute, 2-minute, 5-minute, 10-minute, and 15-minute frequencies).

3.1 Methodology

The variance ratio test (Lo & MacKinlay, 1988) and Chow and Denning joint test (1993) are the tests commonly used to test the weak form of efficiency. The variance ratio test tests if a time series follows a random walk. The Lo and MacKinlay variance ratio \(VR\left(k\right)\) is calculated as follows:

$$VR\left(k\right)= \frac{{\sigma }^{2}(k)}{{\sigma }^{2}(1)}$$

where \({\sigma }^{2}(k)\) is 1/k times the variance of (\({X}_{t}- {X}_{t-1})\), calculated as follows:

$${\sigma }^{2}\left(k\right)= \frac{1}{m} \sum_{t=k}^{nk}{({X}_{t}- {X}_{t-k}-k\widehat{\mu })}^{2}$$

and \({\sigma }^{2}(1)\) is the variance of (\({X}_{t}- {X}_{t-1})\), calculated as follows:

$${\sigma }^{2}\left(1\right)= \frac{1}{nk-1} \sum_{t=1}^{nk}{({X}_{t}- {X}_{t-k}-\widehat{\mu })}^{2}$$
  • where \(m=q(nq-q+1)(1-k{n}^{-1})\)

  • and \(\widehat{\mu }= \frac{1}{nk} \sum_{t=1}^{nk}\left({X}_{t}- {X}_{t-1}\right)= \frac{1}{nk} ({X}_{nk}- {X}_{0})\)

  • and \({X}_{t}=ln{P}_{t}\)

\({P}_{t}\) is the index price at t. If ratios are equal to one, then that series follows a random walk, while positive or negative ratios are synonymous with positive and negative autocorrelation. Low and Mackinlay (1988) suggest two test statistics:

  • under the null hypothesis of homoskedastic increments random walk:

    $${M}_{1}\left(k\right)= \frac{VR\left(k\right)-1}{\phi {(k)}^\frac{1}{2}} , N(\mathrm{0,1})$$

    where

    $$\phi \left(k\right)= \frac{2\left(2k-1\right)(k-1)}{3kn}$$
  • under the null hypothesis of heteroskedastic increments random walk:

    $${M}_{2}\left(k\right)= \frac{VR\left(k\right)-1}{{\phi }^{*}{(k)}^\frac{1}{2}} , N(\mathrm{0,1})$$

    where

    $${\phi }^{*}(k)= \sum_{j=1}^{k-1}{\left[\frac{2\left(k-j\right)}{k}\right]}^{2}\delta (j)$$

    and

    $$\delta \left(j\right)= \frac{\sum_{t=j+1}^{nk}{({X}_{t}- {X}_{t-1}- \widehat{\mu })}^{2}{({X}_{t-j}- {X}_{t-j-1}- \widehat{\mu })}^{2}}{{\left[\sum_{t=1}^{nk}{({X}_{t}- {X}_{t-1}- \widehat{\mu })}^{2}\right]}^{2}}$$

Chow and Denning (1993) extend Lo and MacKinlay's variance ratio test and develop the Chow and Denning joint test. Considering a set of variance ratio estimates \(\left\{VR\left({q}_{i}\right) \left|I=1, 2, \dots .,m\right.\right\}\), where m corresponds to a set of a pre-defined number of lags and \({M}_{1}(k)\) and \({M}_{2}(k)\) presented above. The Chow and Denning joint test tests a set of sub-hypothesis:

$$H_{0i} \quad VR\left( {k_{i} } \right) = 1,\;{\text{for}}\;i = 1, 2, \ldots ., m$$
$$H_{1i} \quad VR\left( {k_{i} } \right) \ne 1,\;{\text{for}}\;i = 1, 2, \ldots ., m$$

The largest absolute value of the test statistics are

$$MV_{1} = \max \left| {M_{1} \left( k \right)} \right.,\;1 \le i \le m$$

and

$$MV_{2} = \max \left| {M_{2} \left( k \right)} \right.,\;1 \le i \le m$$

Chow and Denning (1993) follow SMM distribution (studentized maximum modulus distribution). The null hypothesis is rejected at \(\alpha\) level of significance if \(MV\) is greater than \([1- \left(\frac{{\alpha }^{*}}{2}\right)]\) where \({\alpha }^{*}=1- {(1-\alpha )}^\frac{1}{m}\).

Following Belaire-Franch and Opong (2005) and Leone and Kwabi (2019), we use 2, 5, 10, and 30 differences, and employ the variance ratio test and Chow and Denning multiple variance ratio test using heteroskedastic robust versions of both.

3.2 Data

This chapter uses data from the MASI (Moroccan All Shares Index), the Casablanca Stock Exchange’s main index, to conduct its study. As of October 7, 2021, there were 74 companies listed in the MASI, and the CSE had the third-largest market capitalization in Africa (after those of South Africa and Namibia), valued at more than USD 56 billion. We obtained data at the precision level of milliseconds under a non-disclosure agreement from the Casablanca Stock Exchange, which covers the period from August 1, 2016 (the beginning of high-frequency trading in the Moroccan stock market) to July 31, 2021. We then selected data at 1- and 30-second frequencies and at the 1-, 5-, 10-, and 15-minute frequencies. The multitude of this data allows for better knowledge of the Moroccan market in terms of risks and opportunities thanks to the shelling of the raw database, which generates the big data in various timestamps.

4 Results

According to Table 1, the skewness reveals that variations tend to be more negative for all frequencies. These results indicate that investors can realize small gains but are also exposed to big losses. The low kurtosis, observed at all time frequencies, reveals that the data exhibits less extreme values. Additionally, the results of the Jarque–Bera test allow us to reject the normality hypothesis, which indicates that the distribution of values does not follow a Gaussian distribution.

Table 1 Descriptive statistics of Moroccan All Shares Index (MASI) price tick changes by different time-frequencies

As presented in Sect. 3, variance ratios above one indicate that markets are inefficient, while ratios equal to one indicate weak market efficiency. As Table 2 illustrates below, the Lo and MacKinlay variance ratio exceeds one at the millisecond, 1-second, and 30-second time frequencies, and so we reject the random walk hypothesis and thus reject the hypothesis of market efficiency for these frequencies. The results of the Chow and Denning joint test further confirm this outcome. Thus, we conclude that privileged investors with access to HFT can predict future prices, and so the possibility of arbitrage exists in this market at these time frequencies. Our results are thus in alignment with those of Brogaard et al. (2014) and Leone and Kwabi (2019).

Table 2 Variance ratio test results

However, results at 1-, 2-, 5-, 10-, and 15-minute frequencies show evidence of a random walk. As a result, we conclude that HFT improves the market efficiency of the Moroccan stock exchange at low time frequencies (1-, 2-, 5-, 10-, and 15-minute frequencies). These results confirm those obtained in developed markets (Carrion, 2013; Manahov & Hudson, 2014; Martinez & Rosu, 2013).

Nevertheless, as the access to high-frequency trading (millisecond, 1-second, and 30-second frequencies) is limited, only investors having access to such data can gain an advantage over the market by predicting future variations. Thus, we remark that the market tends to be more efficient as the data frequency decreases. These findings confirm previous results that the unavailability of HFT disadvantages traders who do not have access to data (Brogaard, 2011; Jones, 2013; Leone & Kwabi, 2019). Thus, the stock market authority for this market (the Moroccan Capital Market Authority) should implement and strengthen measures to protect investors by ensuring that all the information is freely and equally available to investors.

5 Conclusion

This chapter studied the impact of high-frequency trading on market efficiency in the Moroccan Stock Exchange. We used data covering five years, from 2016 to 2021, with frequencies between a millisecond and 15 minutes. We find no evidence of a random walk at the millisecond, 1-second, nor 30-second frequencies. Therefore, it follows that investors with a faster market connection and an efficient algorithm can use privileged information to realize returns higher than those of the market. However, we find evidence of market efficiency at 1, 2, 5, 10, and 15-minute time frequencies. We thus conclude that there is a possibility of arbitrage for investors in this market at higher temporal frequencies. Our main recommendations are that the Moroccan Capital Market Authority implement and strengthen measures to protect investors and increase available information to improve market efficiency, especially at 1-millisecond, 1-second, and 30-second frequencies.

One area in the future to look out for is the growth of big data in financial markets, as it will be useful to analyze our study's data in such a way that time is understood as an important influence on price variations. Such inferences from big data could introduce the application of forecasting and machine learning tools to create accurate models that can be applied and used to forecast future variations more effectively than today. The growth of big data will allow for real-time data analysis from multiple sources (e.g., financial brokers) before executing a trade. Moreover, correlating real-time data with historical data sources would help identify more profitable trades with a higher degree of accuracy; real-time data processing technologies, such as in-memory data grids and processing engines, could assist in this identification, so long as the analysis is made at high frequencies. Investors who can best integrate HFT with big data technologies at high temporal frequencies will be most likely to gain an edge in the financial marketplace in the future.