Monday, April 3, 2017

Limit order book dynamics

The price changes triggered by a market order depend on the content the limit order  book.
A lob with constant depth yields a price change which is linear in the order size.
A lob with linearly increasing  depth yields a price change which is grows as the square root of the order size.
A lob with quadratically increasing  depth yields a price change which is grows as the cubic root of the order size.
And so on. . The code is here. Among the empirical values reported in the literature for the function's exponent I've found 0.5 and 0.76.

Saturday, February 25, 2017

Spoofing, intention and AI


The 2010 Flash Crash wasn't a particularly glorious moment for the finance community. The search for culprits led to Navinder Singh Sarao , who ended up pleading guilty of spoofing (as well as of wire-fraud). As any high-frequency trader will tell you, spoofing, i.e. "placing bids with the intention of canceling them before they are executed", is a felony.

Now, let us consider the scenario sketched in my previous post and consider an AI-agent, let's say a dml-game-theoretic algorithm trained to maximize profits in a competitive environment . Will it spoof? Will it place "bids with the intention of canceling them before they are executed"?

Lawyers take note. AI-forensics is in its infancy (think of the Tesla car crash), but it will grow fast.

Sunday, February 19, 2017

AI and the predictability paradox in finance



The no-arbitrage assumption is the bedrock of much of current financial markets modelling. At the same time time machine learning plays an increasing role in finance. Machine learning provides predictive capabilities which is highly relevant to financial trading. However, since every trade affects the market price of securities, effective predictions  destroy the assumption that financial markets are Markov processes. Let us consider a market where two or more players, each one striving to maximize  its profit, have predictive capabilities. Their strategies will impact and change the market. This will lead either to a winner take all situation or to an unpredictable crash-boom dynamics.
While the situation described is highly simplified, the underlying issue of free will (i.e. profit optimization) vs. predictability is real. The game-theoretic aspect will  be decisive. I am not aware of a theoretical framework dealing with this issue in quantitative terms (cf. [1]).

An interesting tidbit in this respect emerges from two quotes from this Bloomberg article about the Medaillon fund, reputedly the most successful of its kind: " ... we believe we have an excellent set of predictive signals, some of these are undoubtedly shared by a number of long/short hedge funds” and  "Too much money destroys returns. Renaissance currently caps Medallion’s assets between $9 billion and $10 billion" [2]. As trading algorithms predictions converge, managing their impact on the market becomes more difficult. As an aside for those who bother to read the whole article, Alexander Belopolsky is a member of the Theano development team.

[1] For a related philosophical discussion see e.g. S.Rummens, S.E.Cuypers "Determinism and the Paradox of Predictability" Erkenntnis, March 2010, Volume 72, Issue 2, pp 233–249. The instability scenario above relates to the "the typically oscillating nature of the paradoxical equation P = not-P" in [1] where traders "common causal history" are encoded in their trading strategies.

[2] Buying a security pushes up its price. Selling it pushes it down. The more one buys, the more one pays. The more one sells, the less one gets. The result is that, even admitting that the prediction about the the market is basically correct, the actual implementation of the strategy will distort the prices, the more so the bigger the volumes, as traders will heap up. At the same time the security price will return to its intrinsic value, penalizing any prediction based strategy. Determining the elasticity coefficients involved ins a highly relevant problem. See this paper by Gayduk and  Nadtochiy for a rigorous mathematical treatment of the issue.