Keywords

1 Introduction

Closing prices of stocks are important and often serve as reference points for investors to determine their performance. Closing prices are particularly relevant to managers of mutual funds. For mutual funds, flow trades correspond to inflows or outflows of cash when clients decide to buy or sell shares of the fund. Regardless of the specific time the transactions are taking place on a trading day, the mutual fund will receive from or pay to the client the closing price on that day. Hence, managers of such funds use the closing price as their benchmark: they aim to achieve a price that is as close as possible to the closing price and, if possible, more favourable than the closing price.

Fig. 1
figure 1

Timeline of the closing auction at NASDAQ

At stock exchanges in many emerging markets and almost all developed markets (see FTSE Russell [7] for an overview), the closing price is determined through an auction. The auction mechanisms and rules are similar for different markets. For this note, we focus on NASDAQ, where all traders are granted access to the same information. Each day until 3:50 p.m. Eastern Time, traders can submit orders to the closing auction at NASDAQ without any restriction. At 3:50 p.m., NASDAQ publishes an initial imbalance announcement, with information on the projected imbalance of the auction. Afterwards, NASDAQ publishes imbalance information every five seconds until 4:00 p.m. Between 3:50 p.m. and 4:00 p.m., restrictions on the possibility to submit orders to the closing auction apply, so to reduce the projected imbalance. At 4:00 p.m., the closing price is determined such that the most orders submitted to the auction are matched. Figure 1 gives an overview of the closing auction at NASDAQ. The goal of this note is to introduce a tractable stock price model around the close and to study what an optimal execution strategy is for a trader targeting the closing price. This work is in the area of algorithmic trading, the analysis and implementation of mathematical and computational algorithms to conduct trading decisions and asset management. Mathematical studies for algorithmic trading started with seminal papers by Bertsimas and Lo [3], who set up a discrete-time model to minimize expected slippage, and by Almgren and Chriss [1], who focused on the trading strategy targeting the arrival price benchmark including risk considerations. An overview of trading algorithms targeting different benchmarks can be found in the recent books by Cartea et al. [4], and Lehalle and Laruelle [9]. While trading strategies for many benchmarks, such as arrival price, VWAP (volume weighted average price), TWAP (time weighted average price) and POV (percentage of volume), have been well studied, there is only sparse literature on execution problems with a closing price benchmark. Frei and Westray [6] consider the particular situation in Hong Kong, where the closing price of stocks is computed as the median of five prices over the last minute of trade. Kan and Park [8] derive an optimal trading strategy in a continuous-time model with a mean-variance optimization criterion. Also using a mean-variance optimization criterion, but in a discrete-time setting, Labadie and Lehalle [10] find recursive formulae when considering arrival and closing price benchmarks.

In contrast to all these works, we include in our model the imbalance announcement, which provides crucial information when targeting the closing auction price. We find an explicit formula for the optimal execution strategy, which trades a part of the order before the imbalance announcement. This is because the trader benefits from favourable prices before the imbalance announcement by front running the impact of the trader’s own participation in the closing auction. After the imbalance announcement, prices reflect the imbalance information so that, for our trader, it is not favourable to execute further orders. This result of not trading after the imbalance announcement is in line with observations in Bacidore et al. [2], who discuss issues surrounding trading in and around the closing auction.

2 Problem Formulation

Our market model consists of \(T-1\) periods in the open market, with T the closing time of the auction. Let \(\tau < T\) be the time of the initial imbalance announcement. At NASDAQ, \(\tau \) and T correspond to 3:50 p.m. and 4:00 p.m., respectively. We consider a trader with a buy order of W units of some stock. The trader can split the order into \(v_1,v_2,\ldots ,v_T\) with \(\sum _{t=1}^{T}v_t = W\), where \(v_1,v_2,\ldots ,v_{T-1}\) are the volumes of orders submitted to the open market and \(v_T\) is submitted to the closing auction.

We suppose that the order imbalance is cleared immediately and there are no orders in the closing auction after 3:50 p.m., which are stylized features close to what we observe at NASDAQ. For a given initial price \(\tilde{P}_0\), the prices excluding our market impact are modelled by

$$\begin{aligned} \tilde{P}_t= & {} \tilde{P}_{t-1} + Z_t \quad \text { for } t\in \{1,\ldots ,\tau -1,\tau +1\ldots ,T-1\},\\ \tilde{P}_\tau= & {} \tilde{P}_{\tau -1} + Z_\tau + \alpha {N},\\ \tilde{P}_T= & {} \tilde{P}_{T-1} + Y, \end{aligned}$$

where

  • \(Z_t\), modelling the stock price fluctuations in the open market, are independent and identically distributed with mean zero and finite variance \(\sigma ^2_Z\).

  • Y, modelling the fluctuations from the last price in the open market to the auction price, is independent from \(Z_t\) with mean zero and finite variance \(\sigma ^2_Y\).

  • \(N= \tilde{N}+v_T\) is the auction imbalance (a positive value means more buy than sell orders at the current stock price), consisting of our auction order submission, \(v_T\), and that of all other market participants, \(\tilde{N}\). We assume that \(\tilde{N}\) is independent from \(Z_t\) and Y, and it has mean zero and finite variance \(\sigma ^2_{\tilde{N}}\).

  • \(\alpha > 0\) reflects the impact of the auction imbalance on stock prices.

Assumptions similar to the above independence between auction volume and price increments have been made in the literature and are empirically justified; see for example Fig. 1 in Frei and Westray [5].

We assume that the trader’s orders have a temporary market impact so that they affect stock prices at the execution time, but have no influence on subsequent stock prices. This means that the trader effectively pays a price

$$ P_t = \tilde{P}_{t} + \beta v_t \text { for } t\in \{1,2,\dots ,T-1\}, $$

where \(\beta >0\) is the coefficient of temporary market impact. We set \(P_T = \tilde{P}_T\) because our order placed in the closing auction, \(v_T\), is already reflected in the earlier price \( \tilde{P}_\tau \) through \(N= \tilde{N}+v_T\).

The trader targets the closing price \(P_T\). As is standard in the literature on algorithmic trading and in line with [1, 6, 8,9,10], we consider a mean-variance formulation. Thus, the objective is to minimize, over \(v_t \ge 0\) with \(\sum _{t=1}^{T}v_t = W\),

$$ E\bigg [\sum _{t=1}^{T}v_tP_t - WP_T\bigg ] + \lambda VAR\bigg [\sum _{t=1}^{T}v_tP_t - WP_T\bigg ] $$

for a given mean-variance tradeoff parameter \(\lambda >0\), modelling the trader’s risk aversion. This means that we minimize a combination of average costs and deviations to the closing price benchmark.

3 Main Result

Our main result gives an explicit formula for the optimal strategy.

Theorem 1

The optimal strategy is given by

$$\begin{aligned} v_1= & {} \frac{\alpha W}{2(\beta +m_1+\sum _{i=2}^{\tau -1}m_ip_i)},\\ v_t= & {} p_t v_1 \quad \text { for } t = 2,3,\dots ,\tau -1,\\ v_k= & {} 0 \quad \text { for } k = \tau ,\tau +1,\dots ,T-1,\\ v_T= & {} W-\bigg (1+\sum _{i=2}^{\tau -1}p_i\bigg )v_1, \end{aligned}$$

where

$$\begin{aligned} m_t:= & {} (T-t)\lambda \sigma ^2_Z+\lambda \sigma ^2_{Y}+\lambda \alpha ^2\sigma ^2_{\tilde{N}}+\alpha ,\\ p_t:= & {} \bigg ( \frac{\lambda \sigma ^2_{Z}}{\beta }+1-x_-\bigg )\frac{x_+^t}{x_+^2-1}+\bigg (\frac{\lambda \sigma ^2_{Z}}{\beta }+1-x_+\bigg )\frac{x_-^t}{x_-^2-1},\\ x_\pm:= & {} 1+\frac{\lambda \sigma ^2_{Z}}{2\beta }\pm \sqrt{\frac{\lambda \sigma ^2_{Z}}{\beta }\bigg (1+\frac{\lambda \sigma ^2_{Z}}{4\beta }\bigg )}. \end{aligned}$$

The theorem shows that the portion \( \frac{2(\beta +m_1+\sum _{i=2}^{\tau -1}m_ip_i) - \alpha - \alpha \sum _{i=2}^{\tau -1}p_i }{2(\beta +m_1+\sum _{i=2}^{\tau -1}m_ip_i)} W\) of the total order W is placed into the closing auction. The remaining part is submitted to the open market before the initial imbalance announcement, with small orders \(v_1, v_2,\ldots ,v_{\tau -1}\) that are exponentially increasing over time with basis \(x_\pm \). It is not optimal to trade after the initial imbalance announcement.

Remark 1

  1. (1)

    If the trader’s orders have no influence on the stock prices in the closing auction (\(\alpha = 0\)), then it is optimal to trade only in the closing auction, that is, \(v_T=W.\)

  2. (2)

    If the trader’s orders have no influence on the stock prices in the open market (\(\beta = 0\)), then the optimal trading in the open market occurs only at the moment before the initial imbalance announcement. In particular, we have \(v_t=0\) for all \( t \ne \tau -1,T\) and

    $$ v_{\tau -1}=\frac{\alpha W}{2\big ( (T-\tau +1)\lambda \sigma ^2_Z+\lambda \sigma ^2_{Y}+\lambda \alpha ^2\sigma ^2_{\tilde{N}}+\alpha \big )},\quad v_T=W-v_{\tau -1}. $$
  3. (3)

    The value of the mean-variance tradeoff parameter \(\lambda \) determines how much focus the trader puts on minimizing deviations to the benchmark compared to minimizing average costs. If \(\lambda \) is big, the trader will submit most of the order to the closing auction so to minimize deviations to the closing price. Indeed, in the limit as \(\lambda \rightarrow \infty \), the theorem implies that \(v_t \rightarrow 0\) for \(t = 1,2,\dots ,T-1\) and \(v_T \rightarrow W\), using that \(m_t \rightarrow \infty \) for any t as \(\lambda \rightarrow \infty \). By contrast, for \(\lambda \rightarrow 0\), we have \(v_t \rightarrow \frac{\alpha W}{2\beta + 2\alpha ( \tau -1)}\) for \(t = 1,2,\dots ,\tau -1\) and \(v_T \rightarrow \frac{ (2\beta + \alpha ( \tau -1))W}{2\beta + 2\alpha ( \tau -1)}\), as we can show that \(m_t \rightarrow \alpha \) and \(p_t \rightarrow 1\) as \(\lambda \rightarrow 0\). In this case of \(\lambda \rightarrow 0\), the trader minimizes average costs.

  4. (4)

    In a generalized setting when the assumptions that \(\tilde{N}\), \(Z_t\) and Y have zero means are relaxed, we can find a recursive algorithm for the optimal strategy, generalizing the explicit formula from Theorem 1; see Yan [11] for details.

4 Sketch of the Proof of Theorem 1

Using the assumptions that \(\tilde{N}\), \(Z_t\) and Y have zero means, we can rewrite the objective function as

$$\begin{aligned}&\min \ \beta \sum _{t=1}^{T-1}v_t^2+\alpha \sum _{t=1}^{\tau -1}v_t\sum _{t=1}^{T-1}v_t-\alpha W\sum _{t=1}^{\tau -1}v_t+\lambda \sigma ^2_Z\sum _{t=2}^{T-1}\bigg (\sum _{i=1}^{t-1}v_i\bigg )^2\\&\qquad +\,\lambda \sigma ^2_{Y}\bigg (\sum _{t=1}^{T-1}v_t\bigg )^2+\lambda \alpha ^2\sigma ^2_{\tilde{N}}\bigg (\sum _{t=1}^{\tau -1}v_t\bigg )^2\\&\text {subject to } \ W-\sum _{t=1}^{T-1}v_t\ge 0 \text { and } v_t\ge 0 \text { for all } t\in \{1,\dots ,T-1\}. \end{aligned}$$

We analyze the corresponding Lagrange function given by

$$\begin{aligned} L(v_1,v_2,\dots ,v_{T-1};\delta )= & {} \beta \sum _{t=1}^{T-1}v_t^2+\alpha \sum _{t=1}^{\tau -1}v_t\sum _{t=1}^{T-1}v_t-\alpha W\sum _{t=1}^{\tau -1}v_t +\,\lambda \sigma ^2_Z\sum _{t=2}^{T-1}\bigg (\sum _{i=1}^{t-1}v_i\bigg )^2\\&+\lambda \sigma ^2_{Y}\bigg (\sum _{t=1}^{T-1}v_t\bigg )^2+\lambda \alpha ^2\sigma ^2_{\tilde{N}}\bigg (\sum _{t=1}^{\tau -1}v_t\bigg )^2+\delta \bigg (\sum _{t=1}^{T-1}v_t-W\bigg ) \end{aligned}$$

and examine its first-order condition with respect to the execution order \(v_t\) at each point in time. To minimize the objective function, the following Karush-Kuhn-Tucker (KKT) conditions must hold:

$$\begin{aligned} v_t\frac{\partial L}{\partial v_t}= & {} 0, \ v_t\ge 0,\ \frac{\partial L}{\partial v_t}\ge 0 \quad \text { for } t\in \{1,2,\dots ,T-1\},\\ \delta \frac{\partial L}{\partial \delta }= & {} 0,\ \delta \ge 0, \ \frac{\partial L}{\partial \delta }\le 0. \end{aligned}$$

By using the KKT conditions, we can show that it is not optimal to trade after the initial imbalance announcement based on a proof by contradiction.

Using \(v_t=0\) for \(t = \tau ,\tau +1,\dots ,T-1\), we can reduce the level of complexity in the system of equations from the KKT conditions. We solve the system of KKT equations recursively, that is, we rewrite it such that each of its equations gives a linear relation between \(v_t\), \(v_{t-1}\) and \(v_{t-2}\). By applying the concept of characteristic equation to this recursive system of equations, we can derive the explicit optimal trading strategy for every period before the initial imbalance announcement, given in Theorem 1.

5 Implementation Example

In this section, we use data on intraday stock prices and imbalance volumes during the closing auction to estimate input parameters, and then illustrate the optimal trading strategies for an investment in Amazon.com Inc. (AMZN). We choose the time increment in trading periods to be one second. The overall trading horizon consists of the last half hour before market close, which means the considered trading begins at 3:30 p.m. To estimate model parameters, we use a date set from Nov. 1, 2016 to Jan. 27, 2017, with intraday stock price, volume and imbalance data from NASDAQ. In this estimation, we find \(\alpha = 5.72 \times 10^{-6}\), \(\sigma ^2_{\tilde{N}} = 6.6 \times 10^9\), \(\sigma ^2_Z = 1.96 \times 10^{-8}\) and \(\sigma ^2_Y = 3.21 \times 10^{-8}\) while we set \(\lambda = 5 \times 10^{-4}\) and \(\beta = 10^{-6}\) in line with Sect. 3.4 of Almgren and Chriss [1]. We assume that the goal is to purchase \(W = \)100,000 shares of the AMZN stock on January 30, 2017.

Fig. 2
figure 2

Cumulative trading volume for AMZN based on the strategy of Theorem 1

Fig. 3
figure 3

AMZN price dynamics for the different scenarios: observed prices (blue: ‘Actual’), prices with an additional order entirely submitted to the closing auction (red: ‘Only C.A.’), and prices with an additional order submitted based on the strategy of Theorem 1 (green: ‘Strategy’)

Figure 2 shows the cumulative trading volume based on the strategy of Theorem 1. After the initial imbalance announcement, the cumulative trading volume remains constant, until a spike occurs at 4:00 p.m., which reflects the order placed in the closing auction.

Figure 3 shows the different paths for AMZN’s stock prices. The blue path corresponds to the actual historical stock prices on Jan. 30, 2017. We added two different price paths that incorporate our trading decisions. The red path models the stock prices if we purchased the entire 100,000 shares in the closing action while the green path displays the prices under our optimal strategy from Theorem 1. The price impact induced by the proposed strategy is considerably lower than that of the benchmark strategy. In this example, implementation costs of the strategy using only the closing auction are $83,095,241 while the optimal strategy entails implementation costs of $82,846,209, which reflects a cost reduction of $249,032, or 30 basis points. A more extensive analysis of the performance across 15 stocks listed at NASDAQ is contained in Yan [11]. In that study, the proposed strategy yields a positive and stable performance across different stocks. While the strategy may lead to temporary losses on some trading days, it showed an outperformance compared to trading in only the closing auction for all tested stocks over a one-month test period. Because the trading strategy is available in explicit form, its computation time for one stock and one trading day is only a couple of seconds on a standard personal computer.

The optimal strategy depends also on the chosen values for the mean-variance tradeoff parameter \(\lambda \) and the coefficient \(\beta \) of temporary market impact. A higher value of \(\lambda \) means that the trader is more risk averse, and thus, trades a bigger portion in the closing auction. This is indeed the case, as we observe in Fig. 4 for a comparison with different values of \(\lambda \): \(10^{-4}\) (low), \(5 \times 10^{-4}\) (default), and \(10^{-3}\) (high), using the same other parameters as described at the beginning of this section. A higher value of the coefficient \(\beta \) means that the trader has a bigger impact on prices in the open market. When \(\beta \) is high, the trader will spread the orders more evenly during the period of the open market to reduce price impact while taking more risk from price fluctuations. This is confirmed in Fig. 5, which shows a comparison for different values of \(\beta \): \(10^{-7}\) (low), \(10^{-6}\) (default), and \(10^{-5}\) (high), with the other parameters the same as described at the beginning of this section.

Fig. 4
figure 4

Cumulative trading volume for AMZN compared for different values of \(\lambda \): \(10^{-4}\) (low; green), \(5 \times 10^{-4}\) (default; blue), and \(10^{-3}\) (high; red)

Fig. 5
figure 5

Cumulative trading volume for AMZN compared for different values of \(\beta \): \(10^{-7}\) (low; green), \(10^{-6}\) (default; blue), and \(10^{-5}\) (high; red)

6 Conclusion

In this note, we derived an explicit optimal strategy for a trader who targets the closing prices of stocks listed at NASDAQ. The trader attempts to minimize a combination of average costs and deviations to the closing price benchmark. We introduced a tractable model, which takes the key microstructural features into account, namely, fluctuations in stock prices and the impact of the order imbalance announcement. The optimal strategy puts a major part into the closing auction and smaller, exponentially increasing fractions in the open market before the imbalance announcement. No execution is done after the imbalance announcement. Using historical imbalance volume and intraday stock prices, we showed an example of how our optimal strategy can be implemented. Further statistical analysis done in Yan [11] indicate, persistently across different stocks of NASDAQ and different levels of the trader’s risk aversion, an improvement compared to trading in the closing auction only; in particular, our optimal strategy has lower average costs.