Imagine this nightmare scenario: you are a statistical arbitrage trader at a proprietary trading desk or hedge fund. As such, you routinely hold an inventory of ETF exposure that you must hedge.
The previous night, you instructed your overnight traders to calculate the hedge ratios for a matrix of ETF’s.
The next morning before the market opens, your junior quant traders eagerly present their results for your inspection. You load the hedge ratios into your trading platform and wait for the open.
When the market first opens for trading, you re-balance your hedges according to the new ratios. Afterwards, you watch in horror as your hedges do not perform as expected. What went wrong?
Every good trader knows they have to adapt when conditions in the market change, so why do we demand otherwise from our trading models? The traders in our example relied on static hedge ratios to power their trading logic. As a result, they opened themselves up to what is known as parameter risk.
Updating your parameters as new information becomes available is one way to protect yourself from this under-appreciated trading risk. A great model for accomplishing this in a trading scenario is the Kalman Filter.
Demystifying Kalman Filter
Kalman Filter is an online (real-time) algorithm that estimates a system state as it receives new information. The algorithm is named after the developer of its theory, Rudolf E. Kalman. One of the first application of the Kalman Filter was on the Apollo project. The Kalman Filter is used to this very day in guidance and navigation systems, particularly aircraft, missiles, and spacecraft.
HOW ARE KALMAN FILTERS USED IN PAIRS TRADING?
Kalman Filters are optimal estimation algorithms. The two main benefits are:
The variables of interest (i.e. submarines deep under water space rocket engine) can only be measured indirectly.
Measurements are available from various sensors but are subject to noise (i.e. radar, accelerometers, financial markets)
The second benefit is why the Kalman Filter is an excellent algorithm to incorporate within your pairs trading models. As stated above, when conditions in the market change it is critical that your trading models adjust to various market conditions that expose your PnL to parameter risk (i.e. stale hedge ratios).
Hence, Kalman Filters are useful when dealing with a linear model such as pairs trading, which in its simplest form reduces down to trading the residual of a linear regression:
Yt = ßt * Xt + et
Where Yt is the current price of the first stock, Xt is the current price of the second ßt stock, is our current hedge ratio and et is the current spread price we are trading. We could also estimate the hedge ratio using the log changes in X and Y, instead of their levels. This would be more likely to be the case in a High Frequency Trading scenario, where all we care about are price changes. The Kalman Filter allows us to vary the hedge ratio over time. For example, suppose we assume the hedge ratio follows a random walk, i.e.
ßt = ßt-1 + wt