Market impact – or the tendency for large trades to push prices the wrong way – has been the bane of many a buy-side quant’s existence for decades.
Solutions range from simple price limits to complex stochastic models, but the common aim is to make quick decisions on how and when to execute based on potentially vast datasets – meaning the quality of a trading strategy may end up depending on how much computational firepower is available.
For some quants, the growing buzz around machine learning offered a great opportunity to test a new technology on an old problem.
One of the first to try their hand was Gordon Ritter, an adjunct professor at New York University and a former senior portfolio manager at systematic hedge fund GSA Capital in New York.
In his recent paper, Machine learning for trading, Ritter applies a technique known as reinforcement learning to generate trading strategies in a way that minimises market impact.
Fellow quants see it as an important step in a promising new field of research.“It provides key insight into how to use reinforcement learning to solve this general class of trading problems,” says Petter Kolm, a clinical professor of mathematics at the Courant Institute of Mathematical Science at New York University (NYU). “These are complex problems to solve with classical approaches, and reinforcement learning provides a computational and accurate alternative.”
Two of the biggest obstacles to optimal execution of a trade are the computational burden involved in most solutions, and a heavy dependence on model assumptions.
We spend a lot of time making sure our backtest actually matches our live profit and loss when we run it on the same dayGordon Ritter, New York University
Ritter’s paper eliminates models altogether, instead training a computer to trawl through large datasets, simulate market impact, and work out how to build an optimal trading strategy. The technique can be run in real time, allowing it to be applied to live trading very quickly.The benefit is potentially massive, as market impact can make or break a trading strategy, says Ritter – particularly for strategies that involve regular buying and selling, in an attempt to capture relatively small premia.
“I know one’s own market impact can kill a quantitative trading strategy, if you’re not careful,” says Ritter.
Some quants estimate as much as two-thirds of the gain on trades can be lost to these costs.
When a large trade is executed, there might not be enough liquidity at a given price, so the trade would need to be broken up into chunks, or execution delayed over time. But smaller orders can also move prices against a trader – and waiting for minutes, hours or days to complete a trade may see an opportunity slip by. The problem – often known as ‘trader’s dilemma’ – can be managed with so-called optimal execution algorithms that decide how to schedule trades so any impact is minimised.
Over the past two decades, many solutions have emerged, arguably the most popular being the Almgren-Chriss model that sets a terminal horizon, or a timeframe within which the trades need to be completed, and penalises the trade based on the uncertainty of an agent’s revenue – when this is high, the trade is executed more rapidly to reduce exposure to uncertainty over time.
Detractors of the approach argue this does not necessarily result in optimal execution of the trade. Another issue is that the trading schedule is static, meaning it can’t be changed if market conditions shift after trading has started.
Many quants have tried to overcome this through dynamic programming, which reacts to changing market conditions, but this makes the problem non-linear, involving cumbersome numerical methods. Trying to speed up such algorithms has been the main focus of research on this topic in recent years.
One of the co-creators of the Almgren-Chriss model, Robert Almgren, argued the algorithms need to behave more like human traders and adapt quickly in order to be effective.
Against this background, in 2013, Ritter started exploring the potential of machine learning to identify optimal execution strategies. At the time, he was working at investment firm Highbridge Capital Management in New York.
“We were hitting up against these non-linear modelling problems, so I started looking into machine learning,” says Ritter.
The quant also started teaching data sciences at the Courant Institute of Mathematical Sciences at NYU around the same time.
The solution Ritter eventually developed uses reinforcement learning to simulate market impact and find a strategy that maximises the value of the trade, minus all associated costs and adjusted for its risk.
Reinforcement learning is a type of machine learning that seeks to train the machine, through a large number of simulations, to choose the best course of action under a particular market condition, so when the machine trades in real life, it already knows what the optimal course of action is.
Because the machine learns and stores the optimal action based on experience, there is no need for a model in this approach.
“What makes the reinforcement learning approach very interesting and attractive is that the resulting computer algorithm in some sense doesn’t need to know the sophisticated mathematics that is otherwise associated with solving problems of this kind. It learns by doing, through reinforcement,” says NYU Courant’s Kolm.
Millions of scenarios can be run during the training process, so during actual trading the machine can churn out the strategy in less than a second, says Ritter.
Ritter adds actual implementations of the technique have always involved rigorous back testing to make sure there is no overfitting to the training dataset – a problem many opponents of machine learning have with the technology.
“We don’t run thousands of backtests and pick the parameter setting that appears to work best in history. Rather, we spend a lot of time making sure our backtest actually matches our live profit and loss when we run it on the same day,” adds Ritter. “So if we run our backtests for yesterday, the P&L better equals what we got in the market yesterday all the way down to a lot of details like taxes on dividends. We need to get the cost in the backtest exactly right. I think that’s the mistake a lot of the quant trading firms make.”
Ritter completed his PhD in mathematical physics at Harvard University in 2007. Towards the end of his time at Harvard, Robert Merton – of Black-Scholes-Merton modelling fame – was still a professor there, and Ritter’s own career would have taken a different path, he believes, if it hadn’t been for one of Merton’s finance courses at Harvard.
“My first real exposure to finance was actually to audit Merton’s continuous time finance course at Harvard Business School, and that really opened my eyes to the fact that there really is some very difficult and deep maths that was applied in finance. Before that, I really had no clue, but after that I was hooked,” he says.
Ritter joined Highbridge Capital Management in 2008, where he was subsequently promoted to vice-president and tasked with discovering new alpha models. He left for GSA Capital at the end of 2014, where he helped develop equity statistical arbitrage strategies.
Ritter developed a quick portfolio optimisation technique during his time at GSA Capital that combines Markowitz’s portfolio optimisation with economist Stephen Ross’s arbitrage pricing theory (APT). The former requires construction of very large noisy correlation matrices and the latter is used to represent the relationship between risk and return using a few factors. In Ritter’s model, the factors are used to explain the returns, instead of having to estimate huge covariance matrices, which makes the optimisation faster.
“If you have thousands of assets in the equity space, you can’t estimate the covariance matrix without some sort of dimension reduction, so Ross’s APT theory provides a very convenient dimension-reduced model,” says Ritter.
After three years at GSA Capital, Ritter is now planning to start his own statistical arbitrage fund.
“It’s a very information-driven strategy so it will rely on data science and we will basically look at the sea of data out there. We first of all will use intuition as traders to try and come up with ideas on what we think drives stock returns,” adds Ritter.
The quant will also be applying his new ideas on optimal execution to reduce market impact.
Ritter says he will also be exploring the use of machine learning to other applications in the future, such as options hedging, for instance. A working paper co-authored by NYU Courant’s Kolm is looking at ways reinforcement learning can be used for hedging options portfolios subject to transaction costs and discrete rebalancing. The goal is to create an optimal hedge that minimises the variance of the replication error and all trading costs.
“You have bid-offer spreads, you have market impact, you have various kinds of transaction costs to worry about, so you don’t want to hedge frequently,” says Ritter. “It’s a multi-period problem, so you want to look ahead and minimise your variance to the end of the lifetime of the option. That can be solved as a reinforcement learning problem.”
- Libor leaders: ABP crafts blueprint for corporate Libor switch
- Libor leaders: how seven firms are tackling the transition
- Libor replacement: a modelling framework for in-arrears term rates
- Swaps data: a new era of competition in interest rate futures
- From memos to texts, algos fish for signals in-house