allenfrostline

Literature Review on Optimal Order Execution (4)


2018-05-06

Today we implement the order placement strategy in Almgren and Chriss (2000) s.t. for a certain order size $Q$, we can estimate the probability to perform the optimal strategy in the paper within time horizon of $T$.

Mathematical Formulation

It is tolerable1 in HFT that we assume stock price evolves according to the discrete time arithmetic Brownian motion:

\begin{cases} dS(t) = \mu dt + \sigma dW(t),\\ dQ(t) = -\dot{Q}(t)dt \end{cases}

where $Q(t)$ is the quantity of stock we still need to order at time $t$. Now let $\eta$ denote the linear coefficient for temporary market impact, and let $\lambda$ denote the penalty coefficient for risks. To minimize the cost function

$$ C = \eta \int_0^T \dot{Q}^2(t) dt + \lambda\sigma\int_0^T Q(t) dt $$

we have the unique solution given by

$$ Q^*(t) = Q\cdot \left(1 - \frac{t}{T^*}\right)^2 $$

where $Q\equiv Q(0)$ is the total and initial quantity to execute, and the optimal liquidation horizon $T^*$ is given by

$$ T^* = \sqrt{\frac{4Q\eta}{\lambda\sigma}}. $$

Here, $\eta$ and $\lambda$ are exogenous parameters and $\sigma$ is estimated from the price time series (see the previous post) within $K$ time units, given by

$$ \hat{\sigma}^2 = \frac{\sum_{i=1}^n (\Delta_i - \hat{\mu}_{\Delta})^2}{(n-1)\tau} $$

where $\\{\Delta_i\\}$ are the first order differences of the stock price using $\tau$ as sample period, $n\equiv\lfloor K / \tau\rfloor$ is the length of the array, and

$$ \hat{\mu}_{\Delta} = \frac{\sum_{i=1}^n \Delta_i}{n}. $$

Notice that $\hat{\sigma}^2$ is proved asymptotically normal with variance

$$ Var(\hat{\sigma}^2) = \frac{2\sigma^4}{n}. $$

Now that we know

$$ \hat{\sigma}^2 \equiv \frac{16Q^2\eta^2}{\lambda^2 \hat{T}^4} \overset{d}{\to} \mathcal{N}\left(\sigma^2, \frac{2\sigma^4}{n}\right) $$

which yields

$$ \frac{16Q^2\eta^2}{\lambda^2\hat{\sigma}^2\hat{T}^4}\overset{d}{\to}\mathcal{N}\left(1, \frac{2}{n}\right), $$

to keep consistency of parameters, with $n\equiv \lfloor K/\tau\rfloor \to\infty$ we can also write

$$ \frac{16Q^2\eta^2}{\lambda^2\hat{\sigma}^2\hat{T}^4}\overset{d}{\to}\mathcal{N}\left(1, \frac{2\tau}{K}\right). $$

with which we can estimate the probability of successful strategy performance. Specifically, the execution strategy is given above, and the expected cost of trading is

$$ C^* = \eta \int_0^{T^*} \left(\frac{2Q}{T}\left(1 - \frac{t}{T^*}\right)\right)^2 dt + \lambda\sigma\int_0^{T^*} Q\cdot \left(1 - \frac{t}{T^*}\right) dt = \frac{4\eta Q^2}{3T^*} + \frac{\lambda \sigma QT^*}{3} = \frac{4}{3}\sqrt{\eta\lambda\sigma Q^3}. $$

Implementation

import numpy as np
from scipy.stats import norm


def generate_abm(mu, sigma, K, S0):
    np.random.seed(222)
    dS = mu - sigma**2 / 2 + sigma * np.random.normal(size=K)
    S = np.cumsum(np.append(S0, dS))
    return S


class OrderExecution:    
    def __init__(self, S, tau):
        delta = S[tau::tau] - S[:-tau:tau]
        self.sigma2 = ((delta - delta.mean())**2).sum() / (len(delta) - 1) / tau
        self.tau = tau
        self.K = len(S)

    def info(self, Q, T, eta, lmd):
        statistic = 16 * Q**2 * eta**2 / lmd**2 / self.sigma2 / T**4
        prob = 1 - norm.cdf(statistic, loc=1, scale=2 * self.tau / self.K)
        retn = np.sqrt(eta * lmd * self.sigma2**.5 * Q**3) * 4 / 3
        return retn, prob


S = generate_abm(0.002, 0.06, 50000, 100)
OE = OrderExecution(S, 10)
OE.info(10, 3.6405, 0.02, 1)
(1.465147881156472, 0.8431842483948604)

which means there’s a probability of 84.3% that we can perform our order placement strategy of size 10 within 3.6405 time units and minimize the trading cost of 1.47 at optimum.


  1. Over long-term investment time scales or in extremely volatile markets it is important to consider geometric rather than arithmetic Brownian motion; this corresponds to letting $\sigma$ scale with $S$ But over the short-term trading time horizons of interest the total fractional price changes are small and the difference between arithmetic and geometric Brownian motions is negligible. (Almgren and Chriss, 2000) ↩︎