Wednesday, 13 July 2016

IEX Discretionary Peg (DPEG) calculation and patent

NYSE's move back in March (annexe + SEC comment letters) to essentially duplicate IEX's DPEG, with few differences is an interesting move. It also begs the question of what does IEX's patent application cover and what are the chances of it being granted?

I didn't start to write this for that reason. I've had some correspondence around the DPEG crumbling quote formula and just wanted to share how you can derive that formula yourself.

Firstly, here is IEX's DPEG formula:

Now, it's easy to get a feel for what this is doing. If the DPEG is a buy order and the market's protected bid quote volume is large, then N is big. The QIF formula will useresulting in one over a big number, which will result in a near zero, or low, number. It will be less than 0.32, IEX's quote instability threshold. That is, lots of volume on your side of the market means the market is stable and not in a position that indicates a crumbling quote. Quite natural. All the other features detract from this stability to some degree as their weights are the opposite of the near side weight at time now. Though remember, now is 350 microseconds into the future, as per the use of non-speed bumped data in a speed bumped exchange.

Let's look at the quashing function:

This is a normal kind of sigmoid such as those which were popular in old style perceptrons and neural networks. Deep nets simplify this, but I digress. The sigmoid keeps the values between 0 and 1 and is easily differentiable which has some advantages.

This is a common form that is also used in a logistic regression. Here is the usual logistic regression formula.

You may now understand how IEX might derive those values. You would do a logistic regression over all the candidate stock data using your favourite stats tool, such as R. This will spit out your constants, or weights, that give you the desired probability, or certainty, of your crumbling quote target. Naturally there will be errors in the formula's prediction but it looks pretty conservative from where I'm sitting.

You can now imagine that you could dream up other factors, and timeframes, that may, perhaps, give a better predictor. You can also imagine something better than a logistic regression might provide you with superior predictions. Also, a sensible person will realise that all stocks don't behave the same. Critically, liquid and illiquid stocks will behave quite differently.

These simple facts mean a few things. Firstly, an exchange that copies IEX's DPEG could tune things differently if they try by simply adjusting the parameters, targets, and time frames a little. Secondly, you could have different parameter sets for different stocks or stock types, or even have different parameterisations for each stock. This sounds complex, but investors are already facing a black box so does it really matter if that transparent black box is more complicated, right? In that vein, it also opens the door to simply using much better predictors, or even machine learnt black boxes, such as support vector machines, random forests, or, deep neural nets, as an alternative to the simple logistic regression. You could even just use a simple heuristic formula. Unsurprisingly, this is covering the same territory a broker's algo or an HFT would consider to avoid adverse selection.

For an exchange to do such an order type, the first step might be to do what NYSE has done and just copy the same parameters. That should make the approval easy with the SEC, as it has already approved IEX's DPEG. Then an extension argument for a different model or parameters may be incrementally argued. That would likely be a compelling argument as you're trying to aid your customers with better behaviours. The complexity starts to get messier, but the genie is already out of the bottle with the base DPEG.

Market structure, thanks to complex order types, is about to get crazier.

IEX Patents

The other interesting consideration is the patent situation with IEX. It has been well publicised that IEX has a patent application in for their DPEG. If a party willfully violates a patent they could be facing triple damages. That is a bit of a gamble on NYSE's part as they must be confident that their implementation doesn't conflict with the patent or that the patent would not be granted. IEX's mechanism doesn't seem a particularly novel mechanism, unless you feel the combination of a normal predictor with a public ATS or exchange is a unique combination of utility and thus protected.

Here is the IEX Group Inc patent for reference:
US20160055581A1: Dynamic Peg Orders in an Electronic Trading System [pdf]
This is the primary claim:
 1. An apparatus for facilitating dynamic peg orders in an electronic trading system, the apparatus comprising: a first communication interface configured to receive a trading order concerning an item of interest; a second communication interface configured to receive price data of said item of interest from at least one other electronic trading system; a matching engine, operatively coupled to the first and second communication interfaces, configured to vary price discretion of said trading order based on the received price data, wherein: the matching engine restricts execution of said trading order to a first pricing range when the received price data indicate an instability in quotes for said item of interest, and the matching engine permits execution of said trading order in a second pricing range when the received price data indicate a stability in quotes for said item of interest, said second pricing range being more aggressive than said first pricing range. 
Fairly broad and generic.

If I was an existing exchange, I'd introduce a DPEG style, PEG with limit with a self styled adverse selection avoidance metric. There is a good chance you will not have to chance your arm against the IEX patent that way if it is carefully designed.

For completeness, here are some other IEX patents or patent applications:
US20150081508A1: Techniques for facilitating electronic trading [pdf]
US20150073967A1: Transmission latency leveling apparatuses, methods and systems [pdf]
US20160078537A1: System and method for facilitation cross orders [pdf]
US20160078538A1: System and method for a semi-lit market [pdf]
US20150302441A1: Systems and methods for providing up-to-date information for transactions [pdf]
US20150261625A1: Techniques for message retransmission mechanism [pdf]
US20150261614A1: Systems and Methods for Data Synchronization and Failover Management [pdf]
Patents. Complexity. All good for HFTs paying attention. Not so great for the average trader.

Happy trading,

PS: This blog was linked to by FT Alphaville, "Dark liquidity, lit formulas and IEX: A primer on paranoia", Alexandra Scaggs. It's now a circular reference, so don't load this up in a spreadsheet ;-)
Referred to from your essential daily goto.
Matt Levine on Bloomberg View considering deep neural nets too.


  1. Is N quantity (sum of displayed size) or number of individual orders forming the NBBO?

    1. N is a bit strange in that it is the number of markets at the NBBO.