26 March, 2019

Book Survey: Algorithmic PartTrading & DMA

This text book by Barry Johnson provides an introduction to algorithmic trading and execution strategies, as well as discussing market microstructure details for the major asset classes.

As with other book surveys, we will write down a sequence of increasingly detailed skeletons representing the structure of the text book.  This methodology helps organize one's thinking and enables memory recall when certain information from the text is needed in future situations that my arise, such as in cross-referencing information in other text books being analyzed the same way.

___________________________________________________________

18 March, 2019

Intercepting Internal Aggressive Orders

Imagine that another desk within your firm sends a manual market order to buy 1,000 contracts of EDM9 when the visible liquidity is 1,000 @ 97.85.  Suppose you could see this order before it was sent to the exchange and that you had some signal that predicted $\delta_{t,t+h} p_{t}<0$ (or an associated strategy that would execute at an expected average lower price).

What should you do?  If your signal is high-confidence, you could "intercept" the order by filling the desk's order intended for the exchange at the visible price, and then covering your position later at time $t+h$ at the more favorable price.  If your signal turns out to be accurate, then both books benefit: the former gets their order filled at the intended size and price with no slippage or other transaction costs such as market impact and leaking information to the market, and the latter pockets the price change $\delta_{t,t+h}p_{t}$.

If your signal turns out to be incorrect, then the desk at least gets the benefit of perfect execution, even if it as at the expense of your strategy, this being the accepted risk of running the strategy.

This type of strategy of intercepting aggressive orders, filling them immediately internally, and delaying routing to the actual order to the market or otherwise implementing some  execution strategy is known as internalization and is an example of an opportunistic signal-driven algorithmic execution strategy.

10 March, 2019

Using Entropy to Estimate Probability of Adverse Selection

Under conditions that the probability of good news and bad news are equal (i.e., $\delta p<0$ and $\delta p>0$ happen equally probably), the probability of informed trading can be shown to be

$$VIN=\frac{\alpha\mu}{\alpha\mu+2\epsilon}$$

where $\alpha$ is the probability of an informational event, $\mu$ is the arrival rate of informed orders and $\epsilon$ is the arrival rate of uninformed orders.  Heuristically, it is the portion of flow relative to the overall flow that is coming from informed traders.

Let $V$ be the size of a set of volume bars $(V_\tau)_{1\leq\tau\leq N}$.  Of the tickets associated to the bar $\tau$ let $V^B_\tau$ and $V^S_\tau$ be the total volume arising from buys and sells, where each tick is classified as a buy or sell using some algorithm such as the tick rule or Lee-Ready algorithm.

Under the same assumptions, it can be shown that $V=E(V^B_\tau+E^S_\tau)=\alpha\mu+2\epsilon$ and $E|V^B_\tau-V^S_\tau|=\alpha\mu$.  Consequently, in the volume bar coordinates, we have (adding the "V" for emphasis)

$$VPIN=\frac{E|V^B_\tau-V^S_\tau|}{V}=\frac{1}{V}E|2^B_\tau-V|$$

If we re-define $V^B_\tau$ as the portion of buy volume relative to $V$, then

$$VPIN=E|2V^B_\tau-1|=E|1-2V^S_\tau|$$

We define this quantity as the order flow imbalance in volume bar $\tau$, or $OI_\tau$.  Note that

$$|OI_\tau|\gg>0$$

is a necessary, yet insufficient condition for adverse selection.  To be sufficient, we need

$$|E_0(OI_\tau)-OI_\tau|\gg0.$$

That is, $OI_\tau$ must be large and unpredictable for the market maker, so that they will trade with an informed trader and be adversely selected by charging insufficient bid-offer spreads.

We can use information theory in order to extract a useful feature from this analysis.  Let $(V^B_\tau)_{1\leq\tau\leq N}$ be a sequence of portions of buy volumes for a set of volume bars of size $V$.  For a specified $q$, let $\{K_1,\ldots,K_q\}$ be the corresponding collection $q$ quantiles and $f(V^B_\tau)=i$ if $V^B_\tau\in K_i$.  We then "quantize" the sequence of volumes portions to an integer sequence

$$X_\tau:=(f(V^B_{\tau_1}),\ldots,f(V^B_{\tau_N}))$$

for which we can estimate $H[X_\tau]$ using the Limpel-Ziv algorithm and then derive the cumulative distribution $F(H[X_\tau])$ and use this time-series as a feature for classifying adverse selection in the order flow.

11 January, 2019

Relating Random Variables and their Statistics to Inner Products

Let us consider a typical real-valued random variable $Y$ defined on a probability space $(\Omega,\mathcal{F},\mathbb{P})$.  Let $X$ be another such random variable, and assume $X,Y\in L^{2}(\mathcal{F}$).  We emphasize the $\sigma$-algebra $\mathcal{F}$ because this will be the structural element of our probability space subject to frequent change; in particular, the measure and sample space $\Omega$ will remain constant (we ignore the issues that arise with this assumption when additional random variables are added to our universe, and implicitly assume $\Omega$ and $\mathbb{P}$ have been properly extended in a way that is consistent with all other previous random variables in play).

The space $L^{2}(\mathcal{F})$ is a Hilbert space with norm
$$(X,Y)=\mathbb{E}[XY]=\int_{\Omega}X(\omega)Y(\omega)\;d\mathbb{P}(\omega).$$ The integral defining this inner product can be calculated as a Lebesgue integral on the range of the random vector $(X,Y)$ (in particular, an integral over $\mathbb{R}^{2}$) in the usual way by changing variables and using the appropriate push-forward (distribution) measures of $X$ and $Y$ (and densities if the distributions are absolutely continuous with respect to Lebesgue measure).


28 October, 2015

Measure Theoretic Approach to Linear Regression

In this post we discuss the basic theory of linear regression, mostly from the perspective of probability theory.  At the end we devote some time to statistical applications.  The reason for focusing on the probabilistic point of view is to make rigorous the actual use of linear regression in applied settings; furthermore, the approach clarifies what linear regression actually is (and isn't). Indeed, there seems to be wide gaps in understanding among practitioners, probably due to the ubiquitous use of the methodology and the need for less mathematically inclined people to use it.

Regardless of the perspective, we have a probability (sample) space $(\Omega,\mathcal{F},\mathbb{P})$ and real-valued $\mathcal{F}$-measurable random variables $X$ and $Y$ defined on $\Omega$.  What differentiates the probabilistic and statistical point of views are what we know about $X$ and $Y$.  In the former, we know their distributions, i.e. all of the statistical properties of $X$ and $Y$ on their (continuous) range of values.  In the latter case we have only samples $\{(x_{n}, y_{n})\}_{n\geq0}$ of $X$ and $Y$.  In regression theory, the goal is to express a relationship between $X$ and $Y$ and associated properties, a much easier task from the probabilistic point of view since we have a parametric (or at least fully determined) distributions.  From the statistical point of view, due to lack of a complete distribution, we have to make certain modeling, distributional, and even sampling assumptions in order to make useful inferences (without these assumptions, the inferences we would be able to make would be far too weak to serve any useful purpose).  We will discuss some of these assumptions that are typical in most regression applications later.  For now, we focus on $X$ and $Y$ with known distribution measures $\mu_{X}$ and $\mu_{Y}$.