David King

full stack developer

All Blog Articles

Prev « Practical Internationalisation Next » Khan Draw


Complexity

20 Jul 2015

I've just finished reading Complexity, A Very Short Introduction, what a cracking book! The idea that dynamic hierarchies can emerge from a simple set of physical or theoretical rules has been something that I've always believed to be true, now I have a smattering of new vocabulary and ideas to draw upon when thinking about the subject, I feel blessed.

I was pretty fortuitous in reading this book directly after Flash Boys as they harmonised wonderfully, the former giving me a gripping story to reference when reading the latter.

Flash Boys is an interesting exposé about high-tech thieves lurking within the logical rules of the Stock Market - their existance isn't surprising (crooked banks? how cliché), the real story is how the perpetrators hid in plain sight by adding a few simple rules to the market, knowing exactly how to exploit them for massive profits. Their logic and approach is impressive, to be able to predict and adapt to the patterns that emerge from a few simple rule changes is something very few people can do, nobel laureate level intelligence.

It's a pretty big subject, but I want to show you a quick example of this before looking at complexity.

How it should work

  1. Trader A buys 1,000 shares of Company A on a single Stock Exchange
  2. The Exchange then attempts to buy the shares from other traders on the same exchange who are selling
  3. If the Exchange can't fulfil the order internally then it will pass the order to other Exchanges until the 1,000 shares have been sold

How adding a single rule screws things up

The above model shows how simple it should be, it looks innocent enough, but if you add an extra order-type that can be sent

Wait in the queue until someone tries to buy these shares, then buy shares first

Lets assume a 3rd party "Trader X" has sent a buy command with this new order-type, remember he doesn't actually get the share until someone else tries to buy it, and because he sent the command first, he gets priorty, lets see how that routine looks now.

  1. Trader A buys 1,000 shares of Company A on a single Stock Exchange
  2. The Exchange then attempts to buy the shares from other traders on the same exchange who are selling
    • Trader X was ahead of the queue with the "wait and buy" command
    • Trader X gets 1 share of Company A
    • Trader X uses this as a "notification" to buy shares in Company A on other Exchanges, it does this very quickly
  3. If the Exchange can't fulfil the order internally then it will pass the order to other Exchanges until the 1,000 shares have been sold
    • It just so happens that Trader X has shares on other Exchanges, at a slightly higher price than expected.

As you can see, adding a simple rule has made the routine look a lot more complicated, and Trader A doesn't notice anything different as this happens in a fraction of a second. As far as he's concerned, he bought some shares from one exchange, and some from another, pretty normal. These techniques are called Front Running (using insider information to buy shares first) and Scalping (driving up the price ever so slightly and taking a little profit off the top).

It's not all doom and gloom, IEX and Liquidnet, are new markets attempting to simplify the system once more, as is the NYSE (I'm not sure if I believe this one).

Complexity

The science of Complexity is blurry, it's still being explored and discovered so there's no true consensus on how to define it. However it does have some agreed properties:

In the case of a stock exchange we have rules (buy, sell, wait-and-buy), the interactions are many (front-running, scalping, baiting), we see hierarchies emerge (the market, exchanges, traders, high-frequency traders).

Overall, I couldn't recommend this book highly enough, it gets a bit mathematical in places, but it's worth it!


Prev « Practical Internationalisation Next » Khan Draw